[cairo-commit] cairo/src cairo-arc.c,1.4,1.5
Bertram Felgenhauer
commit at pdx.freedesktop.org
Mon Aug 22 16:50:32 PDT 2005
Committed by: inte
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv14136/src
Modified Files:
cairo-arc.c
Log Message:
2005-08-22 Bertram Felgenhauer <int-e at gmx.de>
* src/cairo-arc.c (_arc_segments_needed): correct the calculation of
the error bound.
Index: cairo-arc.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-arc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo-arc.c 5 Aug 2005 17:05:29 -0000 1.4
+++ cairo-arc.c 22 Aug 2005 23:50:30 -0000 1.5
@@ -100,27 +100,19 @@
return angle;
}
-/* XXX: The computation here if bogus. Correct math (with proof!) is
- * available in _cairo_pen_vertices_needed. */
static int
_arc_segments_needed (double angle,
double radius,
cairo_matrix_t *ctm,
double tolerance)
{
- double l1, l2, lmax;
- double max_angle;
-
- _cairo_matrix_compute_eigen_values (ctm, &l1, &l2);
-
- l1 = fabs (l1);
- l2 = fabs (l2);
- if (l1 > l2)
- lmax = l1;
- else
- lmax = l2;
+ double major_axis, max_angle;
- max_angle = _arc_max_angle_for_tolerance_normalized (tolerance / (radius * lmax));
+ /* the error is amplified by at most the length of the
+ * major axis of the circle; see cairo-pen.c for a more detailed analysis
+ * of this. */
+ major_axis = _cairo_matrix_transformed_circle_major_axis (ctm, radius);
+ max_angle = _arc_max_angle_for_tolerance_normalized (tolerance / major_axis);
return (int) ceil (angle / max_angle);
}
More information about the cairo-commit
mailing list