Decode to sRGB in BitmapFactory

Test: Verified content looks as expected.  Color correct
modes are well tested in Skia.

Change-Id: I922540f0a16df8693e2c30944b595538c34c583a
This commit is contained in:
Matt Sarett
2016-12-08 10:15:43 -05:00
parent 0b2a66c72e
commit 2312cdcaa3

View File

@@ -395,9 +395,11 @@ 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, GraphicsJNI::defaultColorSpace());
decodeColorType, alphaType, codec->computeOutputColorSpace(decodeColorType));
SkImageInfo bitmapInfo = decodeInfo;
// We always decode to sRGB, but only mark the bitmap with a color space if linear
// blending is enabled.
SkImageInfo bitmapInfo = decodeInfo.makeColorSpace(GraphicsJNI::defaultColorSpace());
if (decodeColorType == kGray_8_SkColorType) {
// The legacy implementation of BitmapFactory used kAlpha8 for
// grayscale images (before kGray8 existed). While the codec