diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-03-25 18:26:49 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-12 06:37:47 +0000 |
commit | d6ae54adba0058b0deb064421fcea3ceaef35ed1 (patch) | |
tree | 63473948a36239d41100f60f0685958cfc5ecb2f /src | |
parent | a3d068bae181426f24acb55e3bdab413637492d1 (diff) |
QPainterPath: fix handling of fill rules
fillRule() contained a major blunder: instead of checking if the
d-pointer was allocated, and return a default value if it wasn't,
it checked whether the path contained any points. This means that
QPainterPath p;
p.setFillRule(x);
Q_ASSERT(p.fillRule() == x);
was failing.
As a drive-by to test this change, fix another mistake in clear():
clear is documented to clear the elements in a path, but instead
it also changed the fill rule.
This commit partially reverses 697910e5fbd382e78bc1bcbac3f5824aded059b4.
Change-Id: Ieb8145694b672439c3380d9ccb87d1206a2dd115
Done-with: Milian Wolff
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 0b4ccbf81ee2009051169f2f0918442b56512b20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath_p.h | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 8f62216c22..dbfca3d4b2 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1372,7 +1372,7 @@ void QPainterPath::addRegion(const QRegion ®ion) */ Qt::FillRule QPainterPath::fillRule() const { - return isEmpty() ? Qt::OddEvenFill : d_func()->fillRule; + return !d_func() ? Qt::OddEvenFill : d_func()->fillRule; } /*! diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index 0c6ed6202c..3b15dadb63 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -313,7 +313,6 @@ inline void QPainterPathData::clear() elements.clear(); cStart = 0; - fillRule = Qt::OddEvenFill; bounds = {}; controlBounds = {}; |