Chromium Code Reviews| Index: ui/gfx/skbitmap_operations_unittest.cc |
| diff --git a/ui/gfx/skbitmap_operations_unittest.cc b/ui/gfx/skbitmap_operations_unittest.cc |
| index f5c89f86fde3c8ee0a86b334490c3158002392d0..b13ce8132ecb58a55e349bd000125b25a187740a 100644 |
| --- a/ui/gfx/skbitmap_operations_unittest.cc |
| +++ b/ui/gfx/skbitmap_operations_unittest.cc |
| @@ -20,6 +20,11 @@ inline bool ColorsClose(uint32_t a, uint32_t b) { |
| abs(static_cast<int>(SkColorGetA(a) - SkColorGetA(b))) <= 2; |
| } |
| +inline uint32_t SetPackedColor(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { |
|
sky
2012/08/02 21:02:00
Same comment as other file.
|
| + return (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) | |
| + (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT); |
| +} |
| + |
| inline bool MultipliedColorsClose(uint32_t a, uint32_t b) { |
| return ColorsClose(SkUnPreMultiply::PMColorToColor(a), |
| SkUnPreMultiply::PMColorToColor(b)); |
| @@ -274,7 +279,7 @@ TEST(SkBitmapOperationsTest, CreateHSLShiftedBitmapHueOnly) { |
| for (int y = 0, i = 0; y < src_h; y++) { |
| for (int x = 0; x < src_w; x++) { |
| EXPECT_TRUE(ColorsClose(*shifted.getAddr32(x, y), |
| - SkColorSetARGB(255, i % 255, 0, 0))); |
| + SetPackedColor(255, i % 255, 0, 0))); |
| i++; |
| } |
| } |
| @@ -487,10 +492,11 @@ TEST(SkBitmapOperationsTest, UnPreMultiply) { |
| EXPECT_EQ(2, result.height()); |
| SkAutoLockPixels lock(result); |
| - EXPECT_EQ(0x80000000, *result.getAddr32(0, 0)); |
| - EXPECT_EQ(0x80FFFFFF, *result.getAddr32(1, 0)); |
| - EXPECT_EQ(0xFF00CC88, *result.getAddr32(0, 1)); |
| - EXPECT_EQ(0x00000000u, *result.getAddr32(1, 1)); // "Division by zero". |
| + EXPECT_EQ(SetPackedColor(0x80, 0x00, 0x00, 0x00), *result.getAddr32(0, 0)); |
| + EXPECT_EQ(SetPackedColor(0x80, 0xFF, 0xFF, 0xFF), *result.getAddr32(1, 0)); |
| + EXPECT_EQ(SetPackedColor(0xFF, 0x00, 0xCC, 0x88), *result.getAddr32(0, 1)); |
| + // "Division by zero". |
| + EXPECT_EQ(SetPackedColor(0x00, 0x00, 0x00, 0x00), *result.getAddr32(1, 1)); |
| } |
| TEST(SkBitmapOperationsTest, CreateTransposedBitmap) { |