OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkLayerDrawLooper_DEFINED | 8 #ifndef SkLayerDrawLooper_DEFINED |
9 #define SkLayerDrawLooper_DEFINED | 9 #define SkLayerDrawLooper_DEFINED |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 /** | 66 /** |
67 * Initial the LayerInfo. Defaults to settings that will draw the | 67 * Initial the LayerInfo. Defaults to settings that will draw the |
68 * layer with no changes: e.g. | 68 * layer with no changes: e.g. |
69 * fPaintBits == 0 | 69 * fPaintBits == 0 |
70 * fColorMode == kDst_Mode | 70 * fColorMode == kDst_Mode |
71 * fOffset == (0, 0) | 71 * fOffset == (0, 0) |
72 */ | 72 */ |
73 LayerInfo(); | 73 LayerInfo(); |
74 }; | 74 }; |
75 | 75 |
76 virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const
SK_OVERRIDE; | 76 SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVER
RIDE; |
77 | 77 |
78 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(LayerDrawLoop
erContext); } | 78 size_t contextSize() const SK_OVERRIDE { return sizeof(LayerDrawLooperContex
t); } |
79 | 79 |
80 virtual bool asABlurShadow(BlurShadowRec* rec) const SK_OVERRIDE; | 80 bool asABlurShadow(BlurShadowRec* rec) const SK_OVERRIDE; |
81 | 81 |
82 SK_TO_STRING_OVERRIDE() | 82 SK_TO_STRING_OVERRIDE() |
83 | 83 |
84 virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; } | 84 Factory getFactory() const SK_OVERRIDE { return CreateProc; } |
85 static SkFlattenable* CreateProc(SkReadBuffer& buffer); | 85 static SkFlattenable* CreateProc(SkReadBuffer& buffer); |
86 | 86 |
87 protected: | 87 protected: |
88 SkLayerDrawLooper(); | 88 SkLayerDrawLooper(); |
89 | 89 |
90 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 90 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
91 | 91 |
92 private: | 92 private: |
93 struct Rec { | 93 struct Rec { |
94 Rec* fNext; | 94 Rec* fNext; |
95 SkPaint fPaint; | 95 SkPaint fPaint; |
96 LayerInfo fInfo; | 96 LayerInfo fInfo; |
97 }; | 97 }; |
98 Rec* fRecs; | 98 Rec* fRecs; |
99 Rec* fTopRec; | 99 Rec* fTopRec; |
100 int fCount; | 100 int fCount; |
101 | 101 |
102 // state-machine during the init/next cycle | 102 // state-machine during the init/next cycle |
103 class LayerDrawLooperContext : public SkDrawLooper::Context { | 103 class LayerDrawLooperContext : public SkDrawLooper::Context { |
104 public: | 104 public: |
105 explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper); | 105 explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper); |
106 | 106 |
107 protected: | 107 protected: |
108 virtual bool next(SkCanvas*, SkPaint* paint) SK_OVERRIDE; | 108 bool next(SkCanvas*, SkPaint* paint) SK_OVERRIDE; |
109 | 109 |
110 private: | 110 private: |
111 Rec* fCurrRec; | 111 Rec* fCurrRec; |
112 | 112 |
113 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&
); | 113 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&
); |
114 }; | 114 }; |
115 | 115 |
116 class MyRegistrar : public SkFlattenable::Registrar { | 116 class MyRegistrar : public SkFlattenable::Registrar { |
117 public: | 117 public: |
118 MyRegistrar(); | 118 MyRegistrar(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 SkLayerDrawLooper* detachLooper(); | 153 SkLayerDrawLooper* detachLooper(); |
154 | 154 |
155 private: | 155 private: |
156 Rec* fRecs; | 156 Rec* fRecs; |
157 Rec* fTopRec; | 157 Rec* fTopRec; |
158 int fCount; | 158 int fCount; |
159 }; | 159 }; |
160 }; | 160 }; |
161 | 161 |
162 #endif | 162 #endif |
OLD | NEW |