[Commit] cairo/src .cvsignore,1.2,1.3 cairo_traps.c,1.5,1.6

Carl Worth commit at keithp.com
Fri Jul 25 14:29:10 PDT 2003


Committed by: cworth

Update of /local/src/CVS/cairo/src
In directory home.keithp.com:/tmp/cvs-serv14197/src

Modified Files:
	.cvsignore cairo_traps.c 
Log Message:
Fix error correction on intersection test to avoid needless spinning.

Index: .cvsignore
===================================================================
RCS file: /local/src/CVS/cairo/src/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- .cvsignore	21 Apr 2003 19:46:41 -0000	1.2
+++ .cvsignore	25 Jul 2003 20:29:08 -0000	1.3
@@ -4,3 +4,4 @@
 Makefile.in
 *.la
 *.lo
+*.loT

Index: cairo_traps.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo_traps.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo_traps.c	24 Jul 2003 08:40:16 -0000	1.5
+++ cairo_traps.c	25 Jul 2003 20:29:08 -0000	1.6
@@ -59,8 +59,7 @@
 _compute_x_intercept (XLineFixed *l, double inverse_slope);
 
 static XFixed
-_line_segs_intersect_ceil (XLineFixed *left, XLineFixed *right,
-			   XFixed *y_ret);
+_line_segs_intersect_ceil (XLineFixed *left, XLineFixed *right, XFixed *y_ret);
 
 void
 cairo_traps_init (cairo_traps_t *traps)
@@ -413,7 +412,11 @@
 	l2 = t;
     }
 
-    while (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
+    /* Assuming 56 bits of floating point precision, the intersection
+       is accurate within one sub-pixel coordinate. We must ensure
+       that we return a value that is at or after the intersection. At
+       most, we must increment once. */
+    if (_compute_x (l2, y_intersect) > _compute_x (l1, y_intersect))
 	y_intersect++;
 
     *y_ret = y_intersect;




More information about the Commit mailing list