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

Unified Diff: gfx/canvas_direct2d_unittest.cc

Issue 2959014: Implement initial ClipRect.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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 | « gfx/canvas_direct2d.cc ('k') | gfx/canvas_skia.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gfx/canvas_direct2d_unittest.cc
===================================================================
--- gfx/canvas_direct2d_unittest.cc (revision 53197)
+++ gfx/canvas_direct2d_unittest.cc (working copy)
@@ -154,3 +154,30 @@
canvas.EndPlatformPaint();
}
+TEST(CanvasDirect2D, ClipRect) {
+ TestWindow window;
+ gfx::CanvasDirect2D canvas(window.rt());
+
+ canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500);
+ canvas.ClipRectInt(20, 20, 120, 120);
+ canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500);
+}
+
+TEST(CanvasDirect2D, ClipRectWithTranslate) {
+ TestWindow window;
+ gfx::CanvasDirect2D canvas(window.rt());
+
+ // Repeat the same rendering as in ClipRect...
+ canvas.Save();
+ canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500);
+ canvas.ClipRectInt(20, 20, 120, 120);
+ canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500);
+ canvas.Restore();
+
+ // ... then translate, clip and fill again relative to the new origin.
+ canvas.Save();
+ canvas.TranslateInt(150, 150);
+ canvas.ClipRectInt(10, 10, 110, 110);
+ canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500);
+ canvas.Restore();
+}
« no previous file with comments | « gfx/canvas_direct2d.cc ('k') | gfx/canvas_skia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698