From fece4080b02a8edfd743919bb694bd8e9c1e1271 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 18 Sep 2009 09:06:36 -0700 Subject: A pen/brush can be invalid and have a valid color This code is wrong: if (brush != Qt::NoBrush) ... It should be: if (brush.style() != Qt::NoBrush) ... Reviewed-by: Jervey Kong --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 40476e9..043189e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -399,7 +399,7 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; const QBrush &brush = state()->brush; - if (brush == Qt::NoBrush && pen == Qt::NoPen) + if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) @@ -412,11 +412,13 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush != Qt::NoBrush) { + + if (brush.style() != Qt::NoBrush) { d->setDFBColor(brush.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(fillRects)(rects, rectCount, state()->matrix, d->surface)); } - if (pen != Qt::NoPen) { + + if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); } @@ -427,7 +429,7 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) Q_D(QDirectFBPaintEngine); const QPen &pen = state()->pen; const QBrush &brush = state()->brush; - if (brush == Qt::NoBrush && pen == Qt::NoPen) + if (brush.style() == Qt::NoBrush && pen.style() == Qt::NoPen) return; if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives) @@ -440,11 +442,13 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) QRasterPaintEngine::drawRects(rects, rectCount); return; } - if (brush != Qt::NoBrush) { + + if (brush.style() != Qt::NoBrush) { d->setDFBColor(brush.color()); CLIPPED_PAINT(fillRects(rects, rectCount, state()->matrix, d->surface)); } - if (pen != Qt::NoPen) { + + if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawRects)(rects, rectCount, state()->matrix, d->surface)); } @@ -464,7 +468,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) } const QPen &pen = state()->pen; - if (pen != Qt::NoPen) { + if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); } @@ -484,7 +488,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) } const QPen &pen = state()->pen; - if (pen != Qt::NoPen) { + if (pen.style() != Qt::NoPen) { d->setDFBColor(pen.color()); CLIPPED_PAINT(QT_PREPEND_NAMESPACE(drawLines)(lines, lineCount, state()->matrix, d->surface)); } -- cgit v0.12