From 3eaf0ecd7a4882482d6234f7a115d1b019c13339 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Thu, 15 Jul 2010 15:30:55 +0000 Subject: Windows: Fix opacity of drag images. BUG=XXX TEST=Go to google.com, drag logo around. Preview image should now look nice. Review URL: http://codereview.chromium.org/2963009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52484 0039d316-1c4b-4281-b951-d872f2087c98 --- gfx/skbitmap_operations_unittest.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gfx/skbitmap_operations_unittest.cc') diff --git a/gfx/skbitmap_operations_unittest.cc b/gfx/skbitmap_operations_unittest.cc index e99f594..83b732a0 100644 --- a/gfx/skbitmap_operations_unittest.cc +++ b/gfx/skbitmap_operations_unittest.cc @@ -471,3 +471,24 @@ TEST(SkBitmapOperationsTest, DownsampleByTwoUntilSize) { EXPECT_EQ(25, result.width()); EXPECT_EQ(11, result.height()); } + +TEST(SkBitmapOperationsTest, UnPreMultiply) { + SkBitmap input; + input.setConfig(SkBitmap::kARGB_8888_Config, 2, 2); + input.allocPixels(); + + *input.getAddr32(0, 0) = 0x80000000; + *input.getAddr32(1, 0) = 0x80808080; + *input.getAddr32(0, 1) = 0xFF00CC88; + *input.getAddr32(1, 1) = 0x0000CC88; + + SkBitmap result = SkBitmapOperations::UnPreMultiply(input); + EXPECT_EQ(2, result.width()); + 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". +} -- cgit v1.1