diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2010-02-09 10:58:12 (GMT) |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2010-02-09 11:51:00 (GMT) |
commit | 884a36d300bbe9068d912550a4aeb581f8ce8b37 (patch) | |
tree | 99e07f08daad0098ee3a957e0cd4c2191458aa95 /src/gui/image | |
parent | 1bb05bf5230ac41c47ce09fcc1e85e26db150322 (diff) | |
download | Qt-884a36d300bbe9068d912550a4aeb581f8ce8b37.zip Qt-884a36d300bbe9068d912550a4aeb581f8ce8b37.tar.gz Qt-884a36d300bbe9068d912550a4aeb581f8ce8b37.tar.bz2 |
Fixed warnings and crash when painting graphics effects outside scene.
The problem was that when an item had a QGraphicsEffect on itself and
that item was outside of the sceneRect, the cached pixmap of the item
was just an empty pixmap (when using DeviceCoordinates mode). Therefore
the effect filter was trying to paint into an unformatted and empty
image. Now, paint() for all pixmap filters just return immediatly when
the pixmap is empty.
Task-number: QTBUG-5358
Reviewed-by: sroedal
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpixmapfilter.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index 37a6a18..7cf942c 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -422,6 +422,9 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if(d->kernelWidth<=0 || d->kernelHeight <= 0) return; + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapConvolutionFilter *convolutionFilter = static_cast<QPixmapConvolutionFilter*>(filter); @@ -902,6 +905,9 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap if (!painter->isActive()) return; + if (src.isNull()) + return; + QRectF srcRect = rect; if (srcRect.isNull()) srcRect = src.rect(); @@ -1082,6 +1088,10 @@ void QPixmapColorizeFilter::setStrength(qreal strength) void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const { Q_D(const QPixmapColorizeFilter); + + if (src.isNull()) + return; + QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapColorizeFilter *colorizeFilter = static_cast<QPixmapColorizeFilter*>(filter); @@ -1312,6 +1322,10 @@ void QPixmapDropShadowFilter::draw(QPainter *p, const QRectF &src) const { Q_D(const QPixmapDropShadowFilter); + + if (px.isNull()) + return; + QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? static_cast<QPaintEngineEx *>(p->paintEngine())->pixmapFilter(type(), this) : 0; QPixmapDropShadowFilter *dropShadowFilter = static_cast<QPixmapDropShadowFilter*>(filter); |