From c92e396f487dedebde286752ab6f37581c30d8f7 Mon Sep 17 00:00:00 2001 From: raster Date: Wed, 27 Jan 2010 03:51:46 +0000 Subject: [PATCH] make animator happen AT a vierual animator tick point. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@45614 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/ecore_anim.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore/ecore_anim.c b/src/lib/ecore/ecore_anim.c index 0d29639..415f65a 100644 --- a/src/lib/ecore/ecore_anim.c +++ b/src/lib/ecore/ecore_anim.c @@ -7,6 +7,7 @@ #endif #include +#include #include "Ecore.h" #include "ecore_private.h" @@ -57,9 +58,16 @@ ecore_animator_add(int (*func) (void *data), const void *data) ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); animator->func = func; animator->data = (void *)data; - animators = (Ecore_Animator *) eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); + animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); if (!timer) - timer = ecore_timer_add(animators_frametime, _ecore_animator, NULL); + { + double t_loop = ecore_loop_time_get(); + double sync_0 = 0.0; + double d = -fmod(t_loop - sync_0, animators_frametime); + + timer = ecore_timer_loop_add(animators_frametime, _ecore_animator, NULL); + ecore_timer_delay(timer, d); + } return animator; } -- 2.7.4