From 24ea961dc7494474ba0972c18677239724c36496 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Tue, 9 May 2023 00:45:03 +0000 Subject: [PATCH] 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 --- libs/hwui/hwui/ImageDecoder.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/hwui/hwui/ImageDecoder.cpp b/libs/hwui/hwui/ImageDecoder.cpp index 9a06be006dca4..701a87f0cce42 100644 --- a/libs/hwui/hwui/ImageDecoder.cpp +++ b/libs/hwui/hwui/ImageDecoder.cpp @@ -51,6 +51,9 @@ using namespace android; sk_sp 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.