From fe68e913be19fe5b8ae8af9bf8c0defaf4fdba4e Mon Sep 17 00:00:00 2001 From: xiota Date: Thu, 11 Apr 2024 15:44:55 +0000 Subject: [PATCH] Conditional compilation for old/new API Debian/Ubuntu package libjxl 0.7.0, but Arch/MSYS2 package 0.10.2 --- rtengine/imageio.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index e5a3683dc..c6576b3c8 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -900,16 +900,28 @@ int ImageIO::loadJxl(const Glib::ustring &fname) size_t icc_size = 0; if (JXL_DEC_SUCCESS != - JxlDecoderGetICCProfileSize(dec.get(), _PROFILE_, &icc_size)) { +#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,8,0) + JxlDecoderGetICCProfileSize(dec.get(), &format, _PROFILE_, &icc_size) +#else + JxlDecoderGetICCProfileSize(dec.get(), _PROFILE_, &icc_size) +#endif + ) { g_printerr("Warning: JxlDecoderGetICCProfileSize failed\n"); } if (icc_size > 0) { icc_profile.resize(icc_size); if (JXL_DEC_SUCCESS != +#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0,8,0) + JxlDecoderGetColorAsICCProfile( + dec.get(), &format, _PROFILE_, + icc_profile.data(), icc_profile.size()) +#else JxlDecoderGetColorAsICCProfile( dec.get(), _PROFILE_, - icc_profile.data(), icc_profile.size())) { + icc_profile.data(), icc_profile.size()) +#endif + ) { g_printerr( "Warning: JxlDecoderGetColorAsICCProfile failed\n"); } else {