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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 LayerInfo info; | 223 LayerInfo info; |
224 // Legacy "flagsmask" field -- now ignored, remove when we bump version | 224 // Legacy "flagsmask" field -- now ignored, remove when we bump version |
225 (void)buffer.readInt(); | 225 (void)buffer.readInt(); |
226 | 226 |
227 info.fPaintBits = buffer.readInt(); | 227 info.fPaintBits = buffer.readInt(); |
228 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); | 228 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); |
229 buffer.readPoint(&info.fOffset); | 229 buffer.readPoint(&info.fOffset); |
230 info.fPostTranslate = buffer.readBool(); | 230 info.fPostTranslate = buffer.readBool(); |
231 buffer.readPaint(builder.addLayerOnTop(info)); | 231 buffer.readPaint(builder.addLayerOnTop(info)); |
232 } | 232 } |
233 return builder.detachLooper(); | 233 return builder.detach().release(); |
234 } | 234 } |
235 | 235 |
236 #ifndef SK_IGNORE_TO_STRING | 236 #ifndef SK_IGNORE_TO_STRING |
237 void SkLayerDrawLooper::toString(SkString* str) const { | 237 void SkLayerDrawLooper::toString(SkString* str) const { |
238 str->appendf("SkLayerDrawLooper (%d): ", fCount); | 238 str->appendf("SkLayerDrawLooper (%d): ", fCount); |
239 | 239 |
240 Rec* rec = fRecs; | 240 Rec* rec = fRecs; |
241 for (int i = 0; i < fCount; i++) { | 241 for (int i = 0; i < fCount; i++) { |
242 str->appendf("%d: paintBits: (", i); | 242 str->appendf("%d: paintBits: (", i); |
243 if (0 == rec->fInfo.fPaintBits) { | 243 if (0 == rec->fInfo.fPaintBits) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 fRecs = rec; | 337 fRecs = rec; |
338 } else { | 338 } else { |
339 SkASSERT(fTopRec); | 339 SkASSERT(fTopRec); |
340 fTopRec->fNext = rec; | 340 fTopRec->fNext = rec; |
341 } | 341 } |
342 fTopRec = rec; | 342 fTopRec = rec; |
343 | 343 |
344 return &rec->fPaint; | 344 return &rec->fPaint; |
345 } | 345 } |
346 | 346 |
347 SkLayerDrawLooper* SkLayerDrawLooper::Builder::detachLooper() { | 347 sk_sp<SkDrawLooper> SkLayerDrawLooper::Builder::detach() { |
348 SkLayerDrawLooper* looper = new SkLayerDrawLooper; | 348 SkLayerDrawLooper* looper = new SkLayerDrawLooper; |
349 looper->fCount = fCount; | 349 looper->fCount = fCount; |
350 looper->fRecs = fRecs; | 350 looper->fRecs = fRecs; |
351 | 351 |
352 fCount = 0; | 352 fCount = 0; |
353 fRecs = nullptr; | 353 fRecs = nullptr; |
354 fTopRec = nullptr; | 354 fTopRec = nullptr; |
355 | 355 |
356 return looper; | 356 return sk_sp<SkDrawLooper>(looper); |
357 } | 357 } |
OLD | NEW |