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 "TestClassDef.h" |
9 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
10 #include "SkRect.h" | 11 #include "SkRect.h" |
11 | 12 |
12 static const char* boolStr(bool value) { | 13 static const char* boolStr(bool value) { |
13 return value ? "true" : "false"; | 14 return value ? "true" : "false"; |
14 } | 15 } |
15 | 16 |
16 // these are in the same order as the SkBitmap::Config enum | 17 // these are in the same order as the SkBitmap::Config enum |
17 static const char* gConfigName[] = { | 18 static const char* gConfigName[] = { |
18 "None", "A8", "Index8", "565", "4444", "8888" | 19 "None", "A8", "Index8", "565", "4444", "8888" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 reporter->reportFailed(str); | 198 reporter->reportFailed(str); |
198 } | 199 } |
199 } | 200 } |
200 | 201 |
201 // Writes unique pixel values at locations specified by coords. | 202 // Writes unique pixel values at locations specified by coords. |
202 static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { | 203 static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { |
203 for (int i = 0; i < coords.length; ++i) | 204 for (int i = 0; i < coords.length; ++i) |
204 setPixel(coords[i]->fX, coords[i]->fY, i, bm); | 205 setPixel(coords[i]->fX, coords[i]->fY, i, bm); |
205 } | 206 } |
206 | 207 |
207 static void TestBitmapCopy(skiatest::Reporter* reporter) { | 208 DEF_TEST(BitmapCopy, reporter) { |
208 static const Pair gPairs[] = { | 209 static const Pair gPairs[] = { |
209 { SkBitmap::kNo_Config, "0000000" }, | 210 { SkBitmap::kNo_Config, "0000000" }, |
210 { SkBitmap::kA8_Config, "0101010" }, | 211 { SkBitmap::kA8_Config, "0101010" }, |
211 { SkBitmap::kIndex8_Config, "0111010" }, | 212 { SkBitmap::kIndex8_Config, "0111010" }, |
212 { SkBitmap::kRGB_565_Config, "0101010" }, | 213 { SkBitmap::kRGB_565_Config, "0101010" }, |
213 { SkBitmap::kARGB_4444_Config, "0101110" }, | 214 { SkBitmap::kARGB_4444_Config, "0101110" }, |
214 { SkBitmap::kARGB_8888_Config, "0101110" }, | 215 { SkBitmap::kARGB_8888_Config, "0101110" }, |
215 }; | 216 }; |
216 | 217 |
217 static const bool isExtracted[] = { | 218 static const bool isExtracted[] = { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // for the transfer. | 544 // for the transfer. |
544 REPORTER_ASSERT(reporter, | 545 REPORTER_ASSERT(reporter, |
545 subset.copyPixelsFrom(buf, 1, subset.rowBytes()) == | 546 subset.copyPixelsFrom(buf, 1, subset.rowBytes()) == |
546 false); | 547 false); |
547 | 548 |
548 #endif | 549 #endif |
549 } | 550 } |
550 } // for (size_t copyCase ... | 551 } // for (size_t copyCase ... |
551 } | 552 } |
552 } | 553 } |
553 | |
554 #include "TestClassDef.h" | |
555 DEFINE_TESTCLASS("BitmapCopy", TestBitmapCopyClass, TestBitmapCopy) | |
OLD | NEW |