diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-06 13:27:31 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-08-28 12:18:03 +0200 |
commit | ea70c3c9f9abf17a0daddd9a61f41d3c39a4c152 (patch) | |
tree | dc34bf8dec2e6eb4d890abf702e9af7c193aafd1 /src/gui/image/qimage.cpp | |
parent | 28f31002c49b7c20d24528ae0ff0f4e946228c80 (diff) |
Add rgb64 inplace generic conversion
Can avoid having direct conversions between all high precision formats.
Change-Id: I36dd223d028cfda1b6f4116b38ca79cdb7bc5243
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 15233d0989..0866da67f9 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2052,7 +2052,7 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl if (!converter && format > QImage::Format_Indexed8 && d->format > QImage::Format_Indexed8) { if (qt_highColorPrecision(d->format, !destLayout->hasAlphaChannel) && qt_highColorPrecision(format, !hasAlphaChannel())) { - converter = convert_generic_to_rgb64; + converter = convert_generic_over_rgb64; } else converter = convert_generic; } @@ -4829,12 +4829,16 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla InPlace_Image_Converter converter = qimage_inplace_converter_map[format][newFormat]; if (converter) return converter(this, flags); - else if (format > QImage::Format_Indexed8 && newFormat > QImage::Format_Indexed8 && !qimage_converter_map[format][newFormat]) + if (format > QImage::Format_Indexed8 && newFormat > QImage::Format_Indexed8 && !qimage_converter_map[format][newFormat]) { // Convert inplace generic, but only if there are no direct converters, // any direct ones are probably better even if not inplace. + if (qt_highColorPrecision(newFormat, !qPixelLayouts[newFormat].hasAlphaChannel) + && qt_highColorPrecision(format, !qPixelLayouts[format].hasAlphaChannel)) { + return convert_generic_inplace_over_rgb64(this, newFormat, flags); + } return convert_generic_inplace(this, newFormat, flags); - else - return false; + } + return false; } /*! |