diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-10-08 12:21:10 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-10-08 12:33:19 (GMT) |
commit | 4d974ff0a748b22e668a4cb7ef38101122c85b3b (patch) | |
tree | f6e36f4780e747c023035c1ba0d472c08d0f5f2f /src/gui/image | |
parent | 4cff91c66207b870e12365421e63cd978e162e64 (diff) | |
download | Qt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.zip Qt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.tar.gz Qt-4d974ff0a748b22e668a4cb7ef38101122c85b3b.tar.bz2 |
Avoid in-place convertion of images with multiple references
The decoding from image reader was assuming the image reader do not
keep the image internally. This is not true for the GIF plugins because
the previous image can be used to compose the current image.
This was causing crash on ARM because the 16 bits color depth causes
the image memory to be reduce by half. When the plugin was accessing
the memory, it assumes the images has not changed and is on 32 bits.
This patch disable the in-place conversion if a detach is required.
Regular conversion is the correct solution in this case, and it can
also be made faster by converting while copying.
Reviewed-by: Andreas Kling
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index ac148ee..1157b93 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -6607,6 +6607,10 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla if (format == newFormat) return true; + // No in-place conversion if we have to detach + if (ref > 1) + return false; + const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat]; InPlace_Image_Converter converter = *converterPtr; if (converter) |