[cairo-commit] src/cairo-paginated-surface.c src/cairo-pdf-surface.c src/cairo-ps-surface.c
Adrian Johnson
ajohnson at kemper.freedesktop.org
Fri Nov 19 06:29:14 PST 2010
src/cairo-paginated-surface.c | 28 ++++++++++++++++++++++++++++
src/cairo-pdf-surface.c | 10 ++++++++--
src/cairo-ps-surface.c | 6 ++++++
3 files changed, 42 insertions(+), 2 deletions(-)
New commits:
commit e7c5f470436220668e50201d775a9fec47162a67
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Sat Nov 20 00:50:04 2010 +1030
PS/PDF: Fix regression when changing page size to a larger size
https://bugs.freedesktop.org/show_bug.cgi?id=24691
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index af4790e..9e65f7b 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -151,6 +151,34 @@ _cairo_paginated_surface_get_target (cairo_surface_t *surface)
return paginated_surface->target;
}
+cairo_status_t
+_cairo_paginated_surface_set_size (cairo_surface_t *surface,
+ int width,
+ int height)
+{
+ cairo_paginated_surface_t *paginated_surface;
+ cairo_status_t status;
+ cairo_rectangle_t recording_extents;
+
+ assert (_cairo_surface_is_paginated (surface));
+
+ paginated_surface = (cairo_paginated_surface_t *) surface;
+
+ recording_extents.x = 0;
+ recording_extents.y = 0;
+ recording_extents.width = width;
+ recording_extents.height = height;
+
+ cairo_surface_destroy (paginated_surface->recording_surface);
+ paginated_surface->recording_surface = cairo_recording_surface_create (paginated_surface->content,
+ &recording_extents);
+ status = paginated_surface->recording_surface->status;
+ if (unlikely (status))
+ return _cairo_surface_set_error (surface, status);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static cairo_status_t
_cairo_paginated_surface_finish (void *abstract_surface)
{
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 37dad41..ae70a47 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -647,6 +647,7 @@ cairo_pdf_surface_set_size (cairo_surface_t *surface,
double height_in_points)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
+ cairo_status_t status;
if (! _extract_pdf_surface (surface, &pdf_surface))
return;
@@ -654,6 +655,11 @@ cairo_pdf_surface_set_size (cairo_surface_t *surface,
_cairo_pdf_surface_set_size_internal (pdf_surface,
width_in_points,
height_in_points);
+ status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
+ width_in_points,
+ height_in_points);
+ if (status)
+ status = _cairo_surface_set_error (surface, status);
}
static void
@@ -1722,8 +1728,6 @@ _cairo_pdf_surface_finish (void *abstract_surface)
surface->font_subsets = NULL;
}
- _cairo_surface_clipper_reset (&surface->clipper);
-
return status;
}
@@ -3573,6 +3577,8 @@ _cairo_pdf_surface_show_page (void *abstract_surface)
if (unlikely (status))
return status;
+ _cairo_surface_clipper_reset (&surface->clipper);
+
status = _cairo_pdf_surface_write_page (surface);
if (unlikely (status))
return status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 0be68bf..fe20b69 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1328,6 +1328,7 @@ cairo_ps_surface_set_size (cairo_surface_t *surface,
double height_in_points)
{
cairo_ps_surface_t *ps_surface = NULL;
+ cairo_status_t status;
if (! _extract_ps_surface (surface, TRUE, &ps_surface))
return;
@@ -1337,6 +1338,11 @@ cairo_ps_surface_set_size (cairo_surface_t *surface,
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);
+ status = _cairo_paginated_surface_set_size (ps_surface->paginated_surface,
+ width_in_points,
+ height_in_points);
+ if (status)
+ status = _cairo_surface_set_error (surface, status);
}
/**
More information about the cairo-commit
mailing list