Fixed to use fabs not abs. Added pointer to Hobby's intersection paper.

This commit is contained in:
Carl Worth 2003-08-29 17:48:48 +00:00
parent 2ee2cfe14a
commit 0ed4d32d87
5 changed files with 55 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2003-08-28 Carl Worth <cworth at east.isi.edu>
* src/cairo_traps.c (_line_segs_intersect_ceil): One more
increment, (that still won't fix the bug). Added comment point to
Hobby's paper, (that will fix it).
* src/cairo_font.c (_cairo_font_resolve_xft_font): Fixed to use
fabs instead of abs when correcting for negative area expansion.
2003-08-28 Keith Packard <keithp@keithp.com
* src/cairo_font.c: font pixel size is always non-negative

View file

@ -143,7 +143,8 @@ _cairo_font_resolve_xft_font (cairo_font_t *font, cairo_gstate_t *gstate, XftFon
X/Y scaling. Is there anything different we would want to do
for non-uniform X/Y scaling? */
_cairo_matrix_compute_determinant (&matrix, &expansion);
font_size = sqrt (abs(expansion));
font_size = sqrt (fabs (expansion));
FcPatternAddDouble (pattern, "pixelsize", font_size);
cairo_matrix_scale (&matrix, 1.0 / font_size, 1.0 / font_size);

View file

@ -434,6 +434,27 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
*/
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* XXX: hmm... now I found "intersection_killer" inside xrspline.c
that requires 3 increments. Clearly, we haven't characterized
this completely yet. */
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* I think I've found the answer to our problems. The insight is
that everytime we round we are changing the slopes of the
relevant lines, so we may be introducing new intersections that
we miss, so everything breaks apart. John Hobby wrote a paper
on how to fix this:
[Hobby93c] John D. Hobby, Practical Segment Intersection with
Finite Precision Output, Computation Geometry Theory and
Applications, 13(4), 1999.
Available online (2003-08017):
http://cm.bell-labs.com/cm/cs/doc/93/2-27.ps.gz
Now we just need to go off and implement that.
*/
*y_ret = y_intersect;

View file

@ -143,7 +143,8 @@ _cairo_font_resolve_xft_font (cairo_font_t *font, cairo_gstate_t *gstate, XftFon
X/Y scaling. Is there anything different we would want to do
for non-uniform X/Y scaling? */
_cairo_matrix_compute_determinant (&matrix, &expansion);
font_size = sqrt (abs(expansion));
font_size = sqrt (fabs (expansion));
FcPatternAddDouble (pattern, "pixelsize", font_size);
cairo_matrix_scale (&matrix, 1.0 / font_size, 1.0 / font_size);

View file

@ -434,6 +434,27 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
*/
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* XXX: hmm... now I found "intersection_killer" inside xrspline.c
that requires 3 increments. Clearly, we haven't characterized
this completely yet. */
if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
y_intersect++;
/* I think I've found the answer to our problems. The insight is
that everytime we round we are changing the slopes of the
relevant lines, so we may be introducing new intersections that
we miss, so everything breaks apart. John Hobby wrote a paper
on how to fix this:
[Hobby93c] John D. Hobby, Practical Segment Intersection with
Finite Precision Output, Computation Geometry Theory and
Applications, 13(4), 1999.
Available online (2003-08017):
http://cm.bell-labs.com/cm/cs/doc/93/2-27.ps.gz
Now we just need to go off and implement that.
*/
*y_ret = y_intersect;