summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2010-09-21 12:06:59 (GMT)
committerYoann Lopes <yoann.lopes@nokia.com>2010-09-21 12:19:16 (GMT)
commit9035b78ef8b8ebfdd7d43fc0b9c3071253eb0d56 (patch)
treef5a8268ea8e2ea6c859d73525c732c357399e781
parent8b594b7f9373b82938aebbc056b18657034abce2 (diff)
downloadQt-9035b78ef8b8ebfdd7d43fc0b9c3071253eb0d56.zip
Qt-9035b78ef8b8ebfdd7d43fc0b9c3071253eb0d56.tar.gz
Qt-9035b78ef8b8ebfdd7d43fc0b9c3071253eb0d56.tar.bz2
Fixes bezier curves not being drawn when it is a line.
Some old work-around code is no longer needed... Task-number: QTBUG-13721 Reviewed-by: Samuel
-rw-r--r--src/gui/painting/qbezier.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 2a9b31a..54c81ba 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -293,36 +293,6 @@ static ShiftResult good_offset(const QBezier *b1, const QBezier *b2, qreal offse
return Ok;
}
-static inline QLineF qline_shifted(const QPointF &p1, const QPointF &p2, qreal offset)
-{
- QLineF l(p1, p2);
- QLineF ln = l.normalVector().unitVector();
- l.translate(ln.dx() * offset, ln.dy() * offset);
- return l;
-}
-
-static bool qbezier_is_line(QPointF *points, int pointCount)
-{
- Q_ASSERT(pointCount > 2);
-
- qreal dx13 = points[2].x() - points[0].x();
- qreal dy13 = points[2].y() - points[0].y();
-
- qreal dx12 = points[1].x() - points[0].x();
- qreal dy12 = points[1].y() - points[0].y();
-
- if (pointCount == 3) {
- return qFuzzyCompare(dx12 * dy13, dx13 * dy12);
- } else if (pointCount == 4) {
- qreal dx14 = points[3].x() - points[0].x();
- qreal dy14 = points[3].y() - points[0].y();
-
- return (qFuzzyCompare(dx12 * dy13, dx13 * dy12) && qFuzzyCompare(dx12 * dy14, dx14 * dy12));
- }
-
- return false;
-}
-
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
{
int map[4];
@@ -353,17 +323,6 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr
if (np == 1)
return Discard;
- // We need to specialcase lines of 3 or 4 points due to numerical
- // instability in intersections below
- if (np > 2 && qbezier_is_line(points, np)) {
- if (points[0] == points[np-1])
- return Discard;
-
- QLineF l = qline_shifted(points[0], points[np-1], offset);
- *shifted = QBezier::fromPoints(l.p1(), l.pointAt(qreal(0.33)), l.pointAt(qreal(0.66)), l.p2());
- return Ok;
- }
-
QRectF b = orig->bounds();
if (np == 4 && b.width() < .1*offset && b.height() < .1*offset) {
qreal l = (orig->x1 - orig->x2)*(orig->x1 - orig->x2) +