From 74a734efedea3ada6e0062202be93bb783b4cff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= Date: Sat, 15 Feb 2025 16:16:10 +0100 Subject: [PATCH] jxl: fix build with Qt before 6.8.0 --- src/imageformats/jxl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/imageformats/jxl.cpp b/src/imageformats/jxl.cpp index a055b45..87409c4 100644 --- a/src/imageformats/jxl.cpp +++ b/src/imageformats/jxl.cpp @@ -1329,7 +1329,10 @@ bool QJpegXLHandler::write(const QImage &image) output_info.uses_original_profile = JXL_FALSE; if (tmpimage.colorSpace().isValid()) { - const QPointF whiteP = image.colorSpace().whitePoint(); + QPointF whiteP(0.3127f, 0.329f); +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) + whiteP = image.colorSpace().whitePoint(); +#endif switch (tmpimage.colorSpace().primaries()) { case QColorSpace::Primaries::SRgb: @@ -1358,6 +1361,9 @@ bool QJpegXLHandler::write(const QImage &image) break; case QColorSpace::Primaries::ProPhotoRgb: color_profile.white_point = JXL_WHITE_POINT_CUSTOM; +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0) + whiteP = QPointF(0.3457f, 0.3585f); +#endif color_profile.white_point_xy[0] = whiteP.x(); color_profile.white_point_xy[1] = whiteP.y(); color_profile.primaries = JXL_PRIMARIES_CUSTOM; @@ -1368,6 +1374,7 @@ bool QJpegXLHandler::write(const QImage &image) color_profile.primaries_blue_xy[0] = 0.0366; color_profile.primaries_blue_xy[1] = 0.0001; break; +#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) case QColorSpace::Primaries::Bt2020: color_profile.white_point = JXL_WHITE_POINT_D65; color_profile.primaries = JXL_PRIMARIES_2100; @@ -1378,6 +1385,7 @@ bool QJpegXLHandler::write(const QImage &image) color_profile.primaries_blue_xy[0] = 0.131; color_profile.primaries_blue_xy[1] = 0.046; break; +#endif default: if (is_gray && !whiteP.isNull()) { color_profile.white_point = JXL_WHITE_POINT_CUSTOM;