Properly adjust msecs_delta when clamping elapsed time

When we complete a timeline, we clamp the elapsed_time variable
to the range of the timeline. We need to adjust msecs_delta so that
when we check for hit markers we have the correct interval.

http://bugzilla.openedhand.com/show_bug.cgi?id=1641

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Owen W. Taylor 2009-06-08 07:57:41 -04:00 committed by Emmanuele Bassi
parent fd19d33746
commit fd0a490ced

View File

@ -566,11 +566,19 @@ clutter_timeline_advance_internal (ClutterTimeline *timeline)
gint end_msecs;
/* Update the current elapsed time in case the signal handlers
want to take a peek. */
* want to take a peek. If we clamp elapsed time, then we need
* to correpondingly reduce msecs_delta to reflect the correct
* range of times */
if (priv->direction == CLUTTER_TIMELINE_FORWARD)
{
priv->msecs_delta -= (priv->elapsed_time - priv->duration);
priv->elapsed_time = priv->duration;
}
else if (priv->direction == CLUTTER_TIMELINE_BACKWARD)
{
priv->msecs_delta -= - priv->elapsed_time;
priv->elapsed_time = 0;
}
end_msecs = priv->elapsed_time;