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

Adrian Johnson ajohnson at kemper.freedesktop.org
Mon Aug 29 04:58:58 PDT 2011


 src/cairo-pdf-surface.c |    6 ++++++
 src/cairo-ps-surface.c  |   14 ++++++++++++++
 2 files changed, 20 insertions(+)

New commits:
commit c317e215fb743e81b82f359022b845ddee4c97ba
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Mon Aug 29 21:27:23 2011 +0930

    ps/pdf: use a new clipper object when emitting a recording surface

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 001e8b8..2febca8 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2376,6 +2376,7 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t  *surface,
 {
     double old_width, old_height;
     cairo_paginated_mode_t old_paginated_mode;
+    cairo_surface_clipper_t old_clipper;
     cairo_rectangle_int_t recording_extents;
     cairo_int_status_t status;
     int alpha = 0;
@@ -2398,6 +2399,9 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t  *surface,
     old_width = surface->width;
     old_height = surface->height;
     old_paginated_mode = surface->paginated_mode;
+    old_clipper = surface->clipper;
+    _cairo_surface_clipper_init (&surface->clipper,
+				 _cairo_pdf_surface_clipper_intersect_clip_path);
 
     _cairo_pdf_surface_set_size_internal (surface,
 					  recording_extents.width,
@@ -2434,6 +2438,8 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t  *surface,
 
     status = _cairo_pdf_surface_close_content_stream (surface);
 
+    _cairo_surface_clipper_reset (&surface->clipper);
+    surface->clipper = old_clipper;
     _cairo_pdf_surface_set_size_internal (surface,
 					  old_width,
 					  old_height);
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 8e9dae4..3a74b7c 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2533,6 +2533,7 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface,
     cairo_matrix_t old_cairo_to_ps;
     cairo_content_t old_content;
     cairo_rectangle_int_t old_page_bbox;
+    cairo_surface_clipper_t old_clipper;
     cairo_box_t bbox;
     cairo_int_status_t status;
 
@@ -2541,6 +2542,9 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface,
     old_height = surface->height;
     old_page_bbox = surface->page_bbox;
     old_cairo_to_ps = surface->cairo_to_ps;
+    old_clipper = surface->clipper;
+    _cairo_surface_clipper_init (&surface->clipper,
+				 _cairo_ps_surface_clipper_intersect_clip_path);
 
     if (_cairo_surface_is_snapshot (recording_surface))
 	recording_surface = _cairo_surface_snapshot_get_target (recording_surface);
@@ -2595,6 +2599,9 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface,
 	return status;
 
     _cairo_output_stream_printf (surface->stream, "  Q\n");
+
+    _cairo_surface_clipper_reset (&surface->clipper);
+    surface->clipper = old_clipper;
     surface->content = old_content;
     surface->width = old_width;
     surface->height = old_height;
@@ -2618,6 +2625,7 @@ _cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface,
     cairo_matrix_t old_cairo_to_ps;
     cairo_content_t old_content;
     cairo_rectangle_int_t old_page_bbox;
+    cairo_surface_clipper_t old_clipper;
     cairo_int_status_t status;
 
     old_content = surface->content;
@@ -2625,6 +2633,9 @@ _cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface,
     old_height = surface->height;
     old_page_bbox = surface->page_bbox;
     old_cairo_to_ps = surface->cairo_to_ps;
+    old_clipper = surface->clipper;
+    _cairo_surface_clipper_init (&surface->clipper,
+				 _cairo_ps_surface_clipper_intersect_clip_path);
 
 #if DEBUG_PS
     _cairo_output_stream_printf (surface->stream,
@@ -2670,6 +2681,9 @@ _cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface,
 	return status;
 
     _cairo_output_stream_printf (surface->stream, "  Q\n");
+
+    _cairo_surface_clipper_reset (&surface->clipper);
+    surface->clipper = old_clipper;
     surface->content = old_content;
     surface->width = old_width;
     surface->height = old_height;


More information about the cairo-commit mailing list