[cairo-commit] src/cairo-pdf-operators.c src/cairo-pdf-operators-private.h src/cairo-pdf-surface.c src/cairo-ps-surface.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Feb 16 19:48:14 PST 2008


 src/cairo-pdf-operators-private.h |    4 ++--
 src/cairo-pdf-operators.c         |    8 ++++----
 src/cairo-pdf-surface.c           |   12 ++++++------
 src/cairo-ps-surface.c            |    9 +++++----
 4 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 1e7fa4b9f5c478bcb7c49667192f239c2bd1d03e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sat Feb 16 22:47:31 2008 -0500

    [cairo-pdf-operators] Pass matrix by reference, not by value

diff --git a/src/cairo-pdf-operators-private.h b/src/cairo-pdf-operators-private.h
index c603237..fe4b842 100644
--- a/src/cairo-pdf-operators-private.h
+++ b/src/cairo-pdf-operators-private.h
@@ -60,7 +60,7 @@ typedef struct _cairo_pdf_operators {
 cairo_private void
 _cairo_pdf_operators_init (cairo_pdf_operators_t       *pdf_operators,
 			   cairo_output_stream_t       *stream,
-			   cairo_matrix_t 		cairo_to_pdf,
+			   cairo_matrix_t 	       *cairo_to_pdf,
 			   cairo_scaled_font_subsets_t *font_subsets);
 
 cairo_private void
@@ -78,7 +78,7 @@ _cairo_pdf_operators_set_stream (cairo_pdf_operators_t 	 *pdf_operators,
 
 cairo_private void
 _cairo_pdf_operators_set_cairo_to_pdf_matrix (cairo_pdf_operators_t *pdf_operators,
-					      cairo_matrix_t 	     cairo_to_pdf);
+					      cairo_matrix_t 	    *cairo_to_pdf);
 
 cairo_private cairo_int_status_t
 _cairo_pdf_operators_clip (cairo_pdf_operators_t 	*pdf_operators,
diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index 3564e29..d998619 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -50,11 +50,11 @@
 void
 _cairo_pdf_operators_init (cairo_pdf_operators_t	*pdf_operators,
 			   cairo_output_stream_t	*stream,
-			   cairo_matrix_t		 cairo_to_pdf,
+			   cairo_matrix_t		*cairo_to_pdf,
 			   cairo_scaled_font_subsets_t  *font_subsets)
 {
     pdf_operators->stream = stream;
-    pdf_operators->cairo_to_pdf = cairo_to_pdf;
+    pdf_operators->cairo_to_pdf = *cairo_to_pdf;
     pdf_operators->font_subsets = font_subsets;
     pdf_operators->use_font_subset = NULL;
     pdf_operators->use_font_subset_closure = NULL;
@@ -83,9 +83,9 @@ _cairo_pdf_operators_set_stream (cairo_pdf_operators_t	 *pdf_operators,
 
 void
 _cairo_pdf_operators_set_cairo_to_pdf_matrix (cairo_pdf_operators_t *pdf_operators,
-					      cairo_matrix_t	     cairo_to_pdf)
+					      cairo_matrix_t	    *cairo_to_pdf)
 {
-    pdf_operators->cairo_to_pdf = cairo_to_pdf;
+    pdf_operators->cairo_to_pdf = *cairo_to_pdf;
 }
 
 /* A word wrap stream can be used as a filter to do word wrapping on
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 4604e04..26fc8c1 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -270,7 +270,7 @@ _cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t	*output,
 
     _cairo_pdf_operators_init (&surface->pdf_operators,
 			       surface->output,
-			       surface->cairo_to_pdf,
+			       &surface->cairo_to_pdf,
 			       surface->font_subsets);
     _cairo_pdf_operators_set_font_subsets_callback (&surface->pdf_operators,
 						    _cairo_pdf_surface_add_font,
@@ -439,7 +439,7 @@ cairo_pdf_surface_set_size (cairo_surface_t	*surface,
     pdf_surface->height = height_in_points;
     cairo_matrix_init (&pdf_surface->cairo_to_pdf, 1, 0, 0, -1, 0, height_in_points);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&pdf_surface->pdf_operators,
-						  pdf_surface->cairo_to_pdf);
+						  &pdf_surface->cairo_to_pdf);
     status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
 						width_in_points,
 						height_in_points);
@@ -1513,7 +1513,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     surface->paginated_mode = CAIRO_PAGINATED_MODE_RENDER;
     cairo_matrix_init (&surface->cairo_to_pdf, 1, 0, 0, -1, 0, surface->height);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_pdf);
+						  &surface->cairo_to_pdf);
 
     _cairo_pdf_group_resources_clear (&surface->resources);
     status = _cairo_pdf_surface_open_content_stream (surface, TRUE);
@@ -1547,7 +1547,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     surface->paginated_mode = old_paginated_mode;
     surface->cairo_to_pdf = old_cairo_to_pdf;
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_pdf);
+						  &surface->cairo_to_pdf);
 
     return status;
 }
@@ -3825,7 +3825,7 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t     *surface,
     surface->height = group->height;
     cairo_matrix_init (&surface->cairo_to_pdf, 1, 0, 0, -1, 0, surface->height);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_pdf);
+						  &surface->cairo_to_pdf);
 
     /* _mask is a special case that requires two groups - source
      * and mask as well as a smask and gstate dictionary */
@@ -3881,7 +3881,7 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t     *surface,
     surface->height = old_height;
     surface->cairo_to_pdf = old_cairo_to_pdf;
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_pdf);
+						  &surface->cairo_to_pdf);
 
     return status;
 }
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 45f8686..428b042 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -43,6 +43,7 @@
 #include "cairoint.h"
 #include "cairo-ps.h"
 #include "cairo-ps-surface-private.h"
+#include "cairo-pdf-operators-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-paginated-private.h"
 #include "cairo-meta-surface-private.h"
@@ -730,7 +731,7 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream,
 
     _cairo_pdf_operators_init (&surface->pdf_operators,
 			       surface->stream,
-			       surface->cairo_to_ps,
+			       &surface->cairo_to_ps,
 			       surface->font_subsets);
     surface->num_pages = 0;
 
@@ -1040,7 +1041,7 @@ cairo_ps_surface_set_size (cairo_surface_t	*surface,
     ps_surface->height = height_in_points;
     cairo_matrix_init (&ps_surface->cairo_to_ps, 1, 0, 0, -1, 0, height_in_points);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&ps_surface->pdf_operators,
-						  ps_surface->cairo_to_ps);
+						  &ps_surface->cairo_to_ps);
     status = _cairo_paginated_surface_set_size (ps_surface->paginated_surface,
 						width_in_points,
 						height_in_points);
@@ -2077,7 +2078,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
     surface->height = meta_extents.height;
     cairo_matrix_init (&surface->cairo_to_ps, 1, 0, 0, -1, 0, surface->height);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_ps);
+						  &surface->cairo_to_ps);
     _cairo_output_stream_printf (surface->stream,
 				 "  gsave\n"
 				 "  0 0 %f %f rectclip\n",
@@ -2105,7 +2106,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
     surface->height = old_height;
     surface->cairo_to_ps = old_cairo_to_ps;
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
-						  surface->cairo_to_ps);
+						  &surface->cairo_to_ps);
 
     return CAIRO_STATUS_SUCCESS;
 }


More information about the cairo-commit mailing list