OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkLayerRasterizer.h" | 9 #include "SkLayerRasterizer.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) { | 138 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != nullptr) { |
139 drawMatrix = translatedMatrix; | 139 drawMatrix = translatedMatrix; |
140 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); | 140 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); |
141 draw.drawPath(path, rec->fPaint); | 141 draw.drawPath(path, rec->fPaint); |
142 } | 142 } |
143 } | 143 } |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 SkFlattenable* SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) { | 147 sk_sp<SkFlattenable> SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) { |
148 return new SkLayerRasterizer(ReadLayers(buffer)); | 148 return sk_sp<SkFlattenable>(new SkLayerRasterizer(ReadLayers(buffer))); |
149 } | 149 } |
150 | 150 |
151 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) { | 151 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) { |
152 int count = buffer.readInt(); | 152 int count = buffer.readInt(); |
153 | 153 |
154 SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec)); | 154 SkDeque* layers = new SkDeque(sizeof(SkLayerRasterizer_Rec)); |
155 for (int i = 0; i < count; i++) { | 155 for (int i = 0; i < count; i++) { |
156 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back()
; | 156 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back()
; |
157 | 157 |
158 new (&rec->fPaint) SkPaint; | 158 new (&rec->fPaint) SkPaint; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp
tr) { | 218 while ((recOrig = static_cast<SkLayerRasterizer_Rec*>(iter.next())) != nullp
tr) { |
219 SkDEBUGCODE(count++); | 219 SkDEBUGCODE(count++); |
220 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); | 220 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); |
221 new (&recCopy->fPaint) SkPaint(recOrig->fPaint); | 221 new (&recCopy->fPaint) SkPaint(recOrig->fPaint); |
222 recCopy->fOffset = recOrig->fOffset; | 222 recCopy->fOffset = recOrig->fOffset; |
223 } | 223 } |
224 SkASSERT(fLayers->count() == count); | 224 SkASSERT(fLayers->count() == count); |
225 SkASSERT(layers->count() == count); | 225 SkASSERT(layers->count() == count); |
226 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers)); | 226 return sk_sp<SkLayerRasterizer>(new SkLayerRasterizer(layers)); |
227 } | 227 } |
OLD | NEW |