kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=ce298f6b42433c54d5904bc893dc4c20678fd4a4

commit ce298f6b42433c54d5904bc893dc4c20678fd4a4
Author: Kim Woelders <[email protected]>
Date:   Fri Jan 2 12:48:21 2015 +0100

    Fix animator initialisation when duration is 0.
    
    When adding an animator with zero duration the animation would just run
    forever.
---
 src/animation.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/animation.c b/src/animation.c
index 7874313..1070a3c 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -123,6 +123,7 @@ struct _animator {
    int                 duration;
    esound_e            start_sound;
    esound_e            end_sound;
+   char                initialized;
    char                serialize;
    char                cancelled;
    unsigned int        start_frame;
@@ -253,26 +254,23 @@ _AnimatorsRun(Animator ** head, unsigned int frame_num, 
unsigned int next_frame)
             res = ANIM_RET_CANCEL_ANIM;
             goto check_res;
          }
-       if (an->serialize)
-         {
-            /* Start when other non-forever animations have run */
-            if (!first)
-               goto do_next;
-            Dprintf("%s: %#x %p C%d: De-serialize\n", __func__, EOW(an->eo),
-                    an, an->category);
-            an->next_frame = frame_num;
-            an->start_frame = an->next_frame;
-            an->end_frame = an->start_frame + an->duration - 1;
-            an->serialize = 0;
-         }
-       else if (an->start_frame == an->end_frame)
+
+       if (!an->initialized)
          {
             /* Just added - calculate first/last frame */
-            /* Start "now" or after initial delay (-serialize) */
             /* NB! New animations start one frame into the future */
-            an->next_frame = current_frame_num + 1 - an->serialize;
-            an->start_frame = an->next_frame;
+            if (an->serialize)
+              {
+                 /* Start when other non-forever animations have run */
+                 if (!first)
+                    goto do_next;
+                 Dprintf("%s: %#x %p C%d: De-serialize\n", __func__,
+                         EOW(an->eo), an, an->category);
+              }
+            an->initialized = 1;
+            an->start_frame = frame_num + 1;
             an->end_frame = an->start_frame + an->duration - 1;
+            an->next_frame = an->start_frame;
             an->last_tms = Mode_anim.time_ms;
          }
 

-- 


Reply via email to