diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2010-01-08 09:57:43 (GMT) |
---|---|---|
committer | gunnar <gunnar@trolltech.com> | 2010-01-08 09:59:19 (GMT) |
commit | 1484008e831a6b18272babb17992c4de686da045 (patch) | |
tree | 2579feb9a218fd7f042456693197729bbbe20502 /src/gui/image | |
parent | 785767e1f965a904765bab5dbfff1a21240dcc88 (diff) | |
download | Qt-1484008e831a6b18272babb17992c4de686da045.zip Qt-1484008e831a6b18272babb17992c4de686da045.tar.gz Qt-1484008e831a6b18272babb17992c4de686da045.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
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 7e4597e..7b522f5 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); |