From e2b0c7c772ac8ffbcd89f64c594750f271e5046b Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 12 Mar 2013 11:57:15 -0400 Subject: [PATCH] animation,throbber: go back to frame dropping Right now we figure out which animation frame to use based on a static counter variable. Since it's static instead of per-object, if there are multiple instances it ends up counting up too fast. We could: 1) make it per-object state 2) drop it and use the ifdef'd out alternative implementation that potentially drops frames if the machine is sluggish This commit chooses 2, but we may end up going to one if the frame dropping turns out to be problematic. Based on deductive work from Kevin Murphy. --- src/libply-splash-graphics/ply-animation.c | 6 ------ src/libply-splash-graphics/ply-throbber.c | 8 +------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/libply-splash-graphics/ply-animation.c b/src/libply-splash-graphics/ply-animation.c index ed558cfe..bba8490e 100644 --- a/src/libply-splash-graphics/ply-animation.c +++ b/src/libply-splash-graphics/ply-animation.c @@ -182,14 +182,8 @@ on_timeout (ply_animation_t *animation) animation->previous_time = animation->now; animation->now = ply_get_timestamp (); -#ifdef REAL_TIME_ANIMATION should_continue = animate_at_time (animation, animation->now - animation->start_time); -#else - static double time = 0.0; - time += 1.0 / FRAMES_PER_SECOND; - should_continue = animate_at_time (animation, time); -#endif sleep_time = 1.0 / FRAMES_PER_SECOND; sleep_time = MAX (sleep_time - (ply_get_timestamp () - animation->now), diff --git a/src/libply-splash-graphics/ply-throbber.c b/src/libply-splash-graphics/ply-throbber.c index 59cf10c6..42044baf 100644 --- a/src/libply-splash-graphics/ply-throbber.c +++ b/src/libply-splash-graphics/ply-throbber.c @@ -178,14 +178,8 @@ on_timeout (ply_throbber_t *throbber) bool should_continue; throbber->now = ply_get_timestamp (); -#ifdef REAL_TIME_ANIMATION should_continue = animate_at_time (throbber, - throbber->now - throbber->start_time); -#else - static double time = 0.0; - time += 1.0 / FRAMES_PER_SECOND; - should_continue = animate_at_time (throbber, time); -#endif + throbber->now - throbber->start_time); sleep_time = 1.0 / FRAMES_PER_SECOND; sleep_time = MAX (sleep_time - (ply_get_timestamp () - throbber->now),