Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.5.0
-
None
-
bf195e57ff96c326fa26c6b3a4f64e26d18fd9bd
Description
Looks more likely to be in the QPathClipper::clip() method itself.
Attached you can find a very small testcase that shows an incorrect
behaviour in QPainterPath::intersected().
First the app creates two painterpaths called path1 and path2.
Then it calculates
- path1.intersected(path2) and
- path2.intersected(paht1)
The results should be the same. However, in the given example the
intersection of path1 with path2 results in an empty path which obviously is
incorrect. The other way works. plot.png shows that the two paths indeed
intersect.
example:
#include <QApplication> #include <QPainterPath> #include <QString> #include <QDebug> static void print(const QString& str, const QPainterPath& pp) { qDebug() << "Subject:" << str; for (int i = 0; i < pp.elementCount(); ++i) { const QPainterPath::Element& el = pp.elementAt(i); qDebug() << el.type << el.x << el.y; } if (pp.isEmpty()) qDebug() << '\t' << "!!! Empty path, this is incorrect !!!"; } int main(int argc, char* argv[]) { QApplication app(argc, argv); QPainterPath path1; path1.moveTo(200, 3.22409e-5); // e-5 and higher leads to a bug // Using 3.22409e-4 starts to work correctly path1.lineTo(0, 0); path1.lineTo(1.07025e-13, 1450); path1.lineTo(750, 950); path1.lineTo(950, 750); path1.lineTo(200, 3.22409e-13); QPainterPath path2; path2.moveTo(0, 0); path2.lineTo(200, 800); path2.lineTo(600, 1500); path2.lineTo(1500, 1400); path2.lineTo(1900, 1200); path2.lineTo(2000, 1000); path2.lineTo(1400, 0); path2.lineTo(0, 0); QPainterPath p12 = path1.intersected(path2); QPainterPath p21 = path2.intersected(path1); print("path 1", path1); print("path 2", path2); print("intersected 1 with 2", p12); print("intersected 2 with 1", p21); return 0; }
Attachments
There are no Sub-Tasks for this issue.