summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-05-30 20:53:15 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-05 16:08:19 +0100
commit25eaec0a3874a2090e1bb97547a328eb5c00b0b1 (patch)
treec7bc6146ef23bb6f8da3546380b580afcb691875
parent633d573889ad685c8f07e9ee72f6a1d240dfacf2 (diff)
subsurface: Handle device scales
-rw-r--r--src/cairo-surface-subsurface.c21
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 */