summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-09 14:54:41 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-09 17:47:30 (GMT)
commit1c5da7207a21cc44a4a08d291c290ffcd9b958fd (patch)
tree20041e6e1b8482a38dae3e7e58ad5c5ca0bdf125 /src/gui
parentbae78d4a2cc32952a19e4da9f0486af635ea6d47 (diff)
downloadQt-1c5da7207a21cc44a4a08d291c290ffcd9b958fd.zip
Qt-1c5da7207a21cc44a4a08d291c290ffcd9b958fd.tar.gz
Qt-1c5da7207a21cc44a4a08d291c290ffcd9b958fd.tar.bz2
Prevent crash in OpenGL engine when scaling images / pixmaps.
Make sure the resulting image / pixmap is valid if the source was valid. Task-number: QTBUG-19157 Reviewed-by: Kim Reviewed-by: Benjamin Poulain
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 441bdb1..c867984 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4377,6 +4377,8 @@ QImage QImage::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Transf
QSize newSize = size();
newSize.scale(s, aspectMode);
+ newSize.rwidth() = qMax(newSize.width(), 1);
+ newSize.rheight() = qMax(newSize.height(), 1);
if (newSize == size())
return *this;
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 1a83318..ed1b0f0 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1479,6 +1479,8 @@ QPixmap QPixmap::scaled(const QSize& s, Qt::AspectRatioMode aspectMode, Qt::Tran
QSize newSize = size();
newSize.scale(s, aspectMode);
+ newSize.rwidth() = qMax(newSize.width(), 1);
+ newSize.rheight() = qMax(newSize.height(), 1);
if (newSize == size())
return *this;