Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: tests/BitmapGetColorTest.cpp

Issue 17335008: remove dst/rendertarget support for kARGB_4444_Config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 10
11 static void TestGetColor(skiatest::Reporter* reporter) { 11 static void TestGetColor(skiatest::Reporter* reporter) {
12 static const struct Rec { 12 static const struct Rec {
13 SkBitmap::Config fConfig; 13 SkBitmap::Config fConfig;
14 SkColor fInColor; 14 SkColor fInColor;
15 SkColor fOutColor; 15 SkColor fOutColor;
16 } gRec[] = { 16 } gRec[] = {
17 // todo: add some tests that involve alpha, so we exercise the 17 // todo: add some tests that involve alpha, so we exercise the
18 // unpremultiply aspect of getColor() 18 // unpremultiply aspect of getColor()
19 { SkBitmap::kA8_Config, 0xFF000000, 0xFF000000 }, 19 { SkBitmap::kA8_Config, 0xFF000000, 0xFF000000 },
20 { SkBitmap::kA8_Config, 0, 0 }, 20 { SkBitmap::kA8_Config, 0, 0 },
21 { SkBitmap::kARGB_4444_Config, 0xFF224466, 0xFF224466 },
22 { SkBitmap::kARGB_4444_Config, 0, 0 },
23 { SkBitmap::kRGB_565_Config, 0xFF00FF00, 0xFF00FF00 }, 21 { SkBitmap::kRGB_565_Config, 0xFF00FF00, 0xFF00FF00 },
24 { SkBitmap::kRGB_565_Config, 0xFFFF00FF, 0xFFFF00FF }, 22 { SkBitmap::kRGB_565_Config, 0xFFFF00FF, 0xFFFF00FF },
25 { SkBitmap::kARGB_8888_Config, 0xFFFFFFFF, 0xFFFFFFFF }, 23 { SkBitmap::kARGB_8888_Config, 0xFFFFFFFF, 0xFFFFFFFF },
26 { SkBitmap::kARGB_8888_Config, 0, 0 }, 24 { SkBitmap::kARGB_8888_Config, 0, 0 },
27 { SkBitmap::kARGB_8888_Config, 0xFF224466, 0xFF224466 }, 25 { SkBitmap::kARGB_8888_Config, 0xFF224466, 0xFF224466 },
28 }; 26 };
29 27
30 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { 28 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
31 SkBitmap bm; 29 SkBitmap bm;
32 uint32_t storage[1]; 30 uint32_t storage[1];
33 bm.setConfig(gRec[i].fConfig, 1, 1); 31 bm.setConfig(gRec[i].fConfig, 1, 1);
34 bm.setPixels(storage); 32 bm.setPixels(storage);
35 bm.eraseColor(gRec[i].fInColor); 33 bm.eraseColor(gRec[i].fInColor);
36 34
37 SkColor c = bm.getColor(0, 0); 35 SkColor c = bm.getColor(0, 0);
38 REPORTER_ASSERT(reporter, c == gRec[i].fOutColor); 36 REPORTER_ASSERT(reporter, c == gRec[i].fOutColor);
39 } 37 }
40 } 38 }
41 39
42 #include "TestClassDef.h" 40 #include "TestClassDef.h"
43 DEFINE_TESTCLASS("GetColor", TestGetColorClass, TestGetColor) 41 DEFINE_TESTCLASS("GetColor", TestGetColorClass, TestGetColor)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698