diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-10 15:49:11 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-01-12 18:28:24 +0100 |
commit | 96269ecc7763c0f192aa29203f28649a6fcd84ea (patch) | |
tree | a0a1866dbffdd1e57989e435fa9a1886f189d446 /src/gui/image | |
parent | 996061a1c0d5cd8413ffb6a97cb25b8da9ed811b (diff) |
Draw extended RGB solid colors
Pass extended RGB colors through the paint engine.
Change-Id: I2e212cd4c76aaa65439746352c0da2b9db4a506d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1ed94f70e2..2468b52d84 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -1909,6 +1909,31 @@ void QImage::fill(const QColor &color) qt_rectfill<quint64>(reinterpret_cast<quint64 *>(d->data), color.rgba64().premultiplied(), 0, 0, d->width, d->height, d->bytes_per_line); break; + case QImage::Format_RGBX16FPx4: + case QImage::Format_RGBA16FPx4: + case QImage::Format_RGBA16FPx4_Premultiplied: + case QImage::Format_RGBX32FPx4: + case QImage::Format_RGBA32FPx4: + case QImage::Format_RGBA32FPx4_Premultiplied:{ + float r, g, b, a; + color.getRgbF(&r, &g, &b, &a); + if (!hasAlphaChannel()) + a = 1.0f; + if (depth() == 64) { + QRgbaFloat16 c16{r, g, b, a}; + if (d->format == Format_RGBA16FPx4_Premultiplied) + c16 = c16.premultiplied(); + qt_rectfill<QRgbaFloat16>(reinterpret_cast<QRgbaFloat16 *>(d->data), c16, + 0, 0, d->width, d->height, d->bytes_per_line); + } else { + QRgbaFloat32 c32{r, g, b, a}; + if (d->format == Format_RGBA32FPx4_Premultiplied) + c32 = c32.premultiplied(); + qt_rectfill<QRgbaFloat32>(reinterpret_cast<QRgbaFloat32 *>(d->data), c32, + 0, 0, d->width, d->height, d->bytes_per_line); + } + break; + } default: { QPainter p(this); p.setCompositionMode(QPainter::CompositionMode_Source); |