summaryrefslogtreecommitdiff
path: root/src/gui/image/qpixmap_raster.cpp
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-06-29 19:47:53 +0200
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-06-30 14:45:58 +0200
commit176024dfea7d354451a65b61fa2e82dd422b4dfb (patch)
treea631b5be0010489f645b7ca553929ec1361437a2 /src/gui/image/qpixmap_raster.cpp
parentc16162214eb8757a62e221c34d38cefc402e5b05 (diff)
downloadqt4-tools-176024dfea7d354451a65b61fa2e82dd422b4dfb.tar.gz
Add the conversion in-place for QPixmap::fromImageReader() on raster.
Since raster uses QImage internal, QPixmap::fromImageReader() can use conversion in-place of the image. This avoid a memory peak during the conversion and is a bit faster. Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/image/qpixmap_raster.cpp')
-rw-r--r--src/gui/image/qpixmap_raster.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index e18874555e..53f3559298 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -152,6 +152,17 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage,
createPixmapForImage(image, flags, /* inplace = */false);
}
+void QRasterPixmapData::fromImageReader(QImageReader *imageReader,
+ Qt::ImageConversionFlags flags)
+{
+ Q_UNUSED(flags);
+ QImage image = imageReader->read();
+ if (image.isNull())
+ return;
+
+ createPixmapForImage(image, flags, /* inplace = */true);
+}
+
// from qwindowsurface.cpp
extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);