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
diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp
index f30a0b2..9a5d45b 100644
--- a/tests/ImageDecodingTest.cpp
+++ b/tests/ImageDecodingTest.cpp
@@ -123,12 +123,11 @@
 
             // 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);
         }
     }
 }