From 9f4f45687bba0e911790bf703e98379d8be1ab65 Mon Sep 17 00:00:00 2001 From: Marcel Schuette Date: Tue, 8 May 2012 11:06:19 +0200 Subject: DirectFB: Improvement for QDirectFBPaintEngine::fill() Improvement for bug fix related to QTBUG-23850 in QDirectFBPaintEngine: combine the conditions for an accelerated fillrect (5 elements and rectangle shape) in first if-statement. The previous check for NULL pointer solves the problem for the crash, but it simply skips the type check (which caused the crash before) and the or-condition (shape) became true and leads to an accelerated fillrect. Otherwise it would fallback to raster. The original reason for the crash (elemets is null) might be Q_DISABLE_COPY macro of QVectorPath, especially with the last lines of the Q_DISABLE_COPY documentation, which could become true on embedded devices, where DirectFB is often used, with special toolchains/compilers. Task-number: QTBUG-23850 Change-Id: I340291fbce24260c7522684305c292e66cfc32af Reviewed-by: Girish Ramakrishnan --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 2af6f3d..d28918c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -825,18 +825,15 @@ void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) if (brush.style() == Qt::NoBrush) return; - const QPainterPath::ElementType *elements = path.elements(); - const qreal *points = path.points(); - - if (path.elementCount() == 5) { - if ((elements - && elements[0] == QPainterPath::MoveToElement - && elements[1] == QPainterPath::LineToElement - && elements[2] == QPainterPath::LineToElement - && elements[3] == QPainterPath::LineToElement - && elements[4] == QPainterPath::LineToElement ) - || (path.shape() == QVectorPath::RectangleHint)) { - + if (path.elementCount() == 5 && path.shape() == QVectorPath::RectangleHint) { + const QPainterPath rectPath = path.convertToPainterPath(); + if (rectPath.elementAt(0).type == QPainterPath::MoveToElement + && rectPath.elementAt(1).type == QPainterPath::LineToElement + && rectPath.elementAt(2).type == QPainterPath::LineToElement + && rectPath.elementAt(3).type == QPainterPath::LineToElement + && rectPath.elementAt(4).type == QPainterPath::LineToElement) { + + const qreal *points = path.points(); if (points[1] == points[3] && points[2] == points[4] && points[5] == points[7] -- cgit v0.12