summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-08-27 15:10:38 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-05 16:11:10 +0100
commit935c64a43409a80d9b19d491f9133004152de9bb (patch)
tree7f73580fb4545a3fac32a7b872eab0ceb95dffb7
parentbc792a5e0e196dd9761649b14c9206465b42ef1d (diff)
surface: Inherit device scale in cairo_surface_create_similar()
Without this most code that uses similar surfaces for offscreen rendering will render in a pixelized fashion if the final target uses a device scale.
-rw-r--r--src/cairo-surface.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index cdd75b82e..f2f2ef61e 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -507,6 +507,10 @@ cairo_surface_create_similar (cairo_surface_t *other,
if (unlikely (other->status))
return _cairo_surface_create_in_error (other->status);
+ /* We inherit the device scale, so create a larger surface */
+ width = width * other->device_transform.xx;
+ height = height * other->device_transform.yy;
+
surface = NULL;
if (other->backend->create_similar)
surface = other->backend->create_similar (other, content, width, height);
@@ -519,6 +523,9 @@ cairo_surface_create_similar (cairo_surface_t *other,
return surface;
_cairo_surface_copy_similar_properties (surface, other);
+ cairo_surface_set_device_scale (surface,
+ other->device_transform.xx,
+ other->device_transform.yy);
if (unlikely (surface->status))
return surface;