[cairo-commit] libsvg-cairo/src svg-cairo.h, 1.12, 1.13 svg_cairo.c, 1.32, 1.33

Carl Worth commit at pdx.freedesktop.org
Mon Apr 11 12:22:42 PDT 2005


Committed by: cworth

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

Modified Files:
	svg-cairo.h svg_cairo.c 
Log Message:

        * src/svg-cairo.h:
        * src/svg_cairo.c: (svg_cairo_get_size): Use unisgned int for
        width/height.

        * src/svg_cairo.c: (_svg_cairo_begin_group),
        (_svg_cairo_end_group): Preserve CTM over change to target surface
        so that groups with opacity are rendered in the right place.


Index: svg-cairo.h
===================================================================
RCS file: /cvs/cairo/libsvg-cairo/src/svg-cairo.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- svg-cairo.h	2 Aug 2004 20:16:37 -0000	1.12
+++ svg-cairo.h	11 Apr 2005 19:22:40 -0000	1.13
@@ -74,7 +74,9 @@
 svg_cairo_set_viewport_dimension (svg_cairo_t *svg_cairo, unsigned int width, unsigned int height);
 
 void
-svg_cairo_get_size (svg_cairo_t *svg_cairo, int *width, int *height);
+svg_cairo_get_size (svg_cairo_t  *svg_cairo,
+		    unsigned int *width,
+		    unsigned int *height);
 
 #ifdef __cplusplus
 }

Index: svg_cairo.c
===================================================================
RCS file: /cvs/cairo/libsvg-cairo/src/svg_cairo.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- svg_cairo.c	11 Apr 2005 18:27:02 -0000	1.32
+++ svg_cairo.c	11 Apr 2005 19:22:40 -0000	1.33
@@ -357,7 +357,9 @@
 }
 
 void
-svg_cairo_get_size (svg_cairo_t *svg_cairo, int *width, int *height)
+svg_cairo_get_size (svg_cairo_t  *svg_cairo,
+		    unsigned int *width,
+		    unsigned int *height)
 {
     svg_length_t width_len, height_len;
     double width_d, height_d;
@@ -365,8 +367,8 @@
     svg_get_size (svg_cairo->svg, &width_len, &height_len);
     _svg_cairo_length_to_pixel (svg_cairo, &width_len, &width_d);
     _svg_cairo_length_to_pixel (svg_cairo, &height_len, &height_d);
-    *width = (int) (width_d + 0.5);
-    *height = (int) (height_d + 0.5);
+    *width = (unsigned int) (width_d + 0.5);
+    *height = (unsigned int) (height_d + 0.5);
 }
 
 static svg_status_t
@@ -377,11 +379,20 @@
     cairo_save (svg_cairo->cr);
 
     if (opacity != 1.0) {
+	cairo_matrix_t ctm;
+
 	svg_cairo->state->child_surface = cairo_surface_create_similar (cairo_current_target_surface (svg_cairo->cr),
 							    CAIRO_FORMAT_ARGB32,
 							    svg_cairo->state->viewport_width,
 							    svg_cairo->state->viewport_height);
+
+	/* We have to maintain the CTM over cairo_set_target_surface
+	 * which replaces it with an indentity matrix. This will all
+	 * change as cairo_set_target_surface will be removed and
+	 * cairo_begin_group will be added. */
+	cairo_get_matrix (svg_cairo->cr, &ctm);
 	cairo_set_target_surface (svg_cairo->cr, svg_cairo->state->child_surface);
+	cairo_set_matrix (svg_cairo->cr, &ctm);
     }
 
     _svg_cairo_push_state (svg_cairo);
@@ -431,8 +442,9 @@
            will have been applied twice. I'm still a bit fuzzy on
            whether this is the correct approach or if it's masking
            some other problem. */
-	cairo_default_matrix (svg_cairo->cr);
+	cairo_identity_matrix (svg_cairo->cr);
 	cairo_set_alpha (svg_cairo->cr, opacity);
+	cairo_move_to (svg_cairo->cr, 0, 0);
 	cairo_show_surface (svg_cairo->cr, svg_cairo->state->child_surface,
 		       svg_cairo->state->viewport_width, svg_cairo->state->viewport_height);
 	cairo_restore (svg_cairo->cr);




More information about the cairo-commit mailing list