Conditional compilation for old/new API

Debian/Ubuntu package libjxl 0.7.0,
but Arch/MSYS2 package 0.10.2
This commit is contained in:
xiota
2024-04-11 15:44:55 +00:00
parent 01f925d8d7
commit fe68e913be

View File

@@ -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 {