summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_raster_p.h
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-06-19 21:56:29 +0200
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-06-20 04:30:33 +0200
commit0a96503e84b418708712af61497df4a493ed9072 (patch)
treea1b29c6416f0896a3c9fee394c7858a0ec744713 /src/gui/image/qpixmap_raster_p.h
parentcf5971503ee1f7a5ce96758e33796dfdf48375bf (diff)
Start the implementation of in-place recoding for images
Currently, with the graphics system raster, converting from images to QPixmap often needs to allocate a new image to convert the right format. For example, for an image in ARGB32 of 10 mbytes, we need to allocate a second image of 10 mbytes in ARGB32_PM to convert the source image in the right format for pixmap. This can create a hight peak of memory, and is a bit slower than it should. This patch introduce in-place conversion of images when they are loaded with QPixmap::loadFromData(). The images are loaded in their default format by QImageReader, and are then converted in-place, trying to reduce memory allocations. Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/image/qpixmap_raster_p.h')
-rw-r--r--src/gui/image/qpixmap_raster_p.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 6cdd3d7101..d7e3f85ed5 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -72,6 +72,7 @@ public:
void resize(int width, int height);
void fromFile(const QString &filename, Qt::ImageConversionFlags flags);
+ bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
bool scroll(int dx, int dy, const QRect &rect);
@@ -85,6 +86,8 @@ public:
protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
+ void setImage(const QImage &image);
QImage image;
private: