From 7a54bdc65dcb9eb3d4d30020f65c255ef6f86f29 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 11 Oct 2010 15:52:50 +0100 Subject: [PATCH] vertex: Register progress function This allows animating properties storing a ClutterVertex. --- clutter/clutter-actor.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 6144e1677..d08fcd042 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -9302,16 +9302,40 @@ clutter_vertex_equal (const ClutterVertex *vertex_a, vertex_a->z == vertex_b->z; } +static gboolean +clutter_vertex_progress (const GValue *a, + const GValue *b, + gdouble progress, + GValue *retval) +{ + const ClutterVertex *av = g_value_get_boxed (a); + const ClutterVertex *bv = g_value_get_boxed (b); + ClutterVertex res = { 0, }; + + res.x = av->x + (bv->x - av->x) * progress; + res.y = av->y + (bv->y - av->y) * progress; + res.z = av->z + (bv->z - av->z) * progress; + + g_value_set_boxed (retval, &res); + + return TRUE; +} + GType clutter_vertex_get_type (void) { static GType our_type = 0; if (G_UNLIKELY (our_type == 0)) - our_type = - g_boxed_type_register_static (I_("ClutterVertex"), - (GBoxedCopyFunc) clutter_vertex_copy, - (GBoxedFreeFunc) clutter_vertex_free); + { + our_type = + g_boxed_type_register_static (I_("ClutterVertex"), + (GBoxedCopyFunc) clutter_vertex_copy, + (GBoxedFreeFunc) clutter_vertex_free); + + clutter_interval_register_progress_func (our_type, + clutter_vertex_progress); + } return our_type; }