summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2008-03-29 01:07:30 +1030
committerAdrian Johnson <ajohnson@redneon.com>2008-03-29 15:52:37 +1030
commit5b8b3a9765d292d554b50df0981652d3bb4ec56f (patch)
tree226bb080103acb94d0be00079d1a542cb54384c9
parente4fd9b4ea2e8cc378471c4f536236faa73467977 (diff)
PS/PDF: Save/Restore surface clip when emitting a meta-surface pattern
-rw-r--r--src/cairo-pdf-surface.c6
-rw-r--r--src/cairo-ps-surface.c6
-rw-r--r--src/cairo-surface.c6
-rw-r--r--src/cairoint.h3
4 files changed, 21 insertions, 0 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 7dad2f5bf..7b4a83cbc 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1494,6 +1494,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
double old_width, old_height;
cairo_matrix_t old_cairo_to_pdf;
cairo_paginated_mode_t old_paginated_mode;
+ cairo_clip_t *old_clip;
cairo_rectangle_int_t meta_extents;
cairo_status_t status;
int alpha = 0;
@@ -1506,6 +1507,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
old_height = surface->height;
old_cairo_to_pdf = surface->cairo_to_pdf;
old_paginated_mode = surface->paginated_mode;
+ old_clip = _cairo_surface_get_clip (&surface->base);
surface->width = meta_extents.width;
surface->height = meta_extents.height;
/* Patterns are emitted after fallback images. The paginated mode
@@ -1548,6 +1550,10 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
surface->height = old_height;
surface->paginated_mode = old_paginated_mode;
surface->cairo_to_pdf = old_cairo_to_pdf;
+ status = _cairo_surface_set_clip (&surface->base, old_clip);
+ if (status)
+ return status;
+
_cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
&surface->cairo_to_pdf);
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index b77104883..cdef86378 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2030,6 +2030,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
double old_width, old_height;
cairo_matrix_t old_cairo_to_ps;
cairo_content_t old_content;
+ cairo_clip_t *old_clip;
cairo_rectangle_int_t meta_extents;
cairo_status_t status;
@@ -2041,6 +2042,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
old_width = surface->width;
old_height = surface->height;
old_cairo_to_ps = surface->cairo_to_ps;
+ old_clip = _cairo_surface_get_clip (&surface->base);
surface->width = meta_extents.width;
surface->height = meta_extents.height;
cairo_matrix_init (&surface->cairo_to_ps, 1, 0, 0, -1, 0, surface->height);
@@ -2072,6 +2074,10 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
surface->width = old_width;
surface->height = old_height;
surface->cairo_to_ps = old_cairo_to_ps;
+ status = _cairo_surface_set_clip (&surface->base, old_clip);
+ if (status)
+ return status;
+
_cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
&surface->cairo_to_ps);
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 23e79d2ff..a72428345 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1985,6 +1985,12 @@ _cairo_surface_set_empty_clip_path (cairo_surface_t *surface,
return _cairo_surface_set_error (surface, status);
}
+cairo_clip_t *
+_cairo_surface_get_clip (cairo_surface_t *surface)
+{
+ return surface->clip;
+}
+
cairo_status_t
_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
{
diff --git a/src/cairoint.h b/src/cairoint.h
index 9fa4bde97..41d9182eb 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1750,6 +1750,9 @@ _cairo_surface_intersect_clip_path (cairo_surface_t *surface,
double tolerance,
cairo_antialias_t antialias);
+cairo_private cairo_clip_t *
+_cairo_surface_get_clip (cairo_surface_t *surface);
+
cairo_private cairo_status_t
_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip);