summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-01-08 09:57:43 (GMT)
committerJesper Thomschutz <jesper.thomschutz@nokia.com>2010-01-08 13:36:40 (GMT)
commitd1179ad96427accf2b25c5618d999c5fe511d982 (patch)
tree4cdbae97c38d77a9fe0f5c08fe074a0d7bf72104 /src
parenteeb4b1a0a05e5e53a642d79052a631470e0a57fc (diff)
downloadQt-d1179ad96427accf2b25c5618d999c5fe511d982.zip
Qt-d1179ad96427accf2b25c5618d999c5fe511d982.tar.gz
Qt-d1179ad96427accf2b25c5618d999c5fe511d982.tar.bz2
Make sure the rect in QPixmap::copy() doesn't exceed the boundingRect.
Task: http://bugreports.qt.nokia.com/browse/QTBUG-6303 Reviewed-by: Samuel (cherry picked from commit 1484008e831a6b18272babb17992c4de686da045)
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qpixmap.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 2492f74..adfc485 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -357,7 +357,9 @@ QPixmap QPixmap::copy(const QRect &rect) const
if (isNull())
return QPixmap();
- const QRect r = rect.isEmpty() ? QRect(0, 0, width(), height()) : rect;
+ QRect r(0, 0, width(), height());
+ if (!rect.isEmpty())
+ r = r.intersected(rect);
QPixmapData *d = data->createCompatiblePixmapData();
d->copy(data.data(), r);