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

Commit 2118d085 authored by Alec Mouri's avatar Alec Mouri Committed by Cherrypicker Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:24ea961dc7494474ba0972c18677239724c36496)
Merged-In: I3a720e391cb19872c9e3e9182a86322b1c0e7ad1
Change-Id: I3a720e391cb19872c9e3e9182a86322b1c0e7ad1
parent 7dcd1c1d
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,9 @@ using namespace android;
sk_sp<SkColorSpace> ImageDecoder::getDefaultColorSpace() const {
sk_sp<SkColorSpace> ImageDecoder::getDefaultColorSpace() const {
    const skcms_ICCProfile* encodedProfile = mCodec->getICCProfile();
    const skcms_ICCProfile* encodedProfile = mCodec->getICCProfile();
    if (encodedProfile) {
    if (encodedProfile) {
        if (encodedProfile->has_CICP) {
            return mCodec->computeOutputColorSpace(kN32_SkColorType);
        }
        // If the profile maps directly to an SkColorSpace, that SkColorSpace
        // If the profile maps directly to an SkColorSpace, that SkColorSpace
        // will be returned. Otherwise, nullptr will be returned. In either
        // will be returned. Otherwise, nullptr will be returned. In either
        // case, using this SkColorSpace results in doing no color correction.
        // case, using this SkColorSpace results in doing no color correction.