diff options
Diffstat (limited to 'gfx/canvas_direct2d_unittest.cc')
-rw-r--r-- | gfx/canvas_direct2d_unittest.cc | 21 |
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(); +} |