From 03b72188f45e72d313f8af2e16cb7067b6084f99 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 10 Jan 2023 11:43:14 -0800 Subject: QtGui: fix build with GCC 13's support for FP16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Conversion must be explicit from float, but doesn't need to be from int. qimage.cpp:1915:33: error: converting to ‘qfloat16::NativeType’ {aka ‘_Float16’} from ‘float’ with greater conversion rank [-Werror] Pick-to: 6.5 Change-Id: Ide4dbd0777a44ed0870efffd17390a0e86f1fd7e Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Giuseppe D'Angelo --- src/gui/image/qimage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/gui/image/qimage.cpp') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index f1029e786d..af26d2ea4b 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1912,7 +1912,7 @@ void QImage::fill(const QColor &color) if (!hasAlphaChannel()) a = 1.0f; if (depth() == 64) { - QRgbaFloat16 c16{r, g, b, a}; + QRgbaFloat16 c16{qfloat16(r), qfloat16(g), qfloat16(b), qfloat16(a)}; if (d->format == Format_RGBA16FPx4_Premultiplied) c16 = c16.premultiplied(); qt_rectfill(reinterpret_cast(d->data), c16, @@ -1998,11 +1998,11 @@ void QImage::invertPixels(InvertMode mode) qfloat16 *p = reinterpret_cast(d->data); qfloat16 *end = reinterpret_cast(d->data + d->nbytes); while (p < end) { - p[0] = 1.0f - p[0]; - p[1] = 1.0f - p[1]; - p[2] = 1.0f - p[2]; + p[0] = qfloat16(1) - p[0]; + p[1] = qfloat16(1) - p[1]; + p[2] = qfloat16(1) - p[2]; if (mode == InvertRgba) - p[3] = 1.0f - p[3]; + p[3] = qfloat16(1) - p[3]; p += 4; } } else if (format() >= QImage::Format_RGBX32FPx4 && format() <= QImage::Format_RGBA32FPx4_Premultiplied) { @@ -2805,7 +2805,7 @@ void QImage::setPixelColor(int x, int y, const QColor &color) color.getRgbF(&r, &g, &b, &a); if (d->format == Format_RGBX16FPx4) a = 1.0f; - QRgbaFloat16 c16f{r, g, b, a}; + QRgbaFloat16 c16f{qfloat16(r), qfloat16(g), qfloat16(b), qfloat16(a)}; if (d->format == Format_RGBA16FPx4_Premultiplied) c16f = c16f.premultiplied(); ((QRgbaFloat16 *)s)[x] = c16f; -- cgit v1.2.3