summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2013-08-27 15:10:38 +0200
committerAlexander Larsson <alexl@redhat.com>2013-08-27 15:10:59 +0200
commitbb73eef9499773adb182ba314c9c1a56e10c6952 (patch)
tree7ad066ff1392ffe1a29b6ef9cd47bbefecebd30e
parentdb6c31d793a1d220385fcc61b3e1ce0e10540e1d (diff)
surface: Inherit device scale in cairo_surface_create_similar()ickle-device-scale
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 9bcb5dd0..e1c333bf 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;