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=/trunk/KDE/kdelibs/; revision=1081054
This commit is contained in:
Fredrik Höglund 2010-01-27 16:26:41 +00:00
parent 189289660c
commit b6ab41d131

View File

@ -196,8 +196,10 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
// If the native paint engine supports Porter/Duff compositing and CompositionMode_Plus
if (from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) &&
from.paintEngine()->hasFeature(QPaintEngine::BlendModes)) {
QPaintEngine *paintEngine = from.paintEngine();
if (paintEngine &&
paintEngine->hasFeature(QPaintEngine::PorterDuff) &&
paintEngine->hasFeature(QPaintEngine::BlendModes)) {
QPainter p;
p.begin(&targetPixmap);
@ -216,7 +218,7 @@ QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
}
#if defined(Q_WS_X11) && defined(HAVE_XRENDER)
// 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,
// which we need to be able to do a transition from one pixmap to
// another.