From 23b1a82e88aab0413f832dbf445df5e302f1c30a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 14 Aug 2011 10:25:29 +0100 Subject: pdf: If the recording surface is unbounded, limit the pattern to the ink extents It is better than crashing! Signed-off-by: Chris Wilson --- src/cairo-pdf-surface.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 3a4a4025..89cb044a 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -2377,16 +2377,23 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t *surface, double old_width, old_height; cairo_paginated_mode_t old_paginated_mode; cairo_rectangle_int_t recording_extents; - cairo_bool_t is_bounded; cairo_int_status_t status; int alpha = 0; if (_cairo_surface_is_snapshot (source)) source = _cairo_surface_snapshot_get_target (source); - is_bounded = _cairo_surface_get_extents (source, - &recording_extents); - assert (is_bounded); + if (! _cairo_surface_get_extents (source, &recording_extents)) { + cairo_box_t bbox; + + status = + _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) source, + &bbox, NULL); + if (unlikely (status)) + return status; + + _cairo_box_round_to_rectangle (&bbox, &recording_extents); + } old_width = surface->width; old_height = surface->height; -- cgit v1.2.3