summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-22 13:45:58 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-07-22 14:54:16 +0200
commitb0d0a2680afffe02713ee4110c7996ee423c1d1e (patch)
treed30bee40cc384d79afc5f1044351b1a5bc5d299c
parent4cedc55327d79aeee18c602fa0822283b27a74e9 (diff)
QPixmap::fromImage() should detach when changing QImage format
When QPixmap::fromImage() detects an ARGB32 image with only opaque pixels it will do a conversion where it only changes the advertised format of the image. This conversion was lacking a check to see if it the QImage was shared before doing so, which this patch adds. Task-number: QTBUG-40282 Change-Id: I3acf221b76735637cef04c2104a33f87e5f09d54 Reviewed-by: Andreas Löw <andreas@code-and-web.de> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
-rw-r--r--src/gui/image/qpixmap_raster.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index d879a5cb61..639650dd89 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -343,6 +343,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32
|| sourceImage.format() == QImage::Format_ARGB32_Premultiplied))
{
+ inPlace = inPlace && sourceImage.isDetached();
image = sourceImage;
if (!inPlace)
image.detach();