summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2010-03-02 09:25:13 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2010-03-02 09:41:21 (GMT)
commitcb9051c79e5937ad8441100aaf67553e28ba0700 (patch)
tree04c47a17f11fb4bf7520441ee168ca8200fd91e3 /src/gui/image
parent9253b0dffc5e8a5d704f0a3d4960db4cd484d69a (diff)
downloadQt-cb9051c79e5937ad8441100aaf67553e28ba0700.zip
Qt-cb9051c79e5937ad8441100aaf67553e28ba0700.tar.gz
Qt-cb9051c79e5937ad8441100aaf67553e28ba0700.tar.bz2
Prevented assert on 1 pixel wide / high images in qt_blurImage.
Don't attempt to run qt_halfScaled on images less than 2px in either dimension. Particularly, avoid doing this from qt_blurImage, where that situation can happen as a result of a clipped QGraphicsEffect. Reviewed-by: Bjørn Erik Nilsen
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpixmapfilter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 2792e45..c605880 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -777,6 +777,9 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source)
{
+ if (source.width() < 2 || source.height() < 2)
+ return QImage();
+
QImage srcImage = source;
if (source.format() == QImage::Format_Indexed8) {
@@ -869,7 +872,7 @@ Q_GUI_EXPORT void qt_blurImage(QPainter *p, QImage &blurImage, qreal radius, boo
}
qreal scale = 1;
- if (radius >= 4) {
+ if (radius >= 4 && blurImage.width() >= 2 && blurImage.height() >= 2) {
blurImage = qt_halfScaled(blurImage);
scale = 2;
radius *= qreal(0.5);