diff options
author | Serge Lysenko <sergii.lysenko@avid.com> | 2015-09-14 14:11:55 +0300 |
---|---|---|
committer | Serge Lysenko <sergii.lysenko@avid.com> | 2015-09-24 04:38:35 +0000 |
commit | c6c930415b354583345b294dc50bb0172ec7db55 (patch) | |
tree | 5ce6147554a1983f90bd5cad11146562cfbc34d2 /src/plugins | |
parent | d797a04adc5a76146ecff36e17b2a8658b0a5022 (diff) |
Fix maximum size of .ico files in ICOReader::write()
According to MSDN, a maximum icon size is 256 pixels.
http://blogs.msdn.com/b/oldnewthing/archive/2010/10/18/10077133.aspx
Change-Id: Id87c89a20c9cba6ef041b49f93f84c5e9c3eb79f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/imageformats/ico/qicohandler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/imageformats/ico/qicohandler.cpp b/src/plugins/imageformats/ico/qicohandler.cpp index b9b51130b5..19525397fa 100644 --- a/src/plugins/imageformats/ico/qicohandler.cpp +++ b/src/plugins/imageformats/ico/qicohandler.cpp @@ -659,10 +659,11 @@ bool ICOReader::write(QIODevice *device, const QVector<QImage> &images) for (int i=0; i<id.idCount; i++) { QImage image = images[i]; - // Scale down the image if it is larger than 128 pixels in either width or height - if (image.width() > 128 || image.height() > 128) + // Scale down the image if it is larger than 256 pixels in either width or height + // because this is a maximum size of image in the ICO file. + if (image.width() > 256 || image.height() > 256) { - image = image.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation); + image = image.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation); } QImage maskImage(image.width(), image.height(), QImage::Format_Mono); image = image.convertToFormat(QImage::Format_ARGB32); @@ -894,9 +895,10 @@ bool QtIcoHandler::jumpToImage(int imageNumber) { if (imageNumber < imageCount()) { m_currentIconIndex = imageNumber; + return true; } - return imageNumber < imageCount(); + return false; } /*! \reimp |