summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainterpath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r--src/gui/painting/qpainterpath.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 9ef6955..0bb2901 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1690,7 +1690,7 @@ static void qt_painterpath_isect_line(const QPointF &p1,
}
static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt,
- int *winding)
+ int *winding, int depth = 0)
{
qreal y = pt.y();
qreal x = pt.x();
@@ -1705,7 +1705,7 @@ static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt,
// hit lower limit... This is a rough threshold, but its a
// tradeoff between speed and precision.
const qreal lower_bound = qreal(.001);
- if (bounds.width() < lower_bound && bounds.height() < lower_bound) {
+ if (depth == 32 || (bounds.width() < lower_bound && bounds.height() < lower_bound)) {
// We make the assumption here that the curve starts to
// approximate a line after while (i.e. that it doesn't
// change direction drastically during its slope)
@@ -1718,8 +1718,8 @@ static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt,
// split curve and try again...
QBezier first_half, second_half;
bezier.split(&first_half, &second_half);
- qt_painterpath_isect_curve(first_half, pt, winding);
- qt_painterpath_isect_curve(second_half, pt, winding);
+ qt_painterpath_isect_curve(first_half, pt, winding, depth + 1);
+ qt_painterpath_isect_curve(second_half, pt, winding, depth + 1);
}
}
@@ -1863,39 +1863,39 @@ static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y
return false;
}
-static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2)
+static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth = 0)
{
QRectF bounds = bezier.bounds();
if (y >= bounds.top() && y < bounds.bottom()
&& bounds.right() >= x1 && bounds.left() < x2) {
const qreal lower_bound = qreal(.01);
- if (bounds.width() < lower_bound && bounds.height() < lower_bound)
+ if (depth == 32 || bounds.width() < lower_bound && bounds.height() < lower_bound)
return true;
QBezier first_half, second_half;
bezier.split(&first_half, &second_half);
- if (qt_isect_curve_horizontal(first_half, y, x1, x2)
- || qt_isect_curve_horizontal(second_half, y, x1, x2))
+ if (qt_isect_curve_horizontal(first_half, y, x1, x2, depth + 1)
+ || qt_isect_curve_horizontal(second_half, y, x1, x2, depth + 1))
return true;
}
return false;
}
-static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2)
+static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth = 0)
{
QRectF bounds = bezier.bounds();
if (x >= bounds.left() && x < bounds.right()
&& bounds.bottom() >= y1 && bounds.top() < y2) {
const qreal lower_bound = qreal(.01);
- if (bounds.width() < lower_bound && bounds.height() < lower_bound)
+ if (depth == 32 || bounds.width() < lower_bound && bounds.height() < lower_bound)
return true;
QBezier first_half, second_half;
bezier.split(&first_half, &second_half);
- if (qt_isect_curve_vertical(first_half, x, y1, y2)
- || qt_isect_curve_vertical(second_half, x, y1, y2))
+ if (qt_isect_curve_vertical(first_half, x, y1, y2, depth + 1)
+ || qt_isect_curve_vertical(second_half, x, y1, y2, depth + 1))
return true;
}
return false;