/cocos2dx/platform/third_party/blackberry/include/grskia/SkDrawBitmap.h

https://bitbucket.org/Tsiannian/cocos2d-x · C++ Header · 82 lines · 59 code · 6 blank · 17 comment · 0 complexity · fe67936421ea57ff55722837617c4213 MD5 · raw file

  1. /* libs/graphics/animator/SkDrawBitmap.h
  2. **
  3. ** Copyright 2006, The Android Open Source Project
  4. **
  5. ** Licensed under the Apache License, Version 2.0 (the "License");
  6. ** you may not use this file except in compliance with the License.
  7. ** You may obtain a copy of the License at
  8. **
  9. ** http://www.apache.org/licenses/LICENSE-2.0
  10. **
  11. ** Unless required by applicable law or agreed to in writing, software
  12. ** distributed under the License is distributed on an "AS IS" BASIS,
  13. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ** See the License for the specific language governing permissions and
  15. ** limitations under the License.
  16. */
  17. #ifndef SkDrawBitmap_DEFINED
  18. #define SkDrawBitmap_DEFINED
  19. #include "SkBoundable.h"
  20. #include "SkBase64.h"
  21. #include "SkBitmap.h"
  22. // #include "SkImageDecoder.h"
  23. #include "SkMemberInfo.h"
  24. class SkBaseBitmap : public SkBoundable {
  25. DECLARE_MEMBER_INFO(BaseBitmap);
  26. SkBaseBitmap();
  27. virtual ~SkBaseBitmap();
  28. virtual bool draw(SkAnimateMaker& );
  29. protected:
  30. SkBitmap fBitmap;
  31. SkScalar x;
  32. SkScalar y;
  33. private:
  34. friend class SkDrawTo;
  35. friend class SkDrawBitmapShader;
  36. typedef SkBoundable INHERITED;
  37. };
  38. class SkDrawBitmap : public SkBaseBitmap {
  39. DECLARE_DRAW_MEMBER_INFO(Bitmap);
  40. SkDrawBitmap();
  41. virtual ~SkDrawBitmap();
  42. #ifdef SK_DUMP_ENABLED
  43. virtual void dump(SkAnimateMaker* );
  44. #endif
  45. virtual void onEndElement(SkAnimateMaker& );
  46. virtual bool setProperty(int index, SkScriptValue& value);
  47. protected:
  48. int /*SkBitmap::Config*/ format;
  49. int32_t height;
  50. int32_t rowBytes;
  51. int32_t width;
  52. SkColor fColor;
  53. SkBool fColorSet;
  54. typedef SkBaseBitmap INHERITED;
  55. };
  56. class SkImage : public SkBaseBitmap {
  57. DECLARE_MEMBER_INFO(Image);
  58. SkImage();
  59. virtual ~SkImage();
  60. virtual SkDisplayable* deepCopy(SkAnimateMaker* );
  61. virtual void dirty();
  62. virtual bool draw(SkAnimateMaker& );
  63. virtual bool getProperty(int index, SkScriptValue* value) const;
  64. virtual void onEndElement(SkAnimateMaker& maker);
  65. private:
  66. void resolve() const { (const_cast<SkImage*>(this))->resolve(); }
  67. void resolve();
  68. protected:
  69. SkBase64 base64;
  70. SkString src;
  71. SkString fLast; // cache of src so that stream isn't unnecessarily decoded
  72. SkBool fDirty;
  73. const char* fUriBase;
  74. typedef SkBaseBitmap INHERITED;
  75. };
  76. #endif // SkDrawBitmap_DEFINED