diff options
author | Benjamin Otte <otte@redhat.com> | 2010-10-17 20:15:07 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-30 01:50:01 +0800 |
commit | 8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c (patch) | |
tree | ea7ed366b9288173e7e6cbc8cd3766cfad31f1ba /widgets/misc/e-canvas.c | |
parent | 7fe898ab0f07b516b6472a78ea1583c4cf014233 (diff) | |
download | gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.gz gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.tar.zst gsoc2013-evolution-8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c.zip |
gnome-canvas: Convert canvas item transformation matrix to cairo
Also update the GnomeCanvasItem.update vfunc to take a cairo_matrix_t
and no longer pass the clip_path (what was it used for anyway?).
Diffstat (limited to 'widgets/misc/e-canvas.c')
-rw-r--r-- | widgets/misc/e-canvas.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c index 0b24b84cb9..21a7796b15 100644 --- a/widgets/misc/e-canvas.c +++ b/widgets/misc/e-canvas.c @@ -165,8 +165,6 @@ canvas_emit_event (GnomeCanvas *canvas, * should be in the parent's item-relative coordinate system. This routine * applies the inverse of the item's transform, maintaining the affine * invariant. */ -#define HACKISH_AFFINE - static GnomeCanvasItem * gnome_canvas_item_invoke_point (GnomeCanvasItem *item, gdouble x, @@ -174,25 +172,19 @@ gnome_canvas_item_invoke_point (GnomeCanvasItem *item, gint cx, gint cy) { -#ifdef HACKISH_AFFINE - gdouble i2w[6], w2c[6], i2c[6], c2i[6]; - ArtPoint c, i; -#endif + cairo_matrix_t inverse; -#ifdef HACKISH_AFFINE - gnome_canvas_item_i2w_affine (item, i2w); - gnome_canvas_w2c_affine (item->canvas, w2c); - art_affine_multiply (i2c, i2w, w2c); - art_affine_invert (c2i, i2c); - c.x = cx; - c.y = cy; - art_affine_point (&i, &c, c2i); - x = i.x; - y = i.y; -#endif + /* Calculate x & y in item local coordinates */ + inverse = item->matrix; + if (cairo_matrix_invert (&inverse) != CAIRO_STATUS_SUCCESS) + return NULL; + + cairo_matrix_transform_point (&inverse, &x, &y); + + if (GNOME_CANVAS_ITEM_GET_CLASS (item)->point) + return GNOME_CANVAS_ITEM_GET_CLASS (item)->point (item, x, y, cx, cy); - return (* GNOME_CANVAS_ITEM_CLASS (G_OBJECT_GET_CLASS (item))->point) ( - item, x, y, cx, cy); + return NULL; } /* Re-picks the current item in the canvas, based on the event's coordinates. |