diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-14 20:39:48 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-06-14 20:39:48 +0000 |
commit | daaea2d51f145fd43221a2b923721b218c8ff777 (patch) | |
tree | 11bfda86a65bca7dac4a91f75afbb80cd4bc12a5 /tests | |
parent | ae72f470e0f88a44b7bda91079c8388e563c1cfc (diff) |
Fixes for unpremul decode.
SkImageDecoder_CG.cpp:
If a non opaque bitmap was decoded, and the caller wants
unpremultiplied, unpremultiply the colors.
Always use the RGB colorspace, since the other colorspaces
do not match the desired bitmap format.
ImageDecodingTest:
Allow for a difference of 1 in each color component when comparing
the result of premultiplying the unpremultiplied decode with the
premultiplied decode, since I found an image (in WEBP format) where
the unpremultiplied colors did not compare perfectly in my comparison.
R=reed@google.com
Review URL: https://codereview.chromium.org/17084012
git-svn-id: http://skia.googlecode.com/svn/trunk@9628 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ImageDecodingTest.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index f30a0b25b7..9a5d45bcfa 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -123,12 +123,11 @@ static void compare_unpremul(skiatest::Reporter* reporter, const SkString& filen // Alpha component must be exactly the same. REPORTER_ASSERT(reporter, 0 == da); - // Other components may differ if rounding is done differently, - // but currently that is not the case. If an image fails here - // in the future, we can change these to account for differences. - REPORTER_ASSERT(reporter, 0 == dr); - REPORTER_ASSERT(reporter, 0 == dg); - REPORTER_ASSERT(reporter, 0 == db); + + // Color components may not match exactly due to rounding error. + REPORTER_ASSERT(reporter, dr <= 1); + REPORTER_ASSERT(reporter, dg <= 1); + REPORTER_ASSERT(reporter, db <= 1); } } } |