aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-17 20:15:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:01 +0800
commit8811cd67d3643f5fcdc46ea787ccab8bfbe2cf3c (patch)
treeea7ed366b9288173e7e6cbc8cd3766cfad31f1ba /widgets/misc
parent7fe898ab0f07b516b6472a78ea1583c4cf014233 (diff)
downloadgsoc2013-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')
-rw-r--r--widgets/misc/e-calendar-item.c8
-rw-r--r--widgets/misc/e-canvas-utils.c7
-rw-r--r--widgets/misc/e-canvas.c30
3 files changed, 17 insertions, 28 deletions
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 5ca1143c96..40d2c2d247 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -62,8 +62,7 @@ static void e_calendar_item_realize (GnomeCanvasItem *item);
static void e_calendar_item_unrealize (GnomeCanvasItem *item);
static void e_calendar_item_unmap (GnomeCanvasItem *item);
static void e_calendar_item_update (GnomeCanvasItem *item,
- gdouble *affine,
- ArtSVP *clip_path,
+ const cairo_matrix_t *i2c,
gint flags);
static void e_calendar_item_draw (GnomeCanvasItem *item,
GdkDrawable *drawable,
@@ -891,8 +890,7 @@ e_calendar_item_unmap (GnomeCanvasItem *item)
static void
e_calendar_item_update (GnomeCanvasItem *item,
- gdouble *affine,
- ArtSVP *clip_path,
+ const cairo_matrix_t *i2c,
gint flags)
{
GnomeCanvasItemClass *item_class;
@@ -906,7 +904,7 @@ e_calendar_item_update (GnomeCanvasItem *item,
item_class = GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class);
if (item_class->update != NULL)
- item_class->update (item, affine, clip_path, flags);
+ item_class->update (item, i2c, flags);
calitem = E_CALENDAR_ITEM (item);
style = gtk_widget_get_style (GTK_WIDGET (item->canvas));
diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c
index 29dc21d3b3..8189dc1240 100644
--- a/widgets/misc/e-canvas-utils.c
+++ b/widgets/misc/e-canvas-utils.c
@@ -26,14 +26,13 @@
void
e_canvas_item_move_absolute (GnomeCanvasItem *item, gdouble dx, gdouble dy)
{
- gdouble translate[6];
+ cairo_matrix_t translate;
- g_return_if_fail (item != NULL);
g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
- art_affine_translate (translate, dx, dy);
+ cairo_matrix_init_translate (&translate, dx, dy);
- gnome_canvas_item_affine_absolute (item, translate);
+ gnome_canvas_item_set_matrix (item, &translate);
}
static double
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.