summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcel Schuette <marcel.schuette@nokia.com>2012-05-08 09:06:19 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-05-30 19:47:09 (GMT)
commit9f4f45687bba0e911790bf703e98379d8be1ab65 (patch)
treecf04696b2fc7457ffea1ea0b4f76a51ac18b354b /src
parent6c20d552b9917ea736c52a7d436dafbf542bff30 (diff)
downloadQt-9f4f45687bba0e911790bf703e98379d8be1ab65.zip
Qt-9f4f45687bba0e911790bf703e98379d8be1ab65.tar.gz
Qt-9f4f45687bba0e911790bf703e98379d8be1ab65.tar.bz2
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 <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp21
1 files 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]