OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 mat.setScale(tinyScale, tinyScale); | 95 mat.setScale(tinyScale, tinyScale); |
96 REPORTER_ASSERT(reporter, treat_as_sprite(mat, size, false)); | 96 REPORTER_ASSERT(reporter, treat_as_sprite(mat, size, false)); |
97 REPORTER_ASSERT(reporter, treat_as_sprite(mat, size, bilerBits)); | 97 REPORTER_ASSERT(reporter, treat_as_sprite(mat, size, bilerBits)); |
98 } | 98 } |
99 | 99 |
100 static void assert_ifDrawnTo(skiatest::Reporter* reporter, | 100 static void assert_ifDrawnTo(skiatest::Reporter* reporter, |
101 const SkBitmap& bm, bool shouldBeDrawn) { | 101 const SkBitmap& bm, bool shouldBeDrawn) { |
102 for (int y = 0; y < bm.height(); ++y) { | 102 for (int y = 0; y < bm.height(); ++y) { |
103 for (int x = 0; x < bm.width(); ++x) { | 103 for (int x = 0; x < bm.width(); ++x) { |
104 if (shouldBeDrawn) { | 104 if (shouldBeDrawn) { |
105 if (0 == *bm.getAddr32(x, y)) { | 105 if (SK_ColorTRANSPARENT == *bm.getAddr32(x, y)) { |
106 REPORTER_ASSERT(reporter, false); | 106 REPORTER_ASSERT(reporter, false); |
107 return; | 107 return; |
108 } | 108 } |
109 } else { | 109 } else { |
110 // should not be drawn | 110 // should not be drawn |
111 if (*bm.getAddr32(x, y)) { | 111 if (SK_ColorTRANSPARENT != *bm.getAddr32(x, y)) { |
112 REPORTER_ASSERT(reporter, false); | 112 REPORTER_ASSERT(reporter, false); |
113 return; | 113 return; |
114 } | 114 } |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
119 | 119 |
120 static void test_wacky_bitmapshader(skiatest::Reporter* reporter, | 120 static void test_wacky_bitmapshader(skiatest::Reporter* reporter, |
121 int width, int height, bool shouldBeDrawn) { | 121 int width, int height, bool shouldBeDrawn) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); | 265 REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); |
266 | 266 |
267 test_nan_antihair(); | 267 test_nan_antihair(); |
268 test_giantrepeat_crbug118018(reporter); | 268 test_giantrepeat_crbug118018(reporter); |
269 | 269 |
270 test_treatAsSprite(reporter); | 270 test_treatAsSprite(reporter); |
271 } | 271 } |
272 | 272 |
273 #include "TestClassDef.h" | 273 #include "TestClassDef.h" |
274 DEFINE_TESTCLASS("DrawBitmapRect", TestDrawBitmapRectClass, TestDrawBitmapRect) | 274 DEFINE_TESTCLASS("DrawBitmapRect", TestDrawBitmapRectClass, TestDrawBitmapRect) |
OLD | NEW |