From b0d0a2680afffe02713ee4110c7996ee423c1d1e Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 22 Jul 2014 13:45:58 +0200 Subject: QPixmap::fromImage() should detach when changing QImage format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Friedemann Kleint --- src/gui/image/qpixmap_raster.cpp | 1 + 1 file changed, 1 insertion(+) 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(); -- cgit v1.2.3