SkImage_Generator::onMakeColorSpace avoid 565
authorMatt Sarett <msarett@google.com>
Fri, 24 Mar 2017 20:35:22 +0000 (16:35 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 28 Mar 2017 13:08:50 +0000 (13:08 +0000)
I forgot that if a png has the significant bit
chunk set to R=5, G=6, B=5, we will recommend
a decode to 565.

We need to avoid this.  The codec does not
support color correct 565.

BUG=skia:

Change-Id: Ieb74bfaf100504d9748e4b8014a8a4e425428c7a
Reviewed-on: https://skia-review.googlesource.com/10166
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>

src/image/SkImage_Generator.cpp

index 72ef877..15977b9 100644 (file)
@@ -106,7 +106,8 @@ sk_sp<SkImage> SkImage_Generator::onMakeColorSpace(sk_sp<SkColorSpace> target) c
     SkBitmap dst;
     SkImageInfo dstInfo = fCache.info().makeColorSpace(target);
     if (kIndex_8_SkColorType == dstInfo.colorType() ||
-        kGray_8_SkColorType == dstInfo.colorType()) {
+        kGray_8_SkColorType == dstInfo.colorType() ||
+        kRGB_565_SkColorType == dstInfo.colorType()) {
         dstInfo = dstInfo.makeColorType(kN32_SkColorType);
     }
     dst.allocPixels(dstInfo);