summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-27 14:12:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-04-28 21:43:50 +0000
commit7f8da2179b7542375d9cf472b74bb8c2b83435f1 (patch)
tree015ac8154544e2619e590d53e11cf18dd443d2b1
parentfc51e86ca444e713586f31ab0e0d0e26144bbfa7 (diff)
Convert opaque indexed images over RGB32
There is no reason to use the more expensive ARGB32 conversions when there is no alpha channel involved. Change-Id: Ifcb325352b8c806ef755db385121a2939c5825b2 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r--src/gui/image/qimage.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 7b558bf4dd..1bbbc3e1f2 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1993,9 +1993,12 @@ QImage QImage::convertToFormat_helper(Format format, Qt::ImageConversionFlags fl
return image;
}
- // Convert indexed formats over ARGB32 to the final format.
- Q_ASSERT(format != QImage::Format_ARGB32);
- Q_ASSERT(d->format != QImage::Format_ARGB32);
+ // Convert indexed formats over ARGB32 or RGB32 to the final format.
+ Q_ASSERT(format != QImage::Format_ARGB32 && format != QImage::Format_RGB32);
+ Q_ASSERT(d->format != QImage::Format_ARGB32 && d->format != QImage::Format_RGB32);
+
+ if (!hasAlphaChannel())
+ return convertToFormat(Format_RGB32, flags).convertToFormat(format, flags);
return convertToFormat(Format_ARGB32, flags).convertToFormat(format, flags);
}
@@ -4612,8 +4615,7 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
if (ref.load() > 1 || ro_data)
return false;
- const InPlace_Image_Converter *const converterPtr = &qimage_inplace_converter_map[format][newFormat];
- InPlace_Image_Converter converter = *converterPtr;
+ 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])