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

Unified Diff: gfx/skbitmap_operations_unittest.cc

Issue 2963009: Windows: Fix opacity of drag images.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: merge Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gfx/skbitmap_operations.cc ('k') | views/drag_utils_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gfx/skbitmap_operations_unittest.cc
diff --git a/gfx/skbitmap_operations_unittest.cc b/gfx/skbitmap_operations_unittest.cc
index e99f594467f2bad6777b3d9d4b82f117fa468b3b..83b732a07223fd3365746e8fc638095de6e470a2 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".
+}
« no previous file with comments | « gfx/skbitmap_operations.cc ('k') | views/drag_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698