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

Commit 0c030a43 authored by Matt Sarett's avatar Matt Sarett Committed by Android (Google) Code Review
Browse files

Merge "Request legacy mode behavior from SkCodec in BitmapFactory"

parents 182f9abd a493f62a
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -384,9 +384,12 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding
    // Set the alpha type for the decode.
    SkAlphaType alphaType = codec->computeOutputAlphaType(requireUnpremultiplied);

    const SkImageInfo decodeInfo = codec->getInfo().makeWH(size.width(), size.height())
                                                   .makeColorType(decodeColorType)
                                                   .makeAlphaType(alphaType);
    // Enable legacy behavior to avoid any gamma correction.  Android's assets are
    // adjusted to expect a non-gamma correct premultiply.
    sk_sp<SkColorSpace> colorSpace = nullptr;
    const SkImageInfo decodeInfo = SkImageInfo::Make(size.width(), size.height(), decodeColorType,
                                                     alphaType, colorSpace);

    SkImageInfo bitmapInfo = decodeInfo;
    if (decodeColorType == kGray_8_SkColorType) {
        // The legacy implementation of BitmapFactory used kAlpha8 for