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 #include "SkCanvas.h" | 7 #include "SkCanvas.h" |
8 #include "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 buffer.writeInt(rec->fInfo.fPaintBits); | 208 buffer.writeInt(rec->fInfo.fPaintBits); |
209 buffer.writeInt(rec->fInfo.fColorMode); | 209 buffer.writeInt(rec->fInfo.fColorMode); |
210 buffer.writePoint(rec->fInfo.fOffset); | 210 buffer.writePoint(rec->fInfo.fOffset); |
211 buffer.writeBool(rec->fInfo.fPostTranslate); | 211 buffer.writeBool(rec->fInfo.fPostTranslate); |
212 buffer.writePaint(rec->fPaint); | 212 buffer.writePaint(rec->fPaint); |
213 rec = rec->fNext; | 213 rec = rec->fNext; |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 SkFlattenable* SkLayerDrawLooper::CreateProc(SkReadBuffer& buffer) { | 217 sk_sp<SkFlattenable> SkLayerDrawLooper::CreateProc(SkReadBuffer& buffer) { |
218 int count = buffer.readInt(); | 218 int count = buffer.readInt(); |
219 | 219 |
220 Builder builder; | 220 Builder builder; |
221 for (int i = 0; i < count; i++) { | 221 for (int i = 0; i < count; i++) { |
222 LayerInfo info; | 222 LayerInfo info; |
223 // Legacy "flagsmask" field -- now ignored, remove when we bump version | 223 // Legacy "flagsmask" field -- now ignored, remove when we bump version |
224 (void)buffer.readInt(); | 224 (void)buffer.readInt(); |
225 | 225 |
226 info.fPaintBits = buffer.readInt(); | 226 info.fPaintBits = buffer.readInt(); |
227 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); | 227 info.fColorMode = (SkXfermode::Mode)buffer.readInt(); |
228 buffer.readPoint(&info.fOffset); | 228 buffer.readPoint(&info.fOffset); |
229 info.fPostTranslate = buffer.readBool(); | 229 info.fPostTranslate = buffer.readBool(); |
230 buffer.readPaint(builder.addLayerOnTop(info)); | 230 buffer.readPaint(builder.addLayerOnTop(info)); |
231 } | 231 } |
232 return builder.detach().release(); | 232 return builder.detach(); |
233 } | 233 } |
234 | 234 |
235 #ifndef SK_IGNORE_TO_STRING | 235 #ifndef SK_IGNORE_TO_STRING |
236 void SkLayerDrawLooper::toString(SkString* str) const { | 236 void SkLayerDrawLooper::toString(SkString* str) const { |
237 str->appendf("SkLayerDrawLooper (%d): ", fCount); | 237 str->appendf("SkLayerDrawLooper (%d): ", fCount); |
238 | 238 |
239 Rec* rec = fRecs; | 239 Rec* rec = fRecs; |
240 for (int i = 0; i < fCount; i++) { | 240 for (int i = 0; i < fCount; i++) { |
241 str->appendf("%d: paintBits: (", i); | 241 str->appendf("%d: paintBits: (", i); |
242 if (0 == rec->fInfo.fPaintBits) { | 242 if (0 == rec->fInfo.fPaintBits) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 SkLayerDrawLooper* looper = new SkLayerDrawLooper; | 347 SkLayerDrawLooper* looper = new SkLayerDrawLooper; |
348 looper->fCount = fCount; | 348 looper->fCount = fCount; |
349 looper->fRecs = fRecs; | 349 looper->fRecs = fRecs; |
350 | 350 |
351 fCount = 0; | 351 fCount = 0; |
352 fRecs = nullptr; | 352 fRecs = nullptr; |
353 fTopRec = nullptr; | 353 fTopRec = nullptr; |
354 | 354 |
355 return sk_sp<SkDrawLooper>(looper); | 355 return sk_sp<SkDrawLooper>(looper); |
356 } | 356 } |
OLD | NEW |