diff options
Diffstat (limited to 'src/cairo-recording-surface.c')
-rw-r--r-- | src/cairo-recording-surface.c | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c index 79d51e8..ce8a95a 100644 --- a/src/cairo-recording-surface.c +++ b/src/cairo-recording-surface.c @@ -54,12 +54,12 @@ * operations applied to the recording surface had instead been applied to the * target surface, you can use code like this: * <informalexample><programlisting> - * cairo_t *cr; + * cairo_t *cr; * - * cr = cairo_create (target); - * cairo_set_source_surface (cr, recording_surface, 0.0, 0.0); - * cairo_paint (cr); - * cairo_destroy (cr); + * cr = cairo_create (target); + * cairo_set_source_surface (cr, recording_surface, 0.0, 0.0); + * cairo_paint (cr); + * cairo_destroy (cr); * </programlisting></informalexample> * * A recording surface is logically unbounded, i.e. it has no implicit constraint @@ -249,13 +249,16 @@ _cairo_recording_surface_finish (void *abstract_surface) } static cairo_status_t -_cairo_recording_surface_acquire_source_image (void *abstract_surface, - cairo_image_surface_t **image_out, - void **image_extra) +_cairo_recording_surface_acquire_source_image_transformed (void *abstract_surface, + cairo_matrix_t *device_transform, + cairo_image_surface_t **image_out, + void **image_extra) { cairo_status_t status; cairo_recording_surface_t *surface = abstract_surface; cairo_surface_t *image; + double width; + double height; image = _cairo_surface_has_snapshot (&surface->base, &_cairo_image_surface_backend); @@ -265,9 +268,10 @@ _cairo_recording_surface_acquire_source_image (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } + width = surface->extents.width * device_transform->xx; + height = surface->extents.height * device_transform->yy; image = _cairo_image_surface_create_with_content (surface->content, - surface->extents.width, - surface->extents.height); + width, height); if (unlikely (image->status)) return image->status; @@ -275,6 +279,8 @@ _cairo_recording_surface_acquire_source_image (void *abstract_surface, -surface->extents.x, -surface->extents.y); + _cairo_surface_set_device_scale (image, + device_transform->xx, device_transform->yy); status = _cairo_recording_surface_replay (&surface->base, image); if (unlikely (status)) { cairo_surface_destroy (image); @@ -288,6 +294,19 @@ _cairo_recording_surface_acquire_source_image (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } +static cairo_status_t +_cairo_recording_surface_acquire_source_image (void *abstract_surface, + cairo_image_surface_t **image_out, + void **image_extra) +{ + cairo_matrix_t identity; + + cairo_matrix_init_identity (&identity); + + return _cairo_recording_surface_acquire_source_image_transformed ( + abstract_surface, &identity, image_out, image_extra); +} + static void _cairo_recording_surface_release_source_image (void *abstract_surface, cairo_image_surface_t *image, @@ -729,7 +748,8 @@ static const cairo_surface_backend_t cairo_recording_surface_backend = { NULL, /* can_repaint_solid_pattern_surface */ _cairo_recording_surface_has_show_text_glyphs, - _cairo_recording_surface_show_text_glyphs + _cairo_recording_surface_show_text_glyphs, + _cairo_recording_surface_acquire_source_image_transformed }; cairo_int_status_t @@ -781,7 +801,7 @@ _cairo_recording_surface_get_path (cairo_surface_t *surface, case CAIRO_COMMAND_FILL: { status = _cairo_path_fixed_append (path, - &command->fill.path, CAIRO_DIRECTION_FORWARD, + &command->fill.path, 0, 0); break; } @@ -898,8 +918,8 @@ _cairo_recording_surface_replay_internal (cairo_surface_t *surface, if (stroke_command != NULL && stroke_command->header.type == CAIRO_COMMAND_STROKE && - _cairo_path_fixed_is_equal (&command->fill.path, - &stroke_command->stroke.path)) + _cairo_path_fixed_equal (&command->fill.path, + &stroke_command->stroke.path)) { status = _cairo_surface_wrapper_fill_stroke (&wrapper, command->header.op, |