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(); |
} |