summaryrefslogtreecommitdiffstats
path: root/gfx/canvas_direct2d_unittest.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:48:32 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:48:32 +0000
commit0539e6bcb121262b0baebf63628b8968bf893a6d (patch)
treeb579cfe529410604b7b3faadc4390deac02c02df /gfx/canvas_direct2d_unittest.cc
parent1f18184a07252103a8cd9652d64de749f41ef09f (diff)
downloadchromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.zip
chromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.tar.gz
chromium_src-0539e6bcb121262b0baebf63628b8968bf893a6d.tar.bz2
Fix transforms to be preconcat like skia so multiple transforms are accumulated with each call to TranslateInt/ScaleInt.
BUG=none TEST=see unittest Review URL: http://codereview.chromium.org/3025010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx/canvas_direct2d_unittest.cc')
-rw-r--r--gfx/canvas_direct2d_unittest.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/gfx/canvas_direct2d_unittest.cc b/gfx/canvas_direct2d_unittest.cc
index 7e2c734..541e3f0 100644
--- a/gfx/canvas_direct2d_unittest.cc
+++ b/gfx/canvas_direct2d_unittest.cc
@@ -181,3 +181,24 @@ TEST(CanvasDirect2D, ClipRectWithTranslate) {
canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500);
canvas.Restore();
}
+
+TEST(CanvasDirect2D, ClipRectWithScale) {
+ 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 and scale, clip and fill again relative to the new
+ // origin.
+ canvas.Save();
+ canvas.TranslateInt(150, 150);
+ canvas.ScaleInt(2, 2);
+ canvas.ClipRectInt(10, 10, 110, 110);
+ canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500);
+ canvas.Restore();
+}