Backport r1081054:

Don't crash in PaintUtils::transition() if the pixmap doesn't have a
paint engine.

This is sometimes the case when called from AbstractTaskItem::drawTask().

svn path=/branches/KDE/4.4/kdelibs/; revision=1081056
This commit is contained in:
Fredrik Höglund 2010-01-27 16:32:47 +00:00
parent 91794a6bf7
commit 0fa82befaf

View File

@ -178,8 +178,10 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
// If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus // If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus
if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) && QPaintEngine *paintEngine = from.paintEngine();
from.paintEngine()->hasFeature(QPaintEngine::BlendModes)) { if (paintEngine &&
paintEngine->hasFeature(QPaintEngine::PorterDuff) &&
paintEngine->hasFeature(QPaintEngine::BlendModes)) {
QPixmap under = from; QPixmap under = from;
QPixmap over = to; QPixmap over = to;
@ -200,7 +202,7 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
} }
#if defined(Q_WS_X11) && defined(HAVE_XRENDER) #if defined(Q_WS_X11) && defined(HAVE_XRENDER)
// We have Xrender support // We have Xrender support
else if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff)) { else if (paintEngine && paintEngine->hasFeature(QPaintEngine::PorterDuff)) {
// QX11PaintEngine doesn't implement CompositionMode_Plus in Qt 4.3, // QX11PaintEngine doesn't implement CompositionMode_Plus in Qt 4.3,
// which we need to be able to do a transition from one pixmap to // which we need to be able to do a transition from one pixmap to
// another. // another.