OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 | 9 |
10 #include "SkLayerRasterizer.h" | 10 #include "SkLayerRasterizer.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { | 142 while ((rec = (SkLayerRasterizer_Rec*)iter.next()) != NULL) { |
143 drawMatrix = translatedMatrix; | 143 drawMatrix = translatedMatrix; |
144 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); | 144 drawMatrix.preTranslate(rec->fOffset.fX, rec->fOffset.fY); |
145 draw.drawPath(path, rec->fPaint); | 145 draw.drawPath(path, rec->fPaint); |
146 } | 146 } |
147 } | 147 } |
148 return true; | 148 return true; |
149 } | 149 } |
150 | 150 |
151 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
152 SkLayerRasterizer::SkLayerRasterizer(SkReadBuffer& buffer) | |
153 : SkRasterizer(buffer), fLayers(ReadLayers(buffer)) {} | |
154 #endif | |
155 | |
156 SkFlattenable* SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) { | 151 SkFlattenable* SkLayerRasterizer::CreateProc(SkReadBuffer& buffer) { |
157 return SkNEW_ARGS(SkLayerRasterizer, (ReadLayers(buffer))); | 152 return SkNEW_ARGS(SkLayerRasterizer, (ReadLayers(buffer))); |
158 } | 153 } |
159 | 154 |
160 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) { | 155 SkDeque* SkLayerRasterizer::ReadLayers(SkReadBuffer& buffer) { |
161 int count = buffer.readInt(); | 156 int count = buffer.readInt(); |
162 | 157 |
163 SkDeque* layers = SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec))); | 158 SkDeque* layers = SkNEW_ARGS(SkDeque, (sizeof(SkLayerRasterizer_Rec))); |
164 for (int i = 0; i < count; i++) { | 159 for (int i = 0; i < count; i++) { |
165 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back()
; | 160 SkLayerRasterizer_Rec* rec = (SkLayerRasterizer_Rec*)layers->push_back()
; |
166 | 161 |
167 SkNEW_PLACEMENT(&rec->fPaint, SkPaint); | 162 SkNEW_PLACEMENT(&rec->fPaint, SkPaint); |
168 buffer.readPaint(&rec->fPaint); | 163 buffer.readPaint(&rec->fPaint); |
169 buffer.readPoint(&rec->fOffset); | 164 buffer.readPoint(&rec->fOffset); |
170 } | 165 } |
171 return layers; | 166 return layers; |
172 } | 167 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 SkDEBUGCODE(count++); | 226 SkDEBUGCODE(count++); |
232 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); | 227 SkLayerRasterizer_Rec* recCopy = static_cast<SkLayerRasterizer_Rec*>(lay
ers->push_back()); |
233 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); | 228 SkNEW_PLACEMENT_ARGS(&recCopy->fPaint, SkPaint, (recOrig->fPaint)); |
234 recCopy->fOffset = recOrig->fOffset; | 229 recCopy->fOffset = recOrig->fOffset; |
235 } | 230 } |
236 SkASSERT(fLayers->count() == count); | 231 SkASSERT(fLayers->count() == count); |
237 SkASSERT(layers->count() == count); | 232 SkASSERT(layers->count() == count); |
238 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); | 233 SkLayerRasterizer* rasterizer = SkNEW_ARGS(SkLayerRasterizer, (layers)); |
239 return rasterizer; | 234 return rasterizer; |
240 } | 235 } |
OLD | NEW |