[cairo-commit] src/cairo-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Sep 28 08:09:18 PDT 2008


 src/cairo-surface.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 3c18d95b293eddaa25232bc06398c78bc8043cb4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 28 15:57:37 2008 +0100

    Compute device_transform_inverse.
    
    Because we can independently set either the device scale or the device
    offset, we need to be careful and recompute the inverse rather than simply
    assuming that the original contents of the device transform is identity.
    
    Fixes regression https://bugs.launchpad.net/inkscape/+bug/234546.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d3b735f..ea51d2f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -811,10 +811,8 @@ _cairo_surface_set_device_scale (cairo_surface_t *surface,
     surface->device_transform.xy = 0.0;
     surface->device_transform.yx = 0.0;
 
-    surface->device_transform_inverse.xx = 1.0 / sx;
-    surface->device_transform_inverse.yy = 1.0 / sy;
-    surface->device_transform_inverse.xy = 0.0;
-    surface->device_transform_inverse.yx = 0.0;
+    surface->device_transform_inverse = surface->device_transform;
+    cairo_matrix_invert (&surface->device_transform_inverse);
 }
 
 /**
@@ -855,8 +853,8 @@ cairo_surface_set_device_offset (cairo_surface_t *surface,
     surface->device_transform.x0 = x_offset;
     surface->device_transform.y0 = y_offset;
 
-    surface->device_transform_inverse.x0 = - x_offset;
-    surface->device_transform_inverse.y0 = - y_offset;
+    surface->device_transform_inverse = surface->device_transform;
+    cairo_matrix_invert (&surface->device_transform_inverse);
 }
 slim_hidden_def (cairo_surface_set_device_offset);
 


More information about the cairo-commit mailing list