diff options
Diffstat (limited to 'src/cairo-surface-subsurface.c')
-rw-r--r--[-rwxr-xr-x] | src/cairo-surface-subsurface.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c index 0b4915e7e..5c55ac12f 100755..100644 --- a/src/cairo-surface-subsurface.c +++ b/src/cairo-surface-subsurface.c @@ -354,10 +354,11 @@ _cairo_surface_subsurface_snapshot (void *abstract_surface) TRACE ((stderr, "%s: target=%d\n", __FUNCTION__, surface->target->unique_id)); - clone = _cairo_surface_create_similar_scratch (surface->target, - surface->target->content, - surface->extents.width, - surface->extents.height); + clone = _cairo_surface_create_scratch (surface->target, + surface->target->content, + surface->extents.width, + surface->extents.height, + NULL); if (unlikely (clone->status)) return clone; @@ -468,7 +469,12 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target, if (unlikely (surface == NULL)) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); - assert (_cairo_matrix_is_translation (&target->device_transform)); + x *= target->device_transform.xx; + y *= target->device_transform.yy; + + width *= target->device_transform.xx; + height *= target->device_transform.yy; + x += target->device_transform.x0; y += target->device_transform.y0; @@ -498,6 +504,10 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target, surface->snapshot = NULL; + cairo_surface_set_device_scale (&surface->base, + target->device_transform.xx, + target->device_transform.yy); + return &surface->base; } @@ -518,14 +528,16 @@ _cairo_surface_create_for_rectangle_int (cairo_surface_t *target, if (unlikely (surface == NULL)) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); - assert (_cairo_matrix_is_translation (&target->device_transform)); - _cairo_surface_init (&surface->base, &_cairo_surface_subsurface_backend, NULL, /* device */ target->content); surface->extents = *extents; + surface->extents.x *= target->device_transform.xx; + surface->extents.y *= target->device_transform.yy; + surface->extents.width *= target->device_transform.xx; + surface->extents.height *= target->device_transform.yy; surface->extents.x += target->device_transform.x0; surface->extents.y += target->device_transform.y0; @@ -534,6 +546,10 @@ _cairo_surface_create_for_rectangle_int (cairo_surface_t *target, surface->snapshot = NULL; + cairo_surface_set_device_scale (&surface->base, + target->device_transform.xx, + target->device_transform.yy); + return &surface->base; } /* XXX observe mark-dirty */ |