Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2312cdca authored by Matt Sarett's avatar Matt Sarett
Browse files

Decode to sRGB in BitmapFactory

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

Change-Id: I922540f0a16df8693e2c30944b595538c34c583a
parent 0b2a66c7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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