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

Side by Side 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: fixing nits 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | gyp/tests.gyp » ('j') | tests/CanvasStateTest.cpp » ('J')
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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 typedef GM INHERITED; 107 typedef GM INHERITED;
108 }; 108 };
109 109
110 ////////////////////////////////////////////////////////////////////////////// 110 //////////////////////////////////////////////////////////////////////////////
111 111
112 class CanvasLayerStateGM : public GM { 112 class CanvasLayerStateGM : public GM {
113 public: 113 public:
114 CanvasLayerStateGM() { 114 CanvasLayerStateGM() {
115 fRedPaint.setColor(SK_ColorRED);
116 fRedPaint.setStyle(SkPaint::kFill_Style);
117
118 fBluePaint.setColor(SK_ColorBLUE); 115 fBluePaint.setColor(SK_ColorBLUE);
119 fBluePaint.setStyle(SkPaint::kFill_Style); 116 fBluePaint.setStyle(SkPaint::kFill_Style);
120 117
121 fRect = SkRect::MakeXYWH(SPACER, SPACER, WIDTH-(2*SPACER), (HEIGHT-(2*SP ACER)) / 7); 118 fRect = SkRect::MakeXYWH(SPACER, SPACER, WIDTH-(2*SPACER), (HEIGHT-(2*SP ACER)) / 7);
122 } 119 }
123 120
124 protected: 121 protected:
125 virtual SkString onShortName() SK_OVERRIDE { 122 virtual SkString onShortName() SK_OVERRIDE {
126 return SkString("canvas-layer-state"); 123 return SkString("canvas-layer-state");
127 } 124 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 canvas->drawRect(fRect, fBluePaint); 157 canvas->drawRect(fRect, fBluePaint);
161 canvas->restore(); 158 canvas->restore();
162 } 159 }
163 160
164 enum { 161 enum {
165 WIDTH = 400, 162 WIDTH = 400,
166 HEIGHT = 400, 163 HEIGHT = 400,
167 SPACER = 10, 164 SPACER = 10,
168 }; 165 };
169 166
170 SkPaint fRedPaint;
171 SkPaint fBluePaint; 167 SkPaint fBluePaint;
172 SkRect fRect; 168 SkRect fRect;
173 169
174 typedef GM INHERITED; 170 typedef GM INHERITED;
175 }; 171 };
176 172
177 ////////////////////////////////////////////////////////////////////////////// 173 //////////////////////////////////////////////////////////////////////////////
178 174
179 DEF_GM( return SkNEW(CanvasStateGM); ) 175 DEF_GM( return SkNEW(CanvasStateGM); )
180 DEF_GM( return SkNEW(CanvasLayerStateGM); ) 176 DEF_GM( return SkNEW(CanvasLayerStateGM); )
181 177
182 } // end namespace 178 } // end namespace
OLDNEW
« no previous file with comments | « no previous file | gyp/tests.gyp » ('j') | tests/CanvasStateTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698