[cairo-commit] cairo/src cairo-svg-surface.c,1.3,1.4

Emmanuel Pacaud commit at pdx.freedesktop.org
Mon Dec 19 15:33:35 PST 2005


Committed by: emmanuel

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

Modified Files:
	cairo-svg-surface.c 
Log Message:
2005-12-19  Emmanuel Pacaud <emmanuel.pacaud at free.fr>

	* src/cairo-svg-surface.c (_cairo_svg_surface_stroke): fix stroke
	linewidth and dashes, I hope. Emit stroke-dashoffset.



Index: cairo-svg-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-svg-surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo-svg-surface.c	19 Dec 2005 21:59:35 -0000	1.3
+++ cairo-svg-surface.c	19 Dec 2005 23:33:32 -0000	1.4
@@ -1147,7 +1147,7 @@
     style = xmlBufferCreate ();
     emit_pattern (surface, source, style, 1);
     xmlBufferCat (style, CC2XML ("fill: none; stroke-width: "));
-    _cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0);
+    _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
     xmlBufferCat (style, C2XML (buffer)); 
     xmlBufferCat (style, CC2XML (";"));
     
@@ -1183,10 +1183,18 @@
 	    /* FIXME: Is is really what we want ? */
 	    rx = ry = stroke_style->dash[i];
 	    cairo_matrix_transform_distance (ctm, &rx, &ry);
-	    _cairo_dtostr (buffer, sizeof buffer, (rx + ry) / 2.0);
+	    _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
 	    xmlBufferCat (style, C2XML (buffer));
 	}
 	xmlBufferCat (style, ";");
+	if (stroke_style->dash_offset != 0.0) {
+	    xmlBufferCat (style, CC2XML (" stroke-dashoffset: "));
+	    rx = ry = stroke_style->dash_offset;
+	    cairo_matrix_transform_distance (ctm, &rx, &ry);
+	    _cairo_dtostr (buffer, sizeof buffer, sqrt ((rx * rx + ry * ry) / 2.0));
+	    xmlBufferCat (style, C2XML (buffer));
+	    xmlBufferCat (style, ";");
+	}
     }
 
     xmlBufferCat (style, CC2XML (" stroke-miterlimit: "));



More information about the cairo-commit mailing list