| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <uxtheme.h> | 6 #include <uxtheme.h> |
| 7 #include <vsstyle.h> | 7 #include <vsstyle.h> |
| 8 #include <vssym32.h> | 8 #include <vssym32.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); | 174 canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); |
| 175 canvas.Restore(); | 175 canvas.Restore(); |
| 176 | 176 |
| 177 // ... then translate, clip and fill again relative to the new origin. | 177 // ... then translate, clip and fill again relative to the new origin. |
| 178 canvas.Save(); | 178 canvas.Save(); |
| 179 canvas.TranslateInt(150, 150); | 179 canvas.TranslateInt(150, 150); |
| 180 canvas.ClipRectInt(10, 10, 110, 110); | 180 canvas.ClipRectInt(10, 10, 110, 110); |
| 181 canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); | 181 canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); |
| 182 canvas.Restore(); | 182 canvas.Restore(); |
| 183 } | 183 } |
| 184 |
| 185 TEST(CanvasDirect2D, ClipRectWithScale) { |
| 186 TestWindow window; |
| 187 gfx::CanvasDirect2D canvas(window.rt()); |
| 188 |
| 189 // Repeat the same rendering as in ClipRect... |
| 190 canvas.Save(); |
| 191 canvas.FillRectInt(SK_ColorGREEN, 0, 0, 500, 500); |
| 192 canvas.ClipRectInt(20, 20, 120, 120); |
| 193 canvas.FillRectInt(SK_ColorBLUE, 0, 0, 500, 500); |
| 194 canvas.Restore(); |
| 195 |
| 196 // ... then translate and scale, clip and fill again relative to the new |
| 197 // origin. |
| 198 canvas.Save(); |
| 199 canvas.TranslateInt(150, 150); |
| 200 canvas.ScaleInt(2, 2); |
| 201 canvas.ClipRectInt(10, 10, 110, 110); |
| 202 canvas.FillRectInt(SK_ColorRED, 0, 0, 500, 500); |
| 203 canvas.Restore(); |
| 204 } |
| OLD | NEW |