Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: src/utils/SkCanvasStateUtils.cpp

Issue 2257203002: make LayerIter private, and remove skipClip option (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove dead comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 7
8 #include "SkCanvasStateUtils.h" 8 #include "SkCanvasStateUtils.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 /* 216 /*
217 * decompose the layers 217 * decompose the layers
218 * 218 *
219 * storage is allocated on the stack for the first 3 layers. It is common in 219 * storage is allocated on the stack for the first 3 layers. It is common in
220 * some view systems (e.g. Android) that a few non-clipped layers are presen t 220 * some view systems (e.g. Android) that a few non-clipped layers are presen t
221 * and we will not need to malloc any additional memory in those cases. 221 * and we will not need to malloc any additional memory in those cases.
222 */ 222 */
223 SkSWriter32<3*sizeof(SkCanvasLayerState)> layerWriter; 223 SkSWriter32<3*sizeof(SkCanvasLayerState)> layerWriter;
224 int layerCount = 0; 224 int layerCount = 0;
225 for (SkCanvas::LayerIter layer(canvas, true/*skipEmptyClips*/); !layer.done( ); layer.next()) { 225 for (SkCanvas::LayerIter layer(canvas); !layer.done(); layer.next()) {
226 226
227 // we currently only work for bitmap backed devices 227 // we currently only work for bitmap backed devices
228 SkPixmap pmap; 228 SkPixmap pmap;
229 if (!layer.device()->accessPixels(&pmap) || 0 == pmap.width() || 0 == pm ap.height()) { 229 if (!layer.device()->accessPixels(&pmap) || 0 == pmap.width() || 0 == pm ap.height()) {
230 return nullptr; 230 return nullptr;
231 } 231 }
232 232
233 SkCanvasLayerState* layerState = 233 SkCanvasLayerState* layerState =
234 (SkCanvasLayerState*) layerWriter.reserve(sizeof(SkCanvasLayerSt ate)); 234 (SkCanvasLayerState*) layerWriter.reserve(sizeof(SkCanvasLayerSt ate));
235 layerState->type = kRaster_CanvasBackend; 235 layerState->type = kRaster_CanvasBackend;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 //////////////////////////////////////////////////////////////////////////////// 347 ////////////////////////////////////////////////////////////////////////////////
348 348
349 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) { 349 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) {
350 SkASSERT(!state || SkCanvasState_v1::kVersion == state->version); 350 SkASSERT(!state || SkCanvasState_v1::kVersion == state->version);
351 // Upcast to the correct version of SkCanvasState. This avoids having a virt ual destructor on 351 // Upcast to the correct version of SkCanvasState. This avoids having a virt ual destructor on
352 // SkCanvasState. That would be strange since SkCanvasState has no other vir tual functions, and 352 // SkCanvasState. That would be strange since SkCanvasState has no other vir tual functions, and
353 // instead uses the field "version" to determine how to behave. 353 // instead uses the field "version" to determine how to behave.
354 delete static_cast<SkCanvasState_v1*>(state); 354 delete static_cast<SkCanvasState_v1*>(state);
355 } 355 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698