Accumulate small deltas
authorNeil Roberts <neil@linux.intel.com>
Thu, 30 Apr 2009 17:47:59 +0000 (18:47 +0100)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 1 May 2009 14:12:08 +0000 (15:12 +0100)
The clutter frame source tries to average out the frame deltas so that
if one frame takes 1 interval plus a little bit of extra time then the
next frame will be 1 interval minus that little bit of extra
time. Therefore the deltas can sometimes be less than the frame
interval. ClutterTimeline should accumulate these small differences
otherwise it will end up missing out frames so the total duration of
the timeline will be a lot longer.

For example this was causing test-actors to appear to run very slow.

clutter/clutter-timeline.c

index 9e00070..e21a5ec 100644 (file)
@@ -1398,7 +1398,9 @@ clutter_timeline_advance_delta (ClutterTimeline *timeline,
     {
       clutter_timeline_advance_internal (timeline);
 
-      priv->msecs_delta = 0;
+      /* Keep the remainder of the frame time so that it will be
+         counted towards the next time if the delta is short */
+      priv->msecs_delta %= priv->frame_interval;
     }
 }