diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-12-07 14:30:25 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-12-08 15:15:57 +0100 |
commit | cc81aae4b312da40945ddfecb806f4abe6b74048 (patch) | |
tree | 4d92d3b1f9549d5946f4a6d0a4980c271fae145c /src/gui/image | |
parent | fd20bc2277f98b86bddbd3f8a0ca92457a8c7c70 (diff) |
Shortcut QImage::convertTo when no conversion is necessary
Avoids a detach when converting to existing format.
Pick-to: 6.0
Change-Id: I9a4801878ddec295a02f2c88f4a40ec13d513a94
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 2787be53d0..cced1d9942 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -2239,7 +2239,7 @@ bool QImage::reinterpretAsFormat(Format format) /*! \since 5.13 - Detach and convert the image to the given \a format in place. + Converts the image to the given \a format in place, detaching if necessary. The specified image conversion \a flags control how the image data is handled during the conversion process. @@ -2249,7 +2249,7 @@ bool QImage::reinterpretAsFormat(Format format) void QImage::convertTo(Format format, Qt::ImageConversionFlags flags) { - if (!d || format == QImage::Format_Invalid) + if (!d || format == QImage::Format_Invalid || d->format == format) return; detach(); |