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

Unified Diff: src/utils/SkCanvasStateUtils.cpp

Issue 23865004: Add SkCanvasStack and update the Canvas utilities to use it. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: comments Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: src/utils/SkCanvasStateUtils.cpp
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index c4232c2f5be2d23d75b20d4961bb4d6cf1ff0571..cd79a44f5032276bdf22324855fc719b88caeb4d 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -9,7 +9,7 @@
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
-#include "SkNWayCanvas.h"
+#include "SkCanvasStack.h"
#include "SkWriter32.h"
#define CANVAS_STATE_VERSION 1
@@ -316,18 +316,19 @@ SkCanvas* SkCanvasStateUtils::CreateFromCanvasState(const SkCanvasState* state)
return NULL;
}
- SkAutoTUnref<SkNWayCanvas> canvas(SkNEW_ARGS(SkNWayCanvas, (state->width, state->height)));
+ SkAutoTUnref<SkCanvasStack> canvas(SkNEW_ARGS(SkCanvasStack, (state->width, state->height)));
// setup the matrix and clip on the n-way canvas
setup_canvas_from_MC_state(state->mcState, canvas);
// Iterate over the layers and add them to the n-way canvas
- for (int i = 0; i < state->layerCount; ++i) {
+ for (int i = state->layerCount - 1; i >= 0; --i) {
SkAutoTUnref<SkCanvas> canvasLayer(create_canvas_from_canvas_layer(state->layers[i]));
if (!canvasLayer.get()) {
return NULL;
}
- canvas->addCanvas(canvasLayer.get());
+ canvas->pushCanvas(canvasLayer.get(), SkIPoint::Make(state->layers[i].x,
+ state->layers[i].y));
}
return canvas.detach();

Powered by Google App Engine
This is Rietveld 408576698