Bug 1925265. Always correctly handle the TO_SRGB_COLORSPACE flag when decoding an image. r=gfx-reviewers,aosmond

Differential Revision: https://phabricator.services.mozilla.com/D225962
This commit is contained in:
Timothy Nikkel 2024-10-19 11:13:07 +00:00
parent 37a4551db6
commit 2c516b3ffb

View File

@ -93,10 +93,20 @@ Decoder::~Decoder() {
void Decoder::SetSurfaceFlags(SurfaceFlags aSurfaceFlags) {
MOZ_ASSERT(!mInitialized);
MOZ_ASSERT(!(mSurfaceFlags & SurfaceFlags::NO_COLORSPACE_CONVERSION) ||
!(mSurfaceFlags & SurfaceFlags::TO_SRGB_COLORSPACE));
mSurfaceFlags = aSurfaceFlags;
if (mSurfaceFlags & SurfaceFlags::NO_COLORSPACE_CONVERSION) {
mCMSMode = CMSMode::Off;
}
if (mSurfaceFlags & SurfaceFlags::TO_SRGB_COLORSPACE) {
// CMSMode::TaggedOnly and CMSMode::All are equivalent when the
// TO_SRGB_COLORSPACE flag is set (for untagged images CMSMode::All assumes
// they are in sRGB space so it does nothing, which is same as what
// CMSMode::TaggedOnly does for untagged images). We just want to avoid
// CMSMode::Off so that the sRGB conversion actually happens.
mCMSMode = CMSMode::All;
}
}
qcms_profile* Decoder::GetCMSOutputProfile() const {