| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasStateUtils.h" | 10 #include "SkCanvasStateUtils.h" |
| 11 #include "SkDrawFilter.h" | 11 #include "SkDrawFilter.h" |
| 12 #include "SkError.h" | 12 #include "SkError.h" |
| 13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
| 14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
| 15 #include "SkRect.h" | 15 #include "SkRect.h" |
| 16 #include "Test.h" | 16 #include "Test.h" |
| 17 | 17 |
| 18 static void test_complex_layers(skiatest::Reporter* reporter) { | 18 static void test_complex_layers(skiatest::Reporter* reporter) { |
| 19 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG | 19 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
| 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(SkIntToScalar(SPACER), SkIntToScalar(SPACER), | 24 SkRect rect = SkRect::MakeXYWH(SkIntToScalar(SPACER), SkIntToScalar(SPACER), |
| 25 SkIntToScalar(WIDTH-(2*SPACER)), | 25 SkIntToScalar(WIDTH-(2*SPACER)), |
| 26 SkIntToScalar((HEIGHT-(2*SPACER)) / 7)); | 26 SkIntToScalar((HEIGHT-(2*SPACER)) / 7)); |
| 27 | 27 |
| 28 const SkColorType colorTypes[] = { | 28 const SkColorType colorTypes[] = { |
| 29 kRGB_565_SkColorType, kPMColor_SkColorType | 29 kRGB_565_SkColorType, kN32_SkColorType |
| 30 }; | 30 }; |
| 31 const int configCount = sizeof(colorTypes) / sizeof(SkBitmap::Config); | 31 const int configCount = sizeof(colorTypes) / sizeof(SkBitmap::Config); |
| 32 | 32 |
| 33 const int layerAlpha[] = { 255, 255, 0 }; | 33 const int layerAlpha[] = { 255, 255, 0 }; |
| 34 const SkCanvas::SaveFlags flags[] = { SkCanvas::kARGB_NoClipLayer_SaveFlag, | 34 const SkCanvas::SaveFlags flags[] = { SkCanvas::kARGB_NoClipLayer_SaveFlag, |
| 35 SkCanvas::kARGB_ClipLayer_SaveFlag, | 35 SkCanvas::kARGB_ClipLayer_SaveFlag, |
| 36 SkCanvas::kARGB_NoClipLayer_SaveFlag | 36 SkCanvas::kARGB_NoClipLayer_SaveFlag |
| 37 }; | 37 }; |
| 38 REPORTER_ASSERT(reporter, sizeof(layerAlpha) == sizeof(flags)); | 38 REPORTER_ASSERT(reporter, sizeof(layerAlpha) == sizeof(flags)); |
| 39 const int layerCombinations = sizeof(layerAlpha) / sizeof(int); | 39 const int layerCombinations = sizeof(layerAlpha) / sizeof(int); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 #endif | 266 #endif |
| 267 } | 267 } |
| 268 | 268 |
| 269 DEF_TEST(CanvasState, reporter) { | 269 DEF_TEST(CanvasState, reporter) { |
| 270 test_complex_layers(reporter); | 270 test_complex_layers(reporter); |
| 271 test_complex_clips(reporter); | 271 test_complex_clips(reporter); |
| 272 test_draw_filters(reporter); | 272 test_draw_filters(reporter); |
| 273 test_soft_clips(reporter); | 273 test_soft_clips(reporter); |
| 274 test_saveLayer_clip(reporter); | 274 test_saveLayer_clip(reporter); |
| 275 } | 275 } |
| OLD | NEW |