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

Unified Diff: gm/canvasstate.cpp

Issue 23545017: Create a semi-stable API for capturing the state of an SkCanvas and reconstructing that state acros… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/utils.gyp » ('j') | include/utils/SkCanvasUtils.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/canvasstate.cpp
diff --git a/gm/canvasstate.cpp b/gm/canvasstate.cpp
index 5dc90ef2ae6a6c711f459fc3cbb72b99de31f0c2..50a897d05d5dc7d10d8360af4d76638d9e00995e 100644
--- a/gm/canvasstate.cpp
+++ b/gm/canvasstate.cpp
@@ -11,6 +11,8 @@
#include "SkPath.h"
#include "SkRect.h"
+#include "SkCanvasUtils.h"
djsollen 2013/08/28 15:45:12 need to move this inline with other includes.
+
namespace skiagm {
/*
@@ -155,9 +157,18 @@ private:
// draw a rect within the layer's bounds and again outside the layer's bounds
void drawTestPattern(SkCanvas* canvas, U8CPU layerAlpha, SkCanvas::SaveFlags flags) {
canvas->saveLayerAlpha(&fRect, layerAlpha, flags);
- canvas->drawRect(fRect, fBluePaint);
- canvas->translate(0, fRect.height() + 10);
- canvas->drawRect(fRect, fBluePaint);
+
+ SkCanvas* newCanvas = canvas;
djsollen 2013/08/28 15:45:12 need to add comment as to why we do this here.
mtklein 2013/08/28 18:20:46 Yeah, I'm confused. :) The name newCanvas makes m
+ SkCanvasState* state = SkCanvasUtils::CaptureCanvasState(canvas);
+ if (state) {
+ newCanvas = SkCanvasUtils::CreateFromCanvasState(state);
+ SkCanvasUtils::ReleaseCanvasState(state);
+ }
+
+ newCanvas->drawRect(fRect, fBluePaint);
scroggo 2013/08/28 17:22:01 I know this is just a test, so if it is testing wh
djsollen 2013/08/29 15:09:19 This was really just jammed in here and I'm convin
+ newCanvas->translate(0, fRect.height() + 10);
+ newCanvas->drawRect(fRect, fBluePaint);
+
canvas->restore();
}
« no previous file with comments | « no previous file | gyp/utils.gyp » ('j') | include/utils/SkCanvasUtils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698