diff options
Diffstat (limited to 'src/cairo-surface-subsurface.c')
| -rw-r--r-- | src/cairo-surface-subsurface.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c index 051e95f24..712c0fe9c 100644 --- a/src/cairo-surface-subsurface.c +++ b/src/cairo-surface-subsurface.c @@ -465,7 +465,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; @@ -495,6 +500,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; } @@ -515,14 +524,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; @@ -531,6 +542,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 */ |
