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

Commit 1b3cc18f authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Support decoding gainmaps to alpha8 with BitmapFactory." into udc-dev...

Merge "Support decoding gainmaps to alpha8 with BitmapFactory." into udc-dev am: ba62f46d am: d2f15139 am: e28e3ce3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23121580



Change-Id: I72f8a04b3b14a989b7c6dbdeb1e74534a85d4a75
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ad78f700 e28e3ce3
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -194,7 +194,11 @@ static bool decodeGainmap(std::unique_ptr<SkStream> gainmapStream, const SkGainm
        ALOGE("Can not create a codec for Gainmap.");
        return false;
    }
    SkColorType decodeColorType = codec->computeOutputColorType(kN32_SkColorType);
    SkColorType decodeColorType = kN32_SkColorType;
    if (codec->getInfo().colorType() == kGray_8_SkColorType) {
        decodeColorType = kGray_8_SkColorType;
    }
    decodeColorType = codec->computeOutputColorType(decodeColorType);
    sk_sp<SkColorSpace> decodeColorSpace = codec->computeOutputColorSpace(decodeColorType, nullptr);

    SkISize size = codec->getSampledDimensions(sampleSize);
@@ -217,7 +221,11 @@ static bool decodeGainmap(std::unique_ptr<SkStream> gainmapStream, const SkGainm
    const SkImageInfo decodeInfo = SkImageInfo::Make(size.width(), size.height(), decodeColorType,
                                                     alphaType, decodeColorSpace);

    const SkImageInfo& bitmapInfo = decodeInfo;
    SkImageInfo bitmapInfo = decodeInfo;
    if (decodeColorType == kGray_8_SkColorType) {
        // We treat gray8 as alpha8 in Bitmap's API surface
        bitmapInfo = bitmapInfo.makeColorType(kAlpha_8_SkColorType);
    }
    SkBitmap decodeBitmap;
    sk_sp<Bitmap> nativeBitmap = nullptr;