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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 Rec* fCurrRec; | 134 Rec* fCurrRec; |
135 | 135 |
136 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo& ); | 136 static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo& ); |
137 }; | 137 }; |
138 | 138 |
139 class MyRegistrar : public SkFlattenable::Registrar { | 139 class MyRegistrar : public SkFlattenable::Registrar { |
140 public: | 140 public: |
141 MyRegistrar(); | 141 MyRegistrar(); |
142 }; | 142 }; |
143 | 143 |
144 friend class SkLayerDrawLooperBuilder; | |
144 typedef SkDrawLooper INHERITED; | 145 typedef SkDrawLooper INHERITED; |
145 }; | 146 }; |
146 | 147 |
148 class SK_API SkLayerDrawLooperBuilder { | |
149 public: | |
150 SkLayerDrawLooperBuilder(); | |
151 ~SkLayerDrawLooperBuilder(); | |
152 | |
153 /** | |
154 * Call for each layer you want to add (from top to bottom). | |
155 * This returns a paint you can modify, but that ptr is only valid until | |
156 * the next call made to addLayer(). | |
157 */ | |
158 SkPaint* addLayer(const SkLayerDrawLooper::LayerInfo&); | |
159 | |
160 /** | |
161 * This layer will draw with the original paint, at the specified offset | |
162 */ | |
163 void addLayer(SkScalar dx, SkScalar dy); | |
164 | |
165 /** | |
166 * This layer will with the original paint and no offset. | |
167 */ | |
168 void addLayer() { this->addLayer(0, 0); } | |
169 | |
170 /// Similar to addLayer, but adds a layer to the top. | |
171 SkPaint* addLayerOnTop(const SkLayerDrawLooper::LayerInfo&); | |
172 | |
173 /** | |
174 * Pass list of layers onto newly built looper and return it. This will | |
175 * also reset the builder, so it can be used to build another looper. | |
176 */ | |
177 SkDrawLooper* createLooper(); | |
reed1
2014/02/07 18:32:22
possibly call this detachLooper(), as in other pla
Dominik Grewe
2014/02/07 18:57:02
Done.
| |
178 | |
179 private: | |
180 SkLayerDrawLooper::Rec* fRecs; | |
181 SkLayerDrawLooper::Rec* fTopRec; | |
182 int fCount; | |
183 }; | |
184 | |
147 #endif | 185 #endif |
OLD | NEW |