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

Side by Side Diff: skia/ext/platform_canvas_unittest.cc

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address comments. Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(awalker): clean up the const/non-const reference handling in this test 5 // TODO(awalker): clean up the const/non-const reference handling in this test
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #import <ApplicationServices/ApplicationServices.h> 10 #import <ApplicationServices/ApplicationServices.h>
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 LayerSaver(PlatformCanvas& canvas, int x, int y, int w, int h) 145 LayerSaver(PlatformCanvas& canvas, int x, int y, int w, int h)
146 : canvas_(canvas), 146 : canvas_(canvas),
147 x_(x), 147 x_(x),
148 y_(y), 148 y_(y),
149 w_(w), 149 w_(w),
150 h_(h) { 150 h_(h) {
151 SkRect bounds; 151 SkRect bounds;
152 bounds.set(SkIntToScalar(x_), SkIntToScalar(y_), 152 bounds.set(SkIntToScalar(x_), SkIntToScalar(y_),
153 SkIntToScalar(right()), SkIntToScalar(bottom())); 153 SkIntToScalar(right()), SkIntToScalar(bottom()));
154 canvas_.saveLayer(&bounds, NULL); 154 canvas_.saveLayer(&bounds, NULL);
155 canvas.clear(SkColorSetARGB(0, 0, 0, 0));
155 } 156 }
156 157
157 ~LayerSaver() { 158 ~LayerSaver() {
158 canvas_.restore(); 159 canvas_.restore();
159 } 160 }
160 161
161 int x() const { return x_; } 162 int x() const { return x_; }
162 int y() const { return y_; } 163 int y() const { return y_; }
163 int w() const { return w_; } 164 int w() const { return w_; }
164 int h() const { return h_; } 165 int h() const { return h_; }
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 MakeOpaque(&canvas, kLayerX, kLayerY, kLayerW, kLayerH); 381 MakeOpaque(&canvas, kLayerX, kLayerY, kLayerW, kLayerH);
381 #endif 382 #endif
382 } 383 }
383 canvas.restore(); 384 canvas.restore();
384 EXPECT_TRUE(VerifyRoundedRect(canvas, SK_ColorWHITE, SK_ColorBLACK, 385 EXPECT_TRUE(VerifyRoundedRect(canvas, SK_ColorWHITE, SK_ColorBLACK,
385 kInnerX + 1, kInnerY + 1, kInnerW, kInnerH)); 386 kInnerX + 1, kInnerY + 1, kInnerW, kInnerH));
386 #endif 387 #endif
387 } 388 }
388 389
389 } // namespace skia 390 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/data/vectorcanvastest/uninitialized/00_vc_empty.png ('k') | skia/ext/platform_canvas_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698