summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-06-10 08:19:41 -0700
committerCarl Worth <cworth@cworth.org>2006-06-10 08:19:41 -0700
commit6efeb1e19b4c30d6a88bd9248a1d67b791b8df0d (patch)
tree3f501b0d42ce8a94b27664eb6b8886fb82a06911 /src/cairo-surface.c
parentb129f747c5c7edc37982f286940d3583c74cfee9 (diff)
Hook up device scaling so fallback_resolution starts working.
Add new, private _cairo_surface_set_device_scale for getting at the scaling components of device_transform. Use this in paginated surface when replaying to an image surface. The fallback-resolution test now clearly shows that image fallback resolution can be controlled by the user. Hurrah!
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r--src/cairo-surface.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index ad0fe50c..41ac6540 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -612,6 +612,45 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
}
/**
+ * _cairo_surface_set_device_scale:
+ * @surface: a #cairo_surface_t
+ * @sx: a scale factor in the X direction
+ * @sy: a scale factor in the Y direction
+ *
+ * Private function for setting an extra scale factor to affect all
+ * drawing to a surface. This is used, for example, when replaying a
+ * meta surface to an image fallback intended for an eventual
+ * vector-oriented backend. Since the meta surface will record
+ * coordinates in one backend space, but the image fallback uses a
+ * different backend space, (differing by the fallback resolution
+ * scale factors), we need a scale factor correction.
+ *
+ * Caution: There is no guarantee that a surface with both a
+ * device_scale and a device_offset will be treated in consistent
+ * fashion. So, for now, just don't do that. (And we'll need to
+ * examine this issue in more detail if we were to ever want to export
+ * support for device scaling.)
+ **/
+void
+_cairo_surface_set_device_scale (cairo_surface_t *surface,
+ double sx,
+ double sy)
+{
+ assert (! surface->is_snapshot);
+
+ if (surface->status)
+ return;
+
+ if (surface->finished) {
+ _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED);
+ return;
+ }
+
+ surface->device_transform.xx = sx;
+ surface->device_transform.yy = sy;
+}
+
+/**
* cairo_surface_set_device_offset:
* @surface: a #cairo_surface_t
* @x_offset: the offset in the X direction, in device units