OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkRandom.h" | |
11 #include "SkRect.h" | 10 #include "SkRect.h" |
12 #include "Test.h" | 11 #include "Test.h" |
13 | 12 |
14 static bool has_green_pixels(const SkBitmap& bm) { | 13 static bool has_green_pixels(const SkBitmap& bm) { |
15 for (int j = 0; j < bm.height(); ++j) { | 14 for (int j = 0; j < bm.height(); ++j) { |
16 for (int i = 0; i < bm.width(); ++i) { | 15 for (int i = 0; i < bm.width(); ++i) { |
17 if (SkColorGetG(bm.getColor(i, j))) { | 16 if (SkColorGetG(bm.getColor(i, j))) { |
18 return true; | 17 return true; |
19 } | 18 } |
20 } | 19 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 SkScalarRoundToInt(src.fRight), | 113 SkScalarRoundToInt(src.fRight), |
115 SkScalarRoundToInt(src.fBottom) | 114 SkScalarRoundToInt(src.fBottom) |
116 }; | 115 }; |
117 SkIRect ir1 = src.round(); | 116 SkIRect ir1 = src.round(); |
118 SkIRect ir2 = src.round2i(); | 117 SkIRect ir2 = src.round2i(); |
119 | 118 |
120 REPORTER_ASSERT(reporter, ir0 == ir1); | 119 REPORTER_ASSERT(reporter, ir0 == ir1); |
121 REPORTER_ASSERT(reporter, ir0 == ir2); | 120 REPORTER_ASSERT(reporter, ir0 == ir2); |
122 } | 121 } |
123 } | 122 } |
OLD | NEW |