Skip to content

Commit

Permalink
Build against libjxl 0.9
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259393

Reviewed by Carlos Garcia Campos.

As libjxl works towards version 1.0, there are still API/ABI breaks on
every 0.n release. libjxl 0.9 removed an unused parameter to some ICC
functions we depend on.

* Source/WebCore/platform/image-decoders/jpegxl/JPEGXLImageDecoder.cpp:
(WebCore::JPEGXLImageDecoder::tryDecodeICCColorProfile):

Canonical link: https://commits.webkit.org/266244@main
  • Loading branch information
mcatanzaro committed Jul 24, 2023
1 parent e0a8ad8 commit bc4e645
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,21 @@ void JPEGXLImageDecoder::prepareColorTransform()
LCMSProfilePtr JPEGXLImageDecoder::tryDecodeICCColorProfile()
{
size_t profileSize = 0;
#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
if (JxlDecoderGetICCProfileSize(m_decoder.get(), &s_pixelFormat, JXL_COLOR_PROFILE_TARGET_DATA, &profileSize) != JXL_DEC_SUCCESS)
return nullptr;

Vector<uint8_t> profileData(profileSize);
if (JxlDecoderGetColorAsICCProfile(m_decoder.get(), &s_pixelFormat, JXL_COLOR_PROFILE_TARGET_DATA, profileData.data(), profileData.size()) != JXL_DEC_SUCCESS)
return nullptr;
#else
if (JxlDecoderGetICCProfileSize(m_decoder.get(), JXL_COLOR_PROFILE_TARGET_DATA, &profileSize) != JXL_DEC_SUCCESS)
return nullptr;

Vector<uint8_t> profileData(profileSize);
if (JxlDecoderGetColorAsICCProfile(m_decoder.get(), JXL_COLOR_PROFILE_TARGET_DATA, profileData.data(), profileData.size()) != JXL_DEC_SUCCESS)
return nullptr;
#endif

return LCMSProfilePtr(cmsOpenProfileFromMem(profileData.data(), profileData.size()));
}
Expand Down

0 comments on commit bc4e645

Please sign in to comment.