[cairo-commit] cairo/src cairo-path-stroke.c,1.27,1.28

Carl Worth commit at pdx.freedesktop.org
Tue Sep 27 12:44:34 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv30217/src

Modified Files:
	cairo-path-stroke.c 
Log Message:

2005-09-27  Carl Worth  <cworth at cworth.org>

        * ROADMAP: Note that bug #4409 (Dashes are missing initial caps)
        is now fixed.

        * src/cairo-path-stroke.c: (_cairo_stroker_add_cap),
        (_cairo_stroker_add_leading_cap),
        (_cairo_stroker_add_trailing_cap),
        (_cairo_stroker_add_caps): Move face-flipping from inside
        _cairo_stroker_add_caps to new _cairo_stroker_add_leading_cap
        variant of _cairo_stoker_add_cap.

        * src/cairo-path-stroke.c: (_cairo_stroker_line_to_dashed): Change
        to call _cairo_stroker_add_leading_cap or
        _cairo_stroker_add_trailing_cap as appropriate.

        * test/Makefile.am (XFAIL_TESTS):
        * test/dash-caps-joins-ref.png:
        * test/dash-caps-joins.c: (main): Remove dash-caps-joins from the
        XFAIL list and add reference image.


Index: cairo-path-stroke.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-stroke.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cairo-path-stroke.c	16 Sep 2005 17:49:49 -0000	1.27
+++ cairo-path-stroke.c	27 Sep 2005 19:44:32 -0000	1.28
@@ -341,7 +341,7 @@
 }
 
 static cairo_status_t
-_cairo_stroker_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
+_cairo_stroker_add_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
 {
     cairo_status_t	    status;
     cairo_gstate_t	    *gstate = stroker->gstate;
@@ -412,27 +412,46 @@
 }
 
 static cairo_status_t
+_cairo_stroker_add_leading_cap (cairo_stroker_t     *stroker,
+				cairo_stroke_face_t *face)
+{
+    cairo_stroke_face_t reversed;
+    cairo_point_t t;
+
+    reversed = *face;
+
+    /* The initial cap needs an outward facing vector. Reverse everything */
+    reversed.usr_vector.x = -reversed.usr_vector.x;
+    reversed.usr_vector.y = -reversed.usr_vector.y;
+    reversed.dev_vector.dx = -reversed.dev_vector.dx;
+    reversed.dev_vector.dy = -reversed.dev_vector.dy;
+    t = reversed.cw;
+    reversed.cw = reversed.ccw;
+    reversed.ccw = t;
+
+    return _cairo_stroker_add_cap (stroker, &reversed);
+}
+
+static cairo_status_t
+_cairo_stroker_add_trailing_cap (cairo_stroker_t     *stroker,
+				 cairo_stroke_face_t *face)
+{
+    return _cairo_stroker_add_cap (stroker, face);
+}
+
+static cairo_status_t
 _cairo_stroker_add_caps (cairo_stroker_t *stroker)
 {
     cairo_status_t status;
 
     if (stroker->has_first_face) {
-	cairo_point_t t;
-	/* The initial cap needs an outward facing vector. Reverse everything */
-	stroker->first_face.usr_vector.x = -stroker->first_face.usr_vector.x;
-	stroker->first_face.usr_vector.y = -stroker->first_face.usr_vector.y;
-	stroker->first_face.dev_vector.dx = -stroker->first_face.dev_vector.dx;
-	stroker->first_face.dev_vector.dy = -stroker->first_face.dev_vector.dy;
-	t = stroker->first_face.cw;
-	stroker->first_face.cw = stroker->first_face.ccw;
-	stroker->first_face.ccw = t;
-	status = _cairo_stroker_cap (stroker, &stroker->first_face);
+	status = _cairo_stroker_add_leading_cap (stroker, &stroker->first_face);
 	if (status)
 	    return status;
     }
 
     if (stroker->has_current_face) {
-	status = _cairo_stroker_cap (stroker, &stroker->current_face);
+	status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face);
 	if (status)
 	    return status;
     }
@@ -673,7 +692,7 @@
 		/*
 		 * Not first dash in this segment, cap start
 		 */
-		status = _cairo_stroker_cap (stroker, &sub_start);
+		status = _cairo_stroker_add_leading_cap (stroker, &sub_start);
 		if (status)
 		    return status;
 	    } else {
@@ -691,7 +710,7 @@
 			stroker->first_face = sub_start;
 			stroker->has_first_face = 1;
 		    } else {
-			status = _cairo_stroker_cap (stroker, &sub_start);
+			status = _cairo_stroker_add_leading_cap (stroker, &sub_start);
 			if (status)
 			    return status;
 		    }
@@ -701,7 +720,7 @@
 		/*
 		 * Cap if not at end of segment
 		 */
-		status = _cairo_stroker_cap (stroker, &sub_end);
+		status = _cairo_stroker_add_trailing_cap (stroker, &sub_end);
 		if (status)
 		    return status;
 	    } else {
@@ -719,7 +738,7 @@
 	     */
 	    if (first) {
 		if (stroker->has_current_face) {
-		    status = _cairo_stroker_cap (stroker, &stroker->current_face);
+		    status = _cairo_stroker_add_trailing_cap (stroker, &stroker->current_face);
 		    if (status)
 			return status;
 		}



More information about the cairo-commit mailing list