summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-01-10 11:43:14 -0800
committerThiago Macieira <thiago.macieira@intel.com>2023-01-11 11:16:21 -0800
commit03b72188f45e72d313f8af2e16cb7067b6084f99 (patch)
treed77818b3e3ec12b6b7dba285041bab2649d00435 /src/gui/image/qimage.cpp
parent299f2a7a3f2d17b21e818143c1c1dfecf63bdf8d (diff)
QtGui: fix build with GCC 13's support for FP16
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 <allan.jensen@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp12
1 files changed, 6 insertions, 6 deletions
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<QRgbaFloat16>(reinterpret_cast<QRgbaFloat16 *>(d->data), c16,
@@ -1998,11 +1998,11 @@ void QImage::invertPixels(InvertMode mode)
qfloat16 *p = reinterpret_cast<qfloat16 *>(d->data);
qfloat16 *end = reinterpret_cast<qfloat16 *>(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;