[evolution/rendering-cleanup: 52/97] gnome-canvas: Convert point tranformation functions to use cairo
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/rendering-cleanup: 52/97] gnome-canvas: Convert point tranformation functions to use cairo
- Date: Thu, 21 Oct 2010 09:48:25 +0000 (UTC)
commit d72fed6e28683b25923748f96afd36530bbdf3a9
Author: Benjamin Otte <otte redhat com>
Date: Sun Oct 17 14:45:23 2010 +0200
gnome-canvas: Convert point tranformation functions to use cairo
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 c790989..be546be 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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]