OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 bsRec->fColor = fRecs->fPaint.getColor(); | 193 bsRec->fColor = fRecs->fPaint.getColor(); |
194 bsRec->fStyle = maskBlur.fStyle; | 194 bsRec->fStyle = maskBlur.fStyle; |
195 bsRec->fQuality = maskBlur.fQuality; | 195 bsRec->fQuality = maskBlur.fQuality; |
196 } | 196 } |
197 return true; | 197 return true; |
198 } | 198 } |
199 | 199 |
200 /////////////////////////////////////////////////////////////////////////////// | 200 /////////////////////////////////////////////////////////////////////////////// |
201 | 201 |
202 void SkLayerDrawLooper::flatten(SkWriteBuffer& buffer) const { | 202 void SkLayerDrawLooper::flatten(SkWriteBuffer& buffer) const { |
203 this->INHERITED::flatten(buffer); | |
204 | |
205 #ifdef SK_DEBUG | |
206 { | |
207 Rec* rec = fRecs; | |
208 int count = 0; | |
209 while (rec) { | |
210 rec = rec->fNext; | |
211 count += 1; | |
212 } | |
213 SkASSERT(count == fCount); | |
214 } | |
215 #endif | |
216 | |
217 buffer.writeInt(fCount); | 203 buffer.writeInt(fCount); |
218 | 204 |
219 Rec* rec = fRecs; | 205 Rec* rec = fRecs; |
220 for (int i = 0; i < fCount; i++) { | 206 for (int i = 0; i < fCount; i++) { |
221 // Legacy "flagsmask" field -- now ignored, remove when we bump version | 207 // Legacy "flagsmask" field -- now ignored, remove when we bump version |
222 buffer.writeInt(0); | 208 buffer.writeInt(0); |
223 | 209 |
224 buffer.writeInt(rec->fInfo.fPaintBits); | 210 buffer.writeInt(rec->fInfo.fPaintBits); |
225 buffer.writeInt(rec->fInfo.fColorMode); | 211 buffer.writeInt(rec->fInfo.fColorMode); |
226 buffer.writePoint(rec->fInfo.fOffset); | 212 buffer.writePoint(rec->fInfo.fOffset); |
(...skipping 11 matching lines...) Expand all Loading... |
238 LayerInfo info; | 224 LayerInfo info; |
239 // Legacy "flagsmask" field -- now ignored, remove when we bump version | 225 // Legacy "flagsmask" field -- now ignored, remove when we bump version |
240 (void)buffer.readInt(); | 226 (void)buffer.readInt(); |
241 | 227 |
242 info.fPaintBits = buffer.readInt(); | 228 info.fPaintBits = buffer.readInt(); |
243 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); | 229 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); |
244 buffer.readPoint(&info.fOffset); | 230 buffer.readPoint(&info.fOffset); |
245 info.fPostTranslate = buffer.readBool(); | 231 info.fPostTranslate = buffer.readBool(); |
246 buffer.readPaint(builder.addLayerOnTop(info)); | 232 buffer.readPaint(builder.addLayerOnTop(info)); |
247 } | 233 } |
248 SkLayerDrawLooper* looper = builder.detachLooper(); | 234 return builder.detachLooper(); |
249 SkASSERT(count == looper->fCount); | |
250 | |
251 #ifdef SK_DEBUG | |
252 { | |
253 Rec* rec = looper->fRecs; | |
254 int n = 0; | |
255 while (rec) { | |
256 rec = rec->fNext; | |
257 n += 1; | |
258 } | |
259 SkASSERT(count == n); | |
260 } | |
261 #endif | |
262 | |
263 return looper; | |
264 } | 235 } |
265 | 236 |
266 #ifndef SK_IGNORE_TO_STRING | 237 #ifndef SK_IGNORE_TO_STRING |
267 void SkLayerDrawLooper::toString(SkString* str) const { | 238 void SkLayerDrawLooper::toString(SkString* str) const { |
268 str->appendf("SkLayerDrawLooper (%d): ", fCount); | 239 str->appendf("SkLayerDrawLooper (%d): ", fCount); |
269 | 240 |
270 Rec* rec = fRecs; | 241 Rec* rec = fRecs; |
271 for (int i = 0; i < fCount; i++) { | 242 for (int i = 0; i < fCount; i++) { |
272 str->appendf("%d: paintBits: (", i); | 243 str->appendf("%d: paintBits: (", i); |
273 if (0 == rec->fInfo.fPaintBits) { | 244 if (0 == rec->fInfo.fPaintBits) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper); | 349 SkLayerDrawLooper* looper = SkNEW(SkLayerDrawLooper); |
379 looper->fCount = fCount; | 350 looper->fCount = fCount; |
380 looper->fRecs = fRecs; | 351 looper->fRecs = fRecs; |
381 | 352 |
382 fCount = 0; | 353 fCount = 0; |
383 fRecs = NULL; | 354 fRecs = NULL; |
384 fTopRec = NULL; | 355 fTopRec = NULL; |
385 | 356 |
386 return looper; | 357 return looper; |
387 } | 358 } |
OLD | NEW |