[cairo-commit] 3 commits - src/cairo-svg-surface.c

Emmanuel Pacaud emmanuel at kemper.freedesktop.org
Wed May 3 05:54:12 PDT 2006


 src/cairo-svg-surface.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

New commits:
diff-tree e91b2c87ccf75e1c4935f1593dfdd10b1992de34 (from 5336cf5a984cdeb4d4887cd3c643a3e051aca338)
Author: Emmanuel Pacaud <emmanuel.pacaud at free.fr>
Date:   Wed May 3 14:53:25 2006 +0200

    SVG: Emit "svg" version in document_finish.
    
    At least when there's something valid in document->svg_version.

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index a464c3d..6cc5e98 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1693,8 +1693,6 @@ _cairo_svg_document_create (cairo_output
 
     xmlSetProp (node, CC2XML ("xmlns"), CC2XML ("http://www.w3.org/2000/svg"));
     xmlSetProp (node, CC2XML ("xmlns:xlink"), CC2XML ("http://www.w3.org/1999/xlink"));
-    xmlSetProp (node, CC2XML ("version"), 
-	CC2XML (_cairo_svg_internal_version_strings [document->svg_version]));
 
     document->alpha_filter = FALSE;
 
@@ -1754,6 +1752,9 @@ _cairo_svg_document_finish (cairo_svg_do
     if (document->finished)
 	return CAIRO_STATUS_SUCCESS;
 
+    xmlSetProp (document->xml_node_main, CC2XML ("version"), 
+	CC2XML (_cairo_svg_internal_version_strings [document->svg_version]));
+
     xml_output_buffer = xmlOutputBufferCreateIO ((xmlOutputWriteCallback) _cairo_svg_document_write,
 						 (xmlOutputCloseCallback) NULL,
 						 (void *) document->output_stream, 
diff-tree 5336cf5a984cdeb4d4887cd3c643a3e051aca338 (from 57ddc7a8699eac61af2086546130081b897aa3a2)
Author: Emmanuel Pacaud <emmanuel.pacaud at free.fr>
Date:   Wed May 3 14:47:01 2006 +0200

    SVG: Only "comp-op" property when svg_version >= 1.2

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index f3643df..a464c3d 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -800,7 +800,9 @@ emit_composite_pattern (xmlNodePtr node,
 }
 
 static void
-emit_operator (xmlNodePtr node, cairo_operator_t op)
+emit_operator (xmlNodePtr	     node,
+	       cairo_svg_surface_t  *surface, 
+	       cairo_operator_t	     op)
 {
     char const *op_str[] = {
 	"clear",
@@ -815,7 +817,8 @@ emit_operator (xmlNodePtr node, cairo_op
 	"color-dodge"	/* FIXME: saturate ? */
     };
 
-    xmlSetProp (node, CC2XML ("comp-op"), C2XML (op_str[op]));
+    if (surface->document->svg_version >= CAIRO_SVG_VERSION_1_2)
+	xmlSetProp (node, CC2XML ("comp-op"), C2XML (op_str[op]));
 }
 
 static void
@@ -1218,7 +1221,7 @@ _cairo_svg_surface_fill (void			*abstrac
     child = xmlNewChild (surface->xml_node, NULL, CC2XML ("path"), NULL);
     xmlSetProp (child, CC2XML ("d"), xmlBufferContent (info.path));
     xmlSetProp (child, CC2XML ("style"), xmlBufferContent (style));
-    emit_operator (child, op);
+    emit_operator (child, surface, op);
 
     xmlBufferFree (info.path);
     xmlBufferFree (style);
@@ -1274,7 +1277,7 @@ emit_paint (xmlNodePtr		 node,
     _cairo_dtostr (buffer, sizeof buffer, surface->height);
     xmlSetProp (child, CC2XML ("height"), C2XML (buffer));
     xmlSetProp (child, CC2XML ("style"), xmlBufferContent (style));
-    emit_operator (child, op);
+    emit_operator (child, surface, op);
 
     xmlBufferFree (style);
 
@@ -1479,7 +1482,7 @@ _cairo_svg_surface_stroke (void			*abstr
     child = xmlNewChild (surface->xml_node, NULL, CC2XML ("path"), NULL);
     xmlSetProp (child, CC2XML ("d"), xmlBufferContent (info.path));
     xmlSetProp (child, CC2XML ("style"), xmlBufferContent (style));
-    emit_operator (child, op);
+    emit_operator (child, surface, op);
     
     xmlBufferFree (info.path);
     xmlBufferFree (style);
diff-tree 57ddc7a8699eac61af2086546130081b897aa3a2 (from 3ee4bae92071b63ace5570795cf57cb94b06257d)
Author: Emmanuel Pacaud <emmanuel.pacaud at free.fr>
Date:   Wed May 3 14:29:54 2006 +0200

    SVG: Emit correct version property of "svg" element.

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index e06afb7..f3643df 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -67,6 +67,12 @@ static const char * _cairo_svg_version_s
     "SVG 1.2"
 };
 
+static const char * _cairo_svg_internal_version_strings[CAIRO_SVG_VERSION_LAST] =
+{
+    "1.1",
+    "1.2"
+};
+
 struct cairo_svg_document {
     cairo_output_stream_t *output_stream;
     unsigned long refcount;
@@ -1684,7 +1690,8 @@ _cairo_svg_document_create (cairo_output
 
     xmlSetProp (node, CC2XML ("xmlns"), CC2XML ("http://www.w3.org/2000/svg"));
     xmlSetProp (node, CC2XML ("xmlns:xlink"), CC2XML ("http://www.w3.org/1999/xlink"));
-    xmlSetProp (node, CC2XML ("version"), CC2XML ("1.2"));
+    xmlSetProp (node, CC2XML ("version"), 
+	CC2XML (_cairo_svg_internal_version_strings [document->svg_version]));
 
     document->alpha_filter = FALSE;
 


More information about the cairo-commit mailing list