OLD | NEW |
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_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
11 #else | 11 #else |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 #endif | 13 #endif |
14 | 14 |
15 #include "skia/ext/platform_canvas.h" | 15 #include "skia/ext/platform_canvas.h" |
16 #include "skia/ext/platform_device.h" | 16 #include "skia/ext/platform_device.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 #include "SkColor.h" | 19 #include "SkColor.h" |
20 | 20 |
21 namespace gfx { | 21 namespace skia { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Return true if the canvas is filled to canvas_color, | 25 // Return true if the canvas is filled to canvas_color, |
26 // and contains a single rectangle filled to rect_color. | 26 // and contains a single rectangle filled to rect_color. |
27 bool VerifyRect(const PlatformCanvas& canvas, | 27 bool VerifyRect(const PlatformCanvas& canvas, |
28 uint32_t canvas_color, uint32_t rect_color, | 28 uint32_t canvas_color, uint32_t rect_color, |
29 int x, int y, int w, int h) { | 29 int x, int y, int w, int h) { |
30 PlatformDevice& device = canvas.getTopPlatformDevice(); | 30 PlatformDevice& device = canvas.getTopPlatformDevice(); |
31 const SkBitmap& bitmap = device.accessBitmap(false); | 31 const SkBitmap& bitmap = device.accessBitmap(false); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 LayerSaver layer(canvas, kLayerX, kLayerY, kLayerW, kLayerH); | 285 LayerSaver layer(canvas, kLayerX, kLayerY, kLayerW, kLayerH); |
286 canvas.translate(1, 1); | 286 canvas.translate(1, 1); |
287 AddClip(canvas, kInnerX, kInnerY, kInnerW, kInnerH); | 287 AddClip(canvas, kInnerX, kInnerY, kInnerW, kInnerH); |
288 DrawNativeRect(canvas, 0, 0, 100, 100); | 288 DrawNativeRect(canvas, 0, 0, 100, 100); |
289 } | 289 } |
290 canvas.restore(); | 290 canvas.restore(); |
291 EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 2, kInnerY + 2, | 291 EXPECT_TRUE(VerifyBlackSquare(canvas, kInnerX + 2, kInnerY + 2, |
292 kInnerW, kInnerH)); | 292 kInnerW, kInnerH)); |
293 } | 293 } |
294 | 294 |
295 } // namespace | 295 } // namespace skia |
296 | 296 |
OLD | NEW |