[cairo-bugs] [Bug 7245] cairo_stroke_extents() gives wrong result for arcs in some cases
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sat Oct 27 09:33:37 PDT 2007
http://bugs.freedesktop.org/show_bug.cgi?id=7245
------- Comment #4 from chris at chris-wilson.co.uk 2007-10-27 09:38 PST -------
I've worked around this problem by relaxing the check that the in and out faces
are exactly coincident, and instead just checking that if the two faces are
within stoker->tolerance of each other, then we need not do any work to join
the two faces and return SUCCESS.
@@ -205,17 +210,28 @@ _cairo_stroker_face_clockwise (cairo_stroke_face_t *in,
ca
return _cairo_slope_clockwise (&in_slope, &out_slope);
}
+static double
+_PointDistanceSquaredToPoint (const cairo_point_t *a, const cairo_point_t *b)
+{
+ double dx = _cairo_fixed_to_double (b->x - a->x);
+ double dy = _cairo_fixed_to_double (b->y - a->y);
+
+ return dx*dx + dy*dy;
+}
static cairo_status_t
_cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in,
cairo_s
{
int clockwise = _cairo_stroker_face_clockwise (out,
cairo_point_t *inpt, *outpt;
cairo_status_t status;
+ double tolerance_sqr = stroker->tolerance * stroker->tolerance;
- if (in->cw.x == out->cw.x
+ if ((in->cw.x == out->cw.x
&& in->cw.y == out->cw.y
&& in->ccw.x == out->ccw.x
&& in->ccw.y == out->ccw.y)
+ || (_PointDistanceSquaredToPoint (&in->cw, &out->cw) < tolerance_sqr &&
+ _PointDistanceSquaredToPoint (&in->ccw, &out->ccw) <
tolerance_sqr))
{
return CAIRO_STATUS_SUCCESS;
}
I'm a little hesitant to apply this as I'm uncertain as to whether this is just
papering over a deeper bug.
--
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the cairo-bugs
mailing list