OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkCanvasStateUtils.h" | 12 #include "SkCanvasStateUtils.h" |
13 #include "SkDrawFilter.h" | 13 #include "SkDrawFilter.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkRect.h" | 15 #include "SkRect.h" |
16 #include "SkRRect.h" | 16 #include "SkRRect.h" |
17 | 17 |
18 static void test_complex_layers(skiatest::Reporter* reporter) { | 18 static void test_complex_layers(skiatest::Reporter* reporter) { |
19 | 19 |
20 const int WIDTH = 400; | 20 const int WIDTH = 400; |
21 const int HEIGHT = 400; | 21 const int HEIGHT = 400; |
22 const int SPACER = 10; | 22 const int SPACER = 10; |
23 | 23 |
24 SkRect rect = SkRect::MakeXYWH(SPACER, SPACER, WIDTH-(2*SPACER), (HEIGHT-(2*
SPACER)) / 7); | 24 SkRect rect = SkRect::MakeXYWH(SkIntToScalar(SPACER), SkIntToScalar(SPACER), |
| 25 SkIntToScalar(WIDTH-(2*SPACER)), |
| 26 SkIntToScalar((HEIGHT-(2*SPACER)) / 7)); |
25 | 27 |
26 const SkBitmap::Config configs[] = { SkBitmap::kRGB_565_Config, | 28 const SkBitmap::Config configs[] = { SkBitmap::kRGB_565_Config, |
27 SkBitmap::kARGB_8888_Config | 29 SkBitmap::kARGB_8888_Config |
28 }; | 30 }; |
29 const int configCount = sizeof(configs) / sizeof(SkBitmap::Config); | 31 const int configCount = sizeof(configs) / sizeof(SkBitmap::Config); |
30 | 32 |
31 const int layerAlpha[] = { 255, 255, 0 }; | 33 const int layerAlpha[] = { 255, 255, 0 }; |
32 const SkCanvas::SaveFlags flags[] = { SkCanvas::kARGB_NoClipLayer_SaveFlag, | 34 const SkCanvas::SaveFlags flags[] = { SkCanvas::kARGB_NoClipLayer_SaveFlag, |
33 SkCanvas::kARGB_ClipLayer_SaveFlag, | 35 SkCanvas::kARGB_ClipLayer_SaveFlag, |
34 SkCanvas::kARGB_NoClipLayer_SaveFlag | 36 SkCanvas::kARGB_NoClipLayer_SaveFlag |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 //////////////////////////////////////////////////////////////////////////////// | 133 //////////////////////////////////////////////////////////////////////////////// |
132 | 134 |
133 static void test_canvas_state_utils(skiatest::Reporter* reporter) { | 135 static void test_canvas_state_utils(skiatest::Reporter* reporter) { |
134 test_complex_layers(reporter); | 136 test_complex_layers(reporter); |
135 test_draw_filters(reporter); | 137 test_draw_filters(reporter); |
136 test_soft_clips(reporter); | 138 test_soft_clips(reporter); |
137 } | 139 } |
138 | 140 |
139 #include "TestClassDef.h" | 141 #include "TestClassDef.h" |
140 DEFINE_TESTCLASS("CanvasState", TestCanvasStateClass, test_canvas_state_utils) | 142 DEFINE_TESTCLASS("CanvasState", TestCanvasStateClass, test_canvas_state_utils) |
OLD | NEW |