OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkDrawBitmap_DEFINED | 10 #ifndef SkDrawBitmap_DEFINED |
11 #define SkDrawBitmap_DEFINED | 11 #define SkDrawBitmap_DEFINED |
12 | 12 |
13 #include "SkBoundable.h" | 13 #include "SkBoundable.h" |
14 #include "SkBase64.h" | 14 #include "SkBase64.h" |
15 #include "SkBitmap.h" | 15 #include "SkBitmap.h" |
16 // #include "SkImageDecoder.h" | 16 // #include "SkImageDecoder.h" |
17 #include "SkMemberInfo.h" | 17 #include "SkMemberInfo.h" |
18 | 18 |
19 class SkBaseBitmap : public SkBoundable { | 19 class SkBaseBitmap : public SkBoundable { |
20 DECLARE_MEMBER_INFO(BaseBitmap); | 20 DECLARE_MEMBER_INFO(BaseBitmap); |
21 SkBaseBitmap(); | 21 SkBaseBitmap(); |
22 virtual ~SkBaseBitmap(); | 22 virtual ~SkBaseBitmap(); |
23 virtual bool draw(SkAnimateMaker& ) SK_OVERRIDE; | 23 bool draw(SkAnimateMaker& ) SK_OVERRIDE; |
24 protected: | 24 protected: |
25 SkBitmap fBitmap; | 25 SkBitmap fBitmap; |
26 SkScalar x; | 26 SkScalar x; |
27 SkScalar y; | 27 SkScalar y; |
28 private: | 28 private: |
29 friend class SkDrawTo; | 29 friend class SkDrawTo; |
30 friend class SkDrawBitmapShader; | 30 friend class SkDrawBitmapShader; |
31 typedef SkBoundable INHERITED; | 31 typedef SkBoundable INHERITED; |
32 }; | 32 }; |
33 | 33 |
34 class SkDrawBitmap : public SkBaseBitmap { | 34 class SkDrawBitmap : public SkBaseBitmap { |
35 DECLARE_DRAW_MEMBER_INFO(Bitmap); | 35 DECLARE_DRAW_MEMBER_INFO(Bitmap); |
36 SkDrawBitmap(); | 36 SkDrawBitmap(); |
37 virtual ~SkDrawBitmap(); | 37 virtual ~SkDrawBitmap(); |
38 #ifdef SK_DUMP_ENABLED | 38 #ifdef SK_DUMP_ENABLED |
39 virtual void dump(SkAnimateMaker* ) SK_OVERRIDE; | 39 void dump(SkAnimateMaker* ) SK_OVERRIDE; |
40 #endif | 40 #endif |
41 virtual void onEndElement(SkAnimateMaker& ) SK_OVERRIDE; | 41 void onEndElement(SkAnimateMaker& ) SK_OVERRIDE; |
42 virtual bool setProperty(int index, SkScriptValue& value) SK_OVERRIDE; | 42 bool setProperty(int index, SkScriptValue& value) SK_OVERRIDE; |
43 protected: | 43 protected: |
44 int /*SkBitmap::Config*/ format; | 44 int /*SkBitmap::Config*/ format; |
45 int32_t height; | 45 int32_t height; |
46 int32_t rowBytes; | 46 int32_t rowBytes; |
47 int32_t width; | 47 int32_t width; |
48 SkColor fColor; | 48 SkColor fColor; |
49 SkBool fColorSet; | 49 SkBool fColorSet; |
50 typedef SkBaseBitmap INHERITED; | 50 typedef SkBaseBitmap INHERITED; |
51 }; | 51 }; |
52 | 52 |
53 class SkImageBaseBitmap : public SkBaseBitmap { | 53 class SkImageBaseBitmap : public SkBaseBitmap { |
54 DECLARE_MEMBER_INFO(ImageBaseBitmap); | 54 DECLARE_MEMBER_INFO(ImageBaseBitmap); |
55 SkImageBaseBitmap(); | 55 SkImageBaseBitmap(); |
56 virtual ~SkImageBaseBitmap(); | 56 virtual ~SkImageBaseBitmap(); |
57 virtual SkDisplayable* deepCopy(SkAnimateMaker* ) SK_OVERRIDE; | 57 SkDisplayable* deepCopy(SkAnimateMaker* ) SK_OVERRIDE; |
58 virtual void dirty() SK_OVERRIDE; | 58 void dirty() SK_OVERRIDE; |
59 virtual bool draw(SkAnimateMaker& ) SK_OVERRIDE; | 59 bool draw(SkAnimateMaker& ) SK_OVERRIDE; |
60 virtual bool getProperty(int index, SkScriptValue* value) const SK_OVERRIDE; | 60 bool getProperty(int index, SkScriptValue* value) const SK_OVERRIDE; |
61 virtual void onEndElement(SkAnimateMaker& maker) SK_OVERRIDE; | 61 void onEndElement(SkAnimateMaker& maker) SK_OVERRIDE; |
62 private: | 62 private: |
63 void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); } | 63 void resolve() const { (const_cast<SkImageBaseBitmap*>(this))->resolve(); } |
64 void resolve(); | 64 void resolve(); |
65 protected: | 65 protected: |
66 SkBase64 base64; | 66 SkBase64 base64; |
67 SkString src; | 67 SkString src; |
68 SkString fLast; // cache of src so that stream isn't unnecessarily decoded | 68 SkString fLast; // cache of src so that stream isn't unnecessarily decoded |
69 SkBool fDirty; | 69 SkBool fDirty; |
70 const char* fUriBase; | 70 const char* fUriBase; |
71 typedef SkBaseBitmap INHERITED; | 71 typedef SkBaseBitmap INHERITED; |
72 }; | 72 }; |
73 | 73 |
74 #endif // SkDrawBitmap_DEFINED | 74 #endif // SkDrawBitmap_DEFINED |
OLD | NEW |