[clutter/wip/transitions: 7/9] timeline: Add an internal function for advancing a timeline



commit 7cd39cef8ff8a52d6e2e76729274006ff00233ed
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Wed Mar 21 16:07:29 2012 +0000

    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.

 clutter/clutter-master-clock.h |    3 +++
 clutter/clutter-timeline.c     |   26 ++++++++++++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter-master-clock.h b/clutter/clutter-master-clock.h
index 17162d1..211f378 100644
--- a/clutter/clutter-master-clock.h
+++ b/clutter/clutter-master-clock.h
@@ -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);
 
diff --git a/clutter/clutter-timeline.c b/clutter/clutter-timeline.c
index bea9fe9..f17c67e 100644
--- a/clutter/clutter-timeline.c
+++ b/clutter/clutter-timeline.c
@@ -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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]