From 6eebb28b18922c4201849ddbf267c9527597c25a Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Wed, 21 Dec 2016 16:10:03 -0500 Subject: [PATCH] Use a colorspace when decoding to F16 A recent change caused us to always pass a color space to the decoder. A revert of that change caused us to never pass a color space to the decoder. In order to decode to F16 (and pass CTS tests), we need to pass a color space on decodes to F16. This was the "original" behavior before the bad change and bad revert. Test: This will allow us to pass CTS. BUG:33814604 Change-Id: I4e569213f9d4ff5a452149c4b2ee191bf2fe6b0e --- core/jni/android/graphics/BitmapFactory.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp index 724fccc2e91b6..1165a45c1535b 100644 --- a/core/jni/android/graphics/BitmapFactory.cpp +++ b/core/jni/android/graphics/BitmapFactory.cpp @@ -395,12 +395,9 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding SkAlphaType alphaType = codec->computeOutputAlphaType(requireUnpremultiplied); const SkImageInfo decodeInfo = SkImageInfo::Make(size.width(), size.height(), - decodeColorType, alphaType); + decodeColorType, alphaType, GraphicsJNI::colorSpaceForType(decodeColorType)); - // We always decode to sRGB, but only mark the bitmap with a color space if linear - // blending is enabled. - SkImageInfo bitmapInfo = decodeInfo.makeColorSpace( - GraphicsJNI::colorSpaceForType(decodeColorType)); + SkImageInfo bitmapInfo = decodeInfo; if (decodeColorType == kGray_8_SkColorType) { // The legacy implementation of BitmapFactory used kAlpha8 for // grayscale images (before kGray8 existed). While the codec