From 735caf214e233751cb767214488e0d36931a5b0e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 1 Mar 2011 12:22:17 +0200 Subject: Have QVolatileImage backed by a bitmap in all cases. The behavior now matches the raster (s60) pixmap: A bitmap is created immediately when constructing from a QImage. This is needed to reduce the heap usage of applications (by getting rid of the QImage as early as possible). Reviewed-by: Jani Hautakangas --- src/gui/image/qvolatileimagedata_symbian.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp index d9c2ad4..474d0ef 100644 --- a/src/gui/image/qvolatileimagedata_symbian.cpp +++ b/src/gui/image/qvolatileimagedata_symbian.cpp @@ -248,10 +248,10 @@ QVolatileImageData::QVolatileImageData(const QImage &sourceImage) : next(0), prev(0), bitmap(0), pengine(0) { registerImageData(this); - // Try being optimal: Defer the bitmap creation and pixel data copying - // to ensureBitmap() which will be called when there is a real need for - // the bitmap. image = sourceImage; + // The following is not mandatory, but we do it here to have a bitmap + // created always in order to reduce local heap usage. + ensureBitmap(); } QVolatileImageData::QVolatileImageData(void *nativeImage, void *nativeMask) @@ -462,8 +462,6 @@ void QVolatileImageData::ensureImage() void QVolatileImageData::ensureBitmap() { - // Creates the bitmap from the image if not yet done. This case can happen - // only if we were constructed from a QImage. Otherwise this is a no-op. if (!bitmap && !image.isNull()) { bitmap = imageToBitmap(image); updateImage(); -- cgit v0.12