timeline: Add an internal function for advancing a timeline

There are cases when we want to advance a timeline from another time
source. We cannot use _clutter_timeline_do_tick() directly, as that
assumes that the timeline is already playing, so we'll need to create a
wrapper that toggles the playing flag around it.
This commit is contained in:
Emmanuele Bassi 2012-03-21 16:07:29 +00:00
parent 270894342e
commit edfe618174
2 changed files with 25 additions and 4 deletions

View File

@ -44,6 +44,9 @@ void _clutter_master_clock_remove_timeline (Clutter
void _clutter_master_clock_start_running (ClutterMasterClock *master_clock);
void _clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock);
void _clutter_timeline_advance (ClutterTimeline *timeline,
gint64 tick_time);
gint64 _clutter_timeline_get_delta (ClutterTimeline *timeline);
void _clutter_timeline_do_tick (ClutterTimeline *timeline,
gint64 tick_time);

View File

@ -875,6 +875,8 @@ emit_frame_signal (ClutterTimeline *timeline)
/* see bug https://bugzilla.gnome.org/show_bug.cgi?id=654066 */
gint elapsed = (gint) priv->elapsed_time;
CLUTTER_NOTE (SCHEDULER, "Emitting ::new-frame signal on timeline[%p]", timeline);
g_signal_emit (timeline, timeline_signals[NEW_FRAME], 0, elapsed);
}
@ -923,7 +925,7 @@ clutter_timeline_do_frame (ClutterTimeline *timeline)
g_object_ref (timeline);
CLUTTER_NOTE (SCHEDULER, "Timeline [%p] activated (cur: %ld)\n",
CLUTTER_NOTE (SCHEDULER, "Timeline [%p] activated (elapsed time: %ld)\n",
timeline,
(long) priv->elapsed_time);
@ -1577,7 +1579,25 @@ clutter_timeline_get_delta (ClutterTimeline *timeline)
return timeline->priv->msecs_delta;
}
/*
void
_clutter_timeline_advance (ClutterTimeline *timeline,
gint64 tick_time)
{
ClutterTimelinePrivate *priv = timeline->priv;
g_object_ref (timeline);
priv->msecs_delta = tick_time;
priv->is_playing = TRUE;
clutter_timeline_do_frame (timeline);
priv->is_playing = FALSE;
g_object_unref (timeline);
}
/*< private >
* clutter_timeline_do_tick
* @timeline: a #ClutterTimeline
* @tick_time: time of advance
@ -1593,8 +1613,6 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
{
ClutterTimelinePrivate *priv;
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
priv = timeline->priv;
/* Check the is_playing variable before performing the timeline tick.