[cairo-commit] cairo-demo/png ChangeLog, 1.20, 1.21 snapping.c, 1.4, 1.5

Carl Worth commit at pdx.freedesktop.org
Wed Nov 3 18:52:08 PST 2004


Committed by: cworth

Update of /cvs/cairo/cairo-demo/png
In directory gabe:/tmp/cvs-serv24699

Modified Files:
	ChangeLog snapping.c 
Log Message:

        * snapping.c (snap_point_for_fill): Fix typo snapping y to x.
        (snap_line_width): Fix to maintain sign of width when clamping to
        maintain >= 1.0. Without this, a reflective transformation would
        cause the width to go negative and the line would disappear.


Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/ChangeLog,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- ChangeLog	3 Nov 2004 21:03:12 -0000	1.20
+++ ChangeLog	4 Nov 2004 02:52:06 -0000	1.21
@@ -1,6 +1,9 @@
 2004-11-03  Carl Worth  <cworth at cworth.org>
 
 	* snapping.c (snap_point_for_fill): Fix typo snapping y to x.
+	(snap_line_width): Fix to maintain sign of width when clamping to
+	maintain >= 1.0. Without this, a reflective transformation would
+	cause the width to go negative and the line would disappear.
 
 2004-10-25  Carl Worth  <cworth at cworth.org>
 

Index: snapping.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/png/snapping.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- snapping.c	3 Nov 2004 21:03:12 -0000	1.4
+++ snapping.c	4 Nov 2004 02:52:06 -0000	1.5
@@ -124,13 +124,24 @@
 
     cairo_transform_distance (cr, &x_width, &y_width);
 
+    /* If the line width is less than 1 then it will round to 0 and
+     * disappear. Instead, we clamp it to 1.0, but we must preserve
+     * its sign for the case of a reflecting transformation. */
     x_width_snapped = floor (x_width + 0.5);
-    if (x_width_snapped < 1.0)
-	x_width_snapped = 1.0;
+    if (fabs(x_width_snapped) < 1.0) {
+	if (x_width > 0)
+	    x_width_snapped = 1.0;
+	else
+	    x_width_snapped = -1.0;
+    }
 
     y_width_snapped = floor (y_width + 0.5);
-    if (y_width_snapped < 1.0)
-	y_width_snapped = 1.0;
+    if (fabs(y_width_snapped) < 1.0) {
+	if (y_width > 0)
+	    y_width_snapped = 1.0;
+	else
+	    y_width_snapped = -1.0;
+    }
 
     x_error = fabs (x_width - x_width_snapped);
     y_error = fabs (y_width - y_width_snapped);




More information about the cairo-commit mailing list