diff options
author | Benjamin Otte <otte@redhat.com> | 2010-10-17 20:45:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:50:01 +0800 |
commit | 03ae3f4218996820a2008403d263dac7bca0f516 (patch) | |
tree | 1b81ae2e7a53550f13a9196b1b9d0c87fd2e73e0 | |
parent | 52b33dea0d0ce9e6387b5e596adf18ce21491a0f (diff) | |
download | gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar.gz gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar.bz2 gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar.lz gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar.xz gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.tar.zst gsoc2013-evolution-03ae3f4218996820a2008403d263dac7bca0f516.zip |
gnome-canvas: Convert point tranformation functions to use cairo
-rw-r--r-- | libgnomecanvas/gnome-canvas.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c index e70a4bbe69..16c16512f9 100644 --- a/libgnomecanvas/gnome-canvas.c +++ b/libgnomecanvas/gnome-canvas.c @@ -3645,19 +3645,17 @@ gnome_canvas_c2w_matrix (GnomeCanvas *canvas, cairo_matrix_t *matrix) void gnome_canvas_w2c (GnomeCanvas *canvas, gdouble wx, gdouble wy, gint *cx, gint *cy) { - gdouble affine[6]; - ArtPoint w, c; + cairo_matrix_t w2c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); - gnome_canvas_w2c_affine (canvas, affine); - w.x = wx; - w.y = wy; - art_affine_point (&c, &w, affine); + gnome_canvas_w2c_matrix (canvas, &w2c); + cairo_matrix_transform_point (&w2c, &wx, &wy); + if (cx) - *cx = floor (c.x + 0.5); + *cx = floor (wx + 0.5); if (cy) - *cy = floor (c.y + 0.5); + *cy = floor (wy + 0.5); } /** @@ -3679,19 +3677,17 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, gdouble *cx, gdouble *cy) { - gdouble affine[6]; - ArtPoint w, c; + cairo_matrix_t w2c; g_return_if_fail (GNOME_IS_CANVAS (canvas)); - gnome_canvas_w2c_affine (canvas, affine); - w.x = wx; - w.y = wy; - art_affine_point (&c, &w, affine); + gnome_canvas_w2c_matrix (canvas, &w2c); + cairo_matrix_transform_point (&w2c, &wx, &wy); + if (cx) - *cx = c.x; + *cx = wx; if (cy) - *cy = c.y; + *cy = wy; } /** @@ -3707,20 +3703,20 @@ gnome_canvas_w2c_d (GnomeCanvas *canvas, void gnome_canvas_c2w (GnomeCanvas *canvas, gint cx, gint cy, gdouble *wx, gdouble *wy) { - gdouble affine[6], inv[6]; - ArtPoint w, c; + cairo_matrix_t c2w; + double x, y; g_return_if_fail (GNOME_IS_CANVAS (canvas)); - gnome_canvas_w2c_affine (canvas, affine); - art_affine_invert (inv, affine); - c.x = cx; - c.y = cy; - art_affine_point (&w, &c, inv); + x = cx; + y = cy; + gnome_canvas_c2w_matrix (canvas, &c2w); + cairo_matrix_transform_point (&c2w, &x, &y); + if (wx) - *wx = w.x; + *wx = x; if (wy) - *wy = w.y; + *wy = y; } /** |