summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 16:40:08 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-24 16:40:08 +0000
commit9f9c5296b022dc280cd38ff418f5177cf71856d6 (patch)
treeed04612bdbcdb6730598b6628e2755aba7275525 /chrome/browser
parent52856c37b4d928a593a7fbdbb8171c5197795488 (diff)
downloadchromium_src-9f9c5296b022dc280cd38ff418f5177cf71856d6.zip
chromium_src-9f9c5296b022dc280cd38ff418f5177cf71856d6.tar.gz
chromium_src-9f9c5296b022dc280cd38ff418f5177cf71856d6.tar.bz2
PNGDecoder wasn't multiplying the alpha like PNGEncoder was. This lead to color
overflow. This intermediate fix makes everything correct, but will make alphaed pixels slightly darker until the user's cache is flushed (I have screenshots of the effect). BUG=13360 TEST=none Review URL: http://codereview.chromium.org/147049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc
index 5076fc2..a2ac50d 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -641,8 +641,16 @@ TEST_F(WebDatabaseTest, WebAppImages) {
image.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
image.allocPixels();
image.eraseColor(SK_ColorBLACK);
- // Some random pixels so that we can identify the image.
- *(reinterpret_cast<unsigned char*>(image.getPixels())) = 0xAB;
+
+ // Set some random pixels so that we can identify the image. We don't use
+ // transparent images because of pre-multiplication rounding errors.
+ SkColor test_pixel_1 = 0xffccbbaa;
+ SkColor test_pixel_2 = 0x00aabbaa;
+ SkColor test_pixel_3 = 0xff339966;
+ image.getAddr32(0, 1)[0] = test_pixel_1;
+ image.getAddr32(0, 1)[1] = test_pixel_2;
+ image.getAddr32(0, 1)[2] = test_pixel_3;
+
ASSERT_TRUE(db.SetWebAppImage(url, image));
images.clear();
ASSERT_TRUE(db.GetWebAppImages(url, &images));
@@ -650,10 +658,10 @@ TEST_F(WebDatabaseTest, WebAppImages) {
ASSERT_EQ(16, images[0].width());
ASSERT_EQ(16, images[0].height());
images[0].lockPixels();
- unsigned char* pixels =
- reinterpret_cast<unsigned char*>(images[0].getPixels());
- ASSERT_TRUE(pixels != NULL);
- ASSERT_EQ(0xAB, *pixels);
+ ASSERT_TRUE(images[0].getPixels() != NULL);
+ ASSERT_EQ(test_pixel_1, images[0].getAddr32(0, 1)[0]);
+ ASSERT_EQ(test_pixel_2, images[0].getAddr32(0, 1)[1]);
+ ASSERT_EQ(test_pixel_3, images[0].getAddr32(0, 1)[2]);
images[0].unlockPixels();
// Add another image at a bigger size.