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

Commit 24ea961d authored by Alec Mouri's avatar Alec Mouri
Browse files

Support CICPs in AImageDecoder

CICPs will be supported in SkAndroidCodec, but AImageDecoder uses
ImageDecoder::getDefaultColorSpace instead, which has subtly different
handling for wide color ICC profiles. So make AImageDecoder use
SkAndroidCodec::computeOutputColorSpace directly when there is CICP
data.

Bug: 279811818
Test: AImageDecoderTests
Change-Id: I3a720e391cb19872c9e3e9182a86322b1c0e7ad1
parent 1cdefcdf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ using namespace android;
sk_sp<SkColorSpace> ImageDecoder::getDefaultColorSpace() const {
    const skcms_ICCProfile* encodedProfile = mCodec->getICCProfile();
    if (encodedProfile) {
        if (encodedProfile->has_CICP) {
            return mCodec->computeOutputColorSpace(kN32_SkColorType);
        }
        // If the profile maps directly to an SkColorSpace, that SkColorSpace
        // will be returned. Otherwise, nullptr will be returned. In either
        // case, using this SkColorSpace results in doing no color correction.