From cb9051c79e5937ad8441100aaf67553e28ba0700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 2 Mar 2010 10:25:13 +0100 Subject: Prevented assert on 1 pixel wide / high images in qt_blurImage. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/gui/image/qpixmapfilter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v0.12