mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
[timeline] Remove the concept of frames from timelines
Timelines no longer work in terms of a frame rate and a number of frames but instead just have a duration in milliseconds. This better matches the working of the master clock where if any timelines are running it will redraw as fast as possible rather than limiting to the lowest rated timeline. Most applications will just create animations and expect them to finish in a certain amount of time without caring about how many frames are drawn. If a frame is going to be drawn it might as well update all of the animations to some fraction of the total animation rather than rounding to the nearest whole frame. The 'frame_num' parameter of the new-frame signal is now 'msecs' which is a number of milliseconds progressed along the timeline. Applications should use clutter_timeline_get_progress instead of the frame number. Markers can now only be attached at a time value. The position is stored in milliseconds rather than at a frame number. test-timeline-smoothness and test-timeline-dup-frames have been removed because they no longer make sense.
This commit is contained in:
parent
c20886c5e3
commit
9c7afe0c5b
@ -603,9 +603,7 @@ clutter_ease_out_quad (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return -1.0 * p * (p - 2);
|
||||
}
|
||||
@ -615,8 +613,8 @@ clutter_ease_in_out_quad (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
|
||||
if (p < 1)
|
||||
@ -632,9 +630,7 @@ clutter_ease_in_cubic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return p * p * p;
|
||||
}
|
||||
@ -644,8 +640,8 @@ clutter_ease_out_cubic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / d - 1;
|
||||
|
||||
return p * p * p + 1;
|
||||
@ -656,8 +652,8 @@ clutter_ease_in_out_cubic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
|
||||
if (p < 1)
|
||||
@ -673,9 +669,7 @@ clutter_ease_in_quart (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return p * p * p * p;
|
||||
}
|
||||
@ -685,8 +679,8 @@ clutter_ease_out_quart (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / d - 1;
|
||||
|
||||
return -1.0 * (p * p * p * p - 1);
|
||||
@ -697,8 +691,8 @@ clutter_ease_in_out_quart (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
|
||||
if (p < 1)
|
||||
@ -714,9 +708,7 @@ clutter_ease_in_quint (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return p * p * p * p * p;
|
||||
}
|
||||
@ -726,8 +718,8 @@ clutter_ease_out_quint (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / d - 1;
|
||||
|
||||
return p * p * p * p * p + 1;
|
||||
@ -738,8 +730,8 @@ clutter_ease_in_out_quint (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
|
||||
if (p < 1)
|
||||
@ -755,8 +747,8 @@ clutter_ease_in_sine (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return -1.0 * cos (t / d * G_PI_2) + 1.0;
|
||||
}
|
||||
@ -766,8 +758,8 @@ clutter_ease_out_sine (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return sin (t / d * G_PI_2);
|
||||
}
|
||||
@ -777,8 +769,8 @@ clutter_ease_in_out_sine (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return -0.5 * (cos (G_PI * t / d) - 1);
|
||||
}
|
||||
@ -788,8 +780,8 @@ clutter_ease_in_expo (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return (t == 0) ? 0.0 : pow (2, 10 * (t / d - 1));
|
||||
}
|
||||
@ -799,8 +791,8 @@ clutter_ease_out_expo (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return (t == d) ? 1.0 : -pow (2, -10 * t / d) + 1;
|
||||
}
|
||||
@ -810,8 +802,8 @@ clutter_ease_in_out_expo (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p;
|
||||
|
||||
if (t == 0)
|
||||
@ -835,9 +827,7 @@ clutter_ease_in_circ (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return -1.0 * (sqrt (1 - p * p) - 1);
|
||||
}
|
||||
@ -847,8 +837,8 @@ clutter_ease_out_circ (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / d - 1;
|
||||
|
||||
return sqrt (1 - p * p);
|
||||
@ -859,8 +849,8 @@ clutter_ease_in_out_circ (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
|
||||
if (p < 1)
|
||||
@ -876,8 +866,8 @@ clutter_ease_in_elastic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = d * .3;
|
||||
gdouble s = p / 4;
|
||||
gdouble q = t / d;
|
||||
@ -895,8 +885,8 @@ clutter_ease_out_elastic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = d * .3;
|
||||
gdouble s = p / 4;
|
||||
gdouble q = t / d;
|
||||
@ -912,8 +902,8 @@ clutter_ease_in_out_elastic (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = d * (.3 * 1.5);
|
||||
gdouble s = p / 4;
|
||||
gdouble q = t / (d / 2);
|
||||
@ -942,9 +932,7 @@ clutter_ease_in_back (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble p = t / d;
|
||||
gdouble p = clutter_timeline_get_progress (timeline);
|
||||
|
||||
return p * p * ((1.70158 + 1) * p - 1.70158);
|
||||
}
|
||||
@ -954,8 +942,8 @@ clutter_ease_out_back (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / d - 1;
|
||||
|
||||
return p * p * ((1.70158 + 1) * p + 1.70158) + 1;
|
||||
@ -966,8 +954,8 @@ clutter_ease_in_out_back (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
gdouble p = t / (d / 2);
|
||||
gdouble s = 1.70158 * 1.525;
|
||||
|
||||
@ -1019,8 +1007,8 @@ clutter_ease_in_bounce (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return ease_in_bounce_internal (t, d);
|
||||
}
|
||||
@ -1030,8 +1018,8 @@ clutter_ease_out_bounce (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
return ease_out_bounce_internal (t, d);
|
||||
}
|
||||
@ -1041,8 +1029,8 @@ clutter_ease_in_out_bounce (ClutterAlpha *alpha,
|
||||
gpointer dummy G_GNUC_UNUSED)
|
||||
{
|
||||
ClutterTimeline *timeline = alpha->priv->timeline;
|
||||
gdouble t = clutter_timeline_get_current_frame (timeline);
|
||||
gdouble d = clutter_timeline_get_n_frames (timeline);
|
||||
gdouble t = clutter_timeline_get_elapsed_time (timeline);
|
||||
gdouble d = clutter_timeline_get_duration (timeline);
|
||||
|
||||
if (t < d / 2)
|
||||
return ease_in_bounce_internal (t * 2, d) * 0.5;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -112,17 +112,12 @@ struct _ClutterTimelineClass
|
||||
|
||||
GType clutter_timeline_get_type (void) G_GNUC_CONST;
|
||||
|
||||
ClutterTimeline *clutter_timeline_new (guint n_frames,
|
||||
guint fps);
|
||||
ClutterTimeline *clutter_timeline_new_for_duration (guint msecs);
|
||||
ClutterTimeline *clutter_timeline_new (guint msecs);
|
||||
ClutterTimeline *clutter_timeline_clone (ClutterTimeline *timeline);
|
||||
|
||||
guint clutter_timeline_get_duration (ClutterTimeline *timeline);
|
||||
void clutter_timeline_set_duration (ClutterTimeline *timeline,
|
||||
guint msecs);
|
||||
guint clutter_timeline_get_speed (ClutterTimeline *timeline);
|
||||
void clutter_timeline_set_speed (ClutterTimeline *timeline,
|
||||
guint fps);
|
||||
ClutterTimelineDirection clutter_timeline_get_direction (ClutterTimeline *timeline);
|
||||
void clutter_timeline_set_direction (ClutterTimeline *timeline,
|
||||
ClutterTimelineDirection direction);
|
||||
@ -134,32 +129,25 @@ void clutter_timeline_set_loop (ClutterTimeline *timeli
|
||||
gboolean clutter_timeline_get_loop (ClutterTimeline *timeline);
|
||||
void clutter_timeline_rewind (ClutterTimeline *timeline);
|
||||
void clutter_timeline_skip (ClutterTimeline *timeline,
|
||||
guint n_frames);
|
||||
guint msecs);
|
||||
void clutter_timeline_advance (ClutterTimeline *timeline,
|
||||
guint frame_num);
|
||||
gint clutter_timeline_get_current_frame (ClutterTimeline *timeline);
|
||||
guint msecs);
|
||||
guint clutter_timeline_get_elapsed_time (ClutterTimeline *timeline);
|
||||
gdouble clutter_timeline_get_progress (ClutterTimeline *timeline);
|
||||
CoglFixed clutter_timeline_get_progressx (ClutterTimeline *timeline);
|
||||
void clutter_timeline_set_n_frames (ClutterTimeline *timeline,
|
||||
guint n_frames);
|
||||
guint clutter_timeline_get_n_frames (ClutterTimeline *timeline);
|
||||
gboolean clutter_timeline_is_playing (ClutterTimeline *timeline);
|
||||
void clutter_timeline_set_delay (ClutterTimeline *timeline,
|
||||
guint msecs);
|
||||
guint clutter_timeline_get_delay (ClutterTimeline *timeline);
|
||||
guint clutter_timeline_get_delta (ClutterTimeline *timeline,
|
||||
guint *msecs);
|
||||
guint clutter_timeline_get_delta (ClutterTimeline *timeline);
|
||||
|
||||
void clutter_timeline_add_marker_at_frame (ClutterTimeline *timeline,
|
||||
const gchar *marker_name,
|
||||
guint frame_num);
|
||||
void clutter_timeline_add_marker_at_time (ClutterTimeline *timeline,
|
||||
const gchar *marker_name,
|
||||
guint msecs);
|
||||
void clutter_timeline_remove_marker (ClutterTimeline *timeline,
|
||||
const gchar *marker_name);
|
||||
gchar ** clutter_timeline_list_markers (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
gint msecs,
|
||||
gsize *n_markers) G_GNUC_MALLOC;
|
||||
gboolean clutter_timeline_has_marker (ClutterTimeline *timeline,
|
||||
const gchar *marker_name);
|
||||
|
@ -542,18 +542,13 @@ clutter_stage_add
|
||||
ClutterTimeline
|
||||
ClutterTimelineClass
|
||||
clutter_timeline_new
|
||||
clutter_timeline_new_for_duration
|
||||
clutter_timeline_clone
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_timeline_set_speed
|
||||
clutter_timeline_get_speed
|
||||
clutter_timeline_set_duration
|
||||
clutter_timeline_get_duration
|
||||
clutter_timeline_set_loop
|
||||
clutter_timeline_get_loop
|
||||
clutter_timeline_set_n_frames
|
||||
clutter_timeline_get_n_frames
|
||||
clutter_timeline_set_delay
|
||||
clutter_timeline_get_delay
|
||||
ClutterTimelineDirection
|
||||
@ -567,14 +562,13 @@ clutter_timeline_stop
|
||||
clutter_timeline_rewind
|
||||
clutter_timeline_skip
|
||||
clutter_timeline_advance
|
||||
clutter_timeline_get_current_frame
|
||||
clutter_timeline_get_elapsed_time
|
||||
clutter_timeline_get_delta
|
||||
clutter_timeline_get_progress
|
||||
clutter_timeline_get_progressx
|
||||
clutter_timeline_is_playing
|
||||
|
||||
<SUBSECTION>
|
||||
clutter_timeline_add_marker_at_frame
|
||||
clutter_timeline_add_marker_at_time
|
||||
clutter_timeline_has_marker
|
||||
clutter_timeline_list_markers
|
||||
|
@ -7,10 +7,8 @@ test_conformance_SOURCES = \
|
||||
test-conform-common.c \
|
||||
test-conform-common.h \
|
||||
\
|
||||
test-timeline-dup-frames.c \
|
||||
test-timeline-interpolate.c \
|
||||
test-timeline-rewind.c \
|
||||
test-timeline-smoothness.c \
|
||||
test-timeline.c \
|
||||
test-vertex-buffer-contiguous.c \
|
||||
test-vertex-buffer-interleved.c \
|
||||
|
@ -85,11 +85,8 @@ main (int argc, char **argv)
|
||||
shared_state->argv_addr = &argv;
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_dup_frames);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_dup_frames);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_interpolate);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_rewind);
|
||||
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", test_timeline_smoothness);
|
||||
|
||||
TEST_CONFORM_SIMPLE ("/picking", test_pick);
|
||||
|
||||
|
@ -1,134 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
/* We use a nice slow timeline for this test since we
|
||||
* dont want the timeouts to interpolate the timeline
|
||||
* forward multiple frames */
|
||||
#define TEST_TIMELINE_FPS 10
|
||||
#define TEST_TIMELINE_FRAME_COUNT 20
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
gint prev_frame;
|
||||
gint completion_count;
|
||||
gint passed;
|
||||
guint source_id;
|
||||
GTimeVal prev_tick;
|
||||
gulong msecs_delta;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
new_frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
TestState *state)
|
||||
{
|
||||
gint current_frame = clutter_timeline_get_current_frame (state->timeline);
|
||||
|
||||
if (state->prev_frame
|
||||
!= clutter_timeline_get_current_frame (state->timeline))
|
||||
{
|
||||
g_test_message ("timeline previous frame=%-4i "
|
||||
"actual frame=%-4i (OK)\n",
|
||||
state->prev_frame,
|
||||
current_frame);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_test_message ("timeline previous frame=%-4i "
|
||||
"actual frame=%-4i (FAILED)\n",
|
||||
state->prev_frame,
|
||||
current_frame);
|
||||
|
||||
state->passed = FALSE;
|
||||
}
|
||||
|
||||
state->prev_frame = current_frame;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
completed_cb (ClutterTimeline *timeline,
|
||||
TestState *state)
|
||||
{
|
||||
state->completion_count++;
|
||||
|
||||
if (state->completion_count == 2)
|
||||
{
|
||||
if (state->passed)
|
||||
{
|
||||
g_test_message ("Passed\n");
|
||||
clutter_main_quit ();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_test_message ("Failed\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
||||
if (state->prev_tick.tv_sec == 0)
|
||||
state->prev_tick = cur_tick;
|
||||
|
||||
msecs = (cur_tick.tv_sec - state->prev_tick.tv_sec) * 1000
|
||||
+ (cur_tick.tv_usec - state->prev_tick.tv_usec) / 1000;
|
||||
|
||||
if (clutter_timeline_is_playing (state->timeline))
|
||||
clutter_timeline_advance_delta (state->timeline, msecs);
|
||||
|
||||
state->msecs_delta = msecs;
|
||||
state->prev_tick = cur_tick;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
test_timeline_dup_frames (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
TestState state;
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_FRAME_COUNT,
|
||||
TEST_TIMELINE_FPS);
|
||||
clutter_timeline_set_loop (state.timeline, TRUE);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"new-frame",
|
||||
G_CALLBACK(new_frame_cb),
|
||||
&state);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"completed",
|
||||
G_CALLBACK(completed_cb),
|
||||
&state);
|
||||
|
||||
state.prev_frame = -1;
|
||||
state.completion_count = 0;
|
||||
state.passed = TRUE;
|
||||
state.prev_tick.tv_sec = 0;
|
||||
state.prev_tick.tv_usec = 0;
|
||||
state.msecs_delta = 0;
|
||||
|
||||
state.source_id =
|
||||
clutter_threads_add_frame_source (60, frame_tick, &state);
|
||||
|
||||
clutter_timeline_start (state.timeline);
|
||||
|
||||
clutter_main();
|
||||
|
||||
g_source_remove (state.source_id);
|
||||
g_object_unref (state.timeline);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
* will interpolate the number frames that should have
|
||||
* passed between timeouts. */
|
||||
#define TEST_TIMELINE_FPS 1000
|
||||
#define TEST_TIMELINE_FRAME_COUNT 5000
|
||||
#define TEST_TIMELINE_DURATION 5000
|
||||
|
||||
/* We are at the mercy of the system scheduler so this
|
||||
* may not be a very reliable tolerance. */
|
||||
@ -42,7 +42,7 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
|
||||
g_get_current_time (¤t_time);
|
||||
|
||||
current_frame = clutter_timeline_get_current_frame (state->timeline);
|
||||
current_frame = clutter_timeline_get_elapsed_time (state->timeline);
|
||||
|
||||
msec_diff = (current_time.tv_sec - state->start_time.tv_sec) * 1000;
|
||||
msec_diff += (current_time.tv_usec - state->start_time.tv_usec)/1000;
|
||||
@ -50,13 +50,13 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
/* If we expect to have interpolated past the end of the timeline
|
||||
* we keep track of the overflow so we can determine when
|
||||
* the next timeout will happen. We then clip expected_frames
|
||||
* to TEST_TIMELINE_FRAME_COUNT since clutter-timeline
|
||||
* to TEST_TIMELINE_DURATION since clutter-timeline
|
||||
* semantics guaranty this frame is always signaled before
|
||||
* looping */
|
||||
if (state->expected_frame > TEST_TIMELINE_FRAME_COUNT)
|
||||
if (state->expected_frame > TEST_TIMELINE_DURATION)
|
||||
{
|
||||
loop_overflow = state->expected_frame - TEST_TIMELINE_FRAME_COUNT;
|
||||
state->expected_frame = TEST_TIMELINE_FRAME_COUNT;
|
||||
loop_overflow = state->expected_frame - TEST_TIMELINE_DURATION;
|
||||
state->expected_frame = TEST_TIMELINE_DURATION;
|
||||
}
|
||||
|
||||
if (current_frame >= (state->expected_frame-TEST_ERROR_TOLERANCE)
|
||||
@ -99,10 +99,10 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
g_usleep (1000000);
|
||||
}
|
||||
|
||||
if (current_frame >= TEST_TIMELINE_FRAME_COUNT)
|
||||
if (current_frame >= TEST_TIMELINE_DURATION)
|
||||
{
|
||||
state->expected_frame += loop_overflow;
|
||||
state->expected_frame -= TEST_TIMELINE_FRAME_COUNT;
|
||||
state->expected_frame -= TEST_TIMELINE_DURATION;
|
||||
g_test_message ("End of timeline reached: "
|
||||
"Wrapping expected frame too %i\n",
|
||||
state->expected_frame);
|
||||
@ -165,8 +165,7 @@ test_timeline_interpolate (TestConformSimpleFixture *fixture,
|
||||
TestState state;
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_FRAME_COUNT,
|
||||
TEST_TIMELINE_FPS);
|
||||
clutter_timeline_new (TEST_TIMELINE_DURATION);
|
||||
clutter_timeline_set_loop (state.timeline, TRUE);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"new-frame",
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
#define TEST_TIMELINE_FPS 10
|
||||
#define TEST_TIMELINE_FRAME_COUNT 5
|
||||
#define TEST_TIMELINE_DURATION 500
|
||||
#define TEST_WATCHDOG_KICK_IN_SECONDS 10
|
||||
|
||||
typedef struct _TestState
|
||||
@ -42,9 +41,9 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
TestState *state)
|
||||
{
|
||||
gint current_frame = clutter_timeline_get_current_frame (timeline);
|
||||
gint elapsed_time = clutter_timeline_get_elapsed_time (timeline);
|
||||
|
||||
if (current_frame == TEST_TIMELINE_FRAME_COUNT)
|
||||
if (elapsed_time == TEST_TIMELINE_DURATION)
|
||||
{
|
||||
g_test_message ("new-frame signal recieved (end of timeline)\n");
|
||||
g_test_message ("Rewinding timeline\n");
|
||||
@ -53,7 +52,7 @@ new_frame_cb (ClutterTimeline *timeline,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current_frame == 0)
|
||||
if (elapsed_time == 0)
|
||||
{
|
||||
g_test_message ("new-frame signal recieved (start of timeline)\n");
|
||||
}
|
||||
@ -101,8 +100,7 @@ test_timeline_rewind (TestConformSimpleFixture *fixture,
|
||||
TestState state;
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_FRAME_COUNT,
|
||||
TEST_TIMELINE_FPS);
|
||||
clutter_timeline_new (TEST_TIMELINE_DURATION);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"new-frame",
|
||||
G_CALLBACK(new_frame_cb),
|
||||
|
@ -1,147 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include "test-conform-common.h"
|
||||
|
||||
#define TEST_TIMELINE_FPS 10
|
||||
#define TEST_TIMELINE_FRAME_COUNT 20
|
||||
#define TEST_ERROR_TOLERANCE 5
|
||||
|
||||
typedef struct _TestState
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
GTimeVal start_time;
|
||||
GTimeVal prev_frame_time;
|
||||
guint frame;
|
||||
gint completion_count;
|
||||
gint passed;
|
||||
guint source_id;
|
||||
GTimeVal prev_tick;
|
||||
gulong msecs_delta;
|
||||
} TestState;
|
||||
|
||||
static void
|
||||
new_frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
TestState *state)
|
||||
{
|
||||
GTimeVal current_time;
|
||||
glong total_elapsed_ms;
|
||||
glong frame_elapsed_ms = 0;
|
||||
gchar *bump = "";
|
||||
|
||||
g_get_current_time (¤t_time);
|
||||
|
||||
total_elapsed_ms = (current_time.tv_sec - state->start_time.tv_sec) * 1000;
|
||||
total_elapsed_ms += (current_time.tv_usec - state->start_time.tv_usec)/1000;
|
||||
|
||||
if (state->frame>0)
|
||||
{
|
||||
frame_elapsed_ms =
|
||||
(current_time.tv_sec - state->prev_frame_time.tv_sec) * 1000;
|
||||
frame_elapsed_ms +=
|
||||
(current_time.tv_usec - state->prev_frame_time.tv_usec)/1000;
|
||||
|
||||
if (ABS(frame_elapsed_ms - (1000/TEST_TIMELINE_FPS))
|
||||
> TEST_ERROR_TOLERANCE)
|
||||
{
|
||||
state->passed = FALSE;
|
||||
bump = " (BUMP)";
|
||||
}
|
||||
}
|
||||
|
||||
g_test_message ("timeline frame=%-2d total elapsed=%-4li(ms) "
|
||||
"since last frame=%-4li(ms)%s\n",
|
||||
clutter_timeline_get_current_frame(state->timeline),
|
||||
total_elapsed_ms,
|
||||
frame_elapsed_ms,
|
||||
bump);
|
||||
|
||||
state->prev_frame_time = current_time;
|
||||
state->frame++;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
completed_cb (ClutterTimeline *timeline,
|
||||
TestState *state)
|
||||
{
|
||||
state->completion_count++;
|
||||
|
||||
if (state->completion_count == 2)
|
||||
{
|
||||
if (state->passed)
|
||||
{
|
||||
g_test_message ("Passed\n");
|
||||
clutter_main_quit ();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_test_message ("Failed\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
||||
if (state->prev_tick.tv_sec == 0)
|
||||
state->prev_tick = cur_tick;
|
||||
|
||||
msecs = (cur_tick.tv_sec - state->prev_tick.tv_sec) * 1000
|
||||
+ (cur_tick.tv_usec - state->prev_tick.tv_usec) / 1000;
|
||||
|
||||
if (clutter_timeline_is_playing (state->timeline))
|
||||
clutter_timeline_advance_delta (state->timeline, msecs);
|
||||
|
||||
state->msecs_delta = msecs;
|
||||
state->prev_tick = cur_tick;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
test_timeline_smoothness (TestConformSimpleFixture *fixture,
|
||||
gconstpointer data)
|
||||
{
|
||||
TestState state;
|
||||
|
||||
state.timeline =
|
||||
clutter_timeline_new (TEST_TIMELINE_FRAME_COUNT,
|
||||
TEST_TIMELINE_FPS);
|
||||
clutter_timeline_set_loop (state.timeline, TRUE);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"new-frame",
|
||||
G_CALLBACK(new_frame_cb),
|
||||
&state);
|
||||
g_signal_connect (G_OBJECT(state.timeline),
|
||||
"completed",
|
||||
G_CALLBACK(completed_cb),
|
||||
&state);
|
||||
|
||||
state.frame = 0;
|
||||
state.completion_count = 0;
|
||||
state.passed = TRUE;
|
||||
state.prev_tick.tv_sec = 0;
|
||||
state.prev_tick.tv_usec = 0;
|
||||
state.msecs_delta = 0;
|
||||
|
||||
state.source_id =
|
||||
clutter_threads_add_frame_source (60, frame_tick, &state);
|
||||
|
||||
g_get_current_time (&state.start_time);
|
||||
clutter_timeline_start (state.timeline);
|
||||
|
||||
clutter_main();
|
||||
|
||||
g_source_remove (state.source_id);
|
||||
g_object_unref (state.timeline);
|
||||
}
|
@ -15,6 +15,7 @@
|
||||
for. */
|
||||
|
||||
#define FRAME_COUNT 10
|
||||
#define FPS 30
|
||||
|
||||
typedef struct _TimelineData TimelineData;
|
||||
|
||||
@ -53,13 +54,21 @@ timeline_complete_cb (ClutterTimeline *timeline,
|
||||
|
||||
static void
|
||||
timeline_new_frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_no,
|
||||
gint msec,
|
||||
TimelineData *data)
|
||||
{
|
||||
/* Calculate an approximate frame number from the duration with
|
||||
rounding */
|
||||
int frame_no = ((msec * FRAME_COUNT + (FRAME_COUNT * 1000 / FPS) / 2)
|
||||
/ (FRAME_COUNT * 1000 / FPS));
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("%i: Doing frame %d, delta = %i\n",
|
||||
data->timeline_num, frame_no,
|
||||
clutter_timeline_get_delta (timeline, NULL));
|
||||
clutter_timeline_get_delta (timeline));
|
||||
|
||||
g_assert (frame_no >= 0 && frame_no <= FRAME_COUNT);
|
||||
|
||||
data->frame_hit_count[frame_no]++;
|
||||
}
|
||||
|
||||
@ -72,7 +81,7 @@ timeline_marker_reached_cb (ClutterTimeline *timeline,
|
||||
if (g_test_verbose ())
|
||||
g_print ("%i: Marker '%s' (%d) reached, delta = %i\n",
|
||||
data->timeline_num, marker_name, frame_num,
|
||||
clutter_timeline_get_delta (timeline, NULL));
|
||||
clutter_timeline_get_delta (timeline));
|
||||
data->markers_hit = g_slist_prepend (data->markers_hit,
|
||||
g_strdup (marker_name));
|
||||
}
|
||||
@ -128,7 +137,7 @@ check_timeline (ClutterTimeline *timeline,
|
||||
if (check_missed_frames)
|
||||
{
|
||||
for (i = 0; i < FRAME_COUNT; i++)
|
||||
if (data->frame_hit_count[i + frame_offset] != 1)
|
||||
if (data->frame_hit_count[i + frame_offset] < 1)
|
||||
missed_frame_count++;
|
||||
|
||||
if (missed_frame_count)
|
||||
@ -230,16 +239,19 @@ test_timeline (TestConformSimpleFixture *fixture,
|
||||
|
||||
counter = g_new0 (FrameCounter, 1);
|
||||
|
||||
source_id = clutter_threads_add_frame_source (60, frame_tick, counter);
|
||||
source_id = clutter_threads_add_frame_source (FPS, frame_tick, counter);
|
||||
|
||||
timeline_data_init (&data_1, 1);
|
||||
timeline_1 = clutter_timeline_new (FRAME_COUNT, 30);
|
||||
clutter_timeline_add_marker_at_frame (timeline_1, "foo", 5);
|
||||
clutter_timeline_add_marker_at_frame (timeline_1, "bar", 5);
|
||||
clutter_timeline_add_marker_at_frame (timeline_1, "baz", 5);
|
||||
clutter_timeline_add_marker_at_frame (timeline_1, "near-end-marker", 9);
|
||||
clutter_timeline_add_marker_at_frame (timeline_1, "end-marker", 10);
|
||||
markers = clutter_timeline_list_markers (timeline_1, 5, &n_markers);
|
||||
timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "foo", 5 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "bar", 5 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "baz", 5 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "near-end-marker",
|
||||
9 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_1, "end-marker",
|
||||
10 * 1000 / FPS);
|
||||
markers = clutter_timeline_list_markers (timeline_1, 5 * 1000 / FPS,
|
||||
&n_markers);
|
||||
g_assert (markers != NULL);
|
||||
g_assert (n_markers == 3);
|
||||
g_strfreev (markers);
|
||||
@ -248,7 +260,7 @@ test_timeline (TestConformSimpleFixture *fixture,
|
||||
|
||||
timeline_data_init (&data_2, 2);
|
||||
timeline_2 = clutter_timeline_clone (timeline_1);
|
||||
clutter_timeline_add_marker_at_frame (timeline_2, "bar", 2);
|
||||
clutter_timeline_add_marker_at_time (timeline_2, "bar", 2 * 1000 / FPS);
|
||||
markers = clutter_timeline_list_markers (timeline_2, -1, &n_markers);
|
||||
g_assert (markers != NULL);
|
||||
g_assert (n_markers == 1);
|
||||
@ -260,10 +272,12 @@ test_timeline (TestConformSimpleFixture *fixture,
|
||||
timeline_data_init (&data_3, 3);
|
||||
timeline_3 = clutter_timeline_clone (timeline_1);
|
||||
clutter_timeline_set_direction (timeline_3, CLUTTER_TIMELINE_BACKWARD);
|
||||
clutter_timeline_add_marker_at_frame (timeline_3, "foo", 5);
|
||||
clutter_timeline_add_marker_at_frame (timeline_3, "baz", 8);
|
||||
clutter_timeline_add_marker_at_frame (timeline_3, "near-end-marker", 1);
|
||||
clutter_timeline_add_marker_at_frame (timeline_3, "end-marker", 0);
|
||||
clutter_timeline_add_marker_at_time (timeline_3, "foo", 5 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_3, "baz", 8 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_3, "near-end-marker",
|
||||
1 * 1000 / FPS);
|
||||
clutter_timeline_add_marker_at_time (timeline_3, "end-marker",
|
||||
0 * 1000 / FPS);
|
||||
|
||||
counter->timelines = g_slist_prepend (counter->timelines, timeline_3);
|
||||
|
||||
|
@ -105,12 +105,13 @@ frame_cb (ClutterTimeline *timeline,
|
||||
{
|
||||
SuperOH *oh = data;
|
||||
gint i;
|
||||
float rotation = clutter_timeline_get_progress (timeline) * 360.0f;
|
||||
|
||||
/* Rotate everything clockwise about stage center*/
|
||||
|
||||
clutter_actor_set_rotation (oh->group,
|
||||
CLUTTER_Z_AXIS,
|
||||
frame_num,
|
||||
rotation,
|
||||
oh->stage_width / 2,
|
||||
oh->stage_height / 2,
|
||||
0);
|
||||
@ -126,7 +127,7 @@ frame_cb (ClutterTimeline *timeline,
|
||||
*/
|
||||
clutter_actor_set_rotation (oh->hand[i],
|
||||
CLUTTER_Z_AXIS,
|
||||
-6.0 * frame_num,
|
||||
-6.0 * rotation,
|
||||
0, 0, 0);
|
||||
}
|
||||
}
|
||||
@ -178,7 +179,7 @@ test_actor_clone_main (int argc, char *argv[])
|
||||
oh = g_new (SuperOH, 1);
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
oh->timeline = clutter_timeline_new (360, 60);
|
||||
oh->timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (oh->timeline, TRUE);
|
||||
|
||||
/* fire a callback for frame change */
|
||||
|
@ -98,17 +98,18 @@ input_cb (ClutterActor *stage,
|
||||
/* Timeline handler */
|
||||
static void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
gint msecs,
|
||||
gpointer data)
|
||||
{
|
||||
SuperOH *oh = data;
|
||||
gint i;
|
||||
float rotation = clutter_timeline_get_progress (timeline) * 360.0f;
|
||||
|
||||
/* Rotate everything clockwise about stage center*/
|
||||
|
||||
clutter_actor_set_rotation (oh->group,
|
||||
CLUTTER_Z_AXIS,
|
||||
frame_num,
|
||||
rotation,
|
||||
oh->stage_width / 2,
|
||||
oh->stage_height / 2,
|
||||
0);
|
||||
@ -120,7 +121,7 @@ frame_cb (ClutterTimeline *timeline,
|
||||
*/
|
||||
clutter_actor_set_rotation (oh->hand[i],
|
||||
CLUTTER_Z_AXIS,
|
||||
-6.0 * frame_num,
|
||||
-6.0 * rotation,
|
||||
0, 0, 0);
|
||||
}
|
||||
}
|
||||
@ -172,7 +173,7 @@ test_actors_main (int argc, char *argv[])
|
||||
oh->stage = stage;
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
oh->timeline = clutter_timeline_new (360, 60);
|
||||
oh->timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (oh->timeline, TRUE);
|
||||
|
||||
/* fire a callback for frame change */
|
||||
|
@ -164,7 +164,7 @@ test_behave_main (int argc, char *argv[])
|
||||
clutter_container_add (CLUTTER_CONTAINER (group), rect, hand, NULL);
|
||||
|
||||
/* Make a timeline */
|
||||
timeline = clutter_timeline_new_for_duration (4000); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (4000); /* num frames, fps */
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
g_signal_connect (timeline,
|
||||
"completed", G_CALLBACK (timeline_completed),
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include <clutter/clutter.h>
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
#define TIMELINE_FRAME_COUNT 200
|
||||
|
||||
typedef struct _TestMultiLayerMaterialState
|
||||
{
|
||||
ClutterActor *group;
|
||||
@ -45,9 +43,7 @@ material_rectangle_paint (ClutterActor *actor, gpointer data)
|
||||
TestMultiLayerMaterialState *state = data;
|
||||
|
||||
cogl_set_source (state->material);
|
||||
cogl_rectangle_with_multitexture_coords (0, 0,
|
||||
TIMELINE_FRAME_COUNT,
|
||||
TIMELINE_FRAME_COUNT,
|
||||
cogl_rectangle_with_multitexture_coords (0, 0, 200, 200,
|
||||
state->tex_coords,
|
||||
12);
|
||||
}
|
||||
@ -122,7 +118,7 @@ test_cogl_multitexture_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER(stage),
|
||||
state->group);
|
||||
|
||||
timeline = clutter_timeline_new (TIMELINE_FRAME_COUNT, 26 /* fps */);
|
||||
timeline = clutter_timeline_new (7692);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), state);
|
||||
|
@ -81,8 +81,8 @@ static PaintFunc paint_func []=
|
||||
static void
|
||||
paint_cb (ClutterActor *self, ClutterTimeline *tl)
|
||||
{
|
||||
gint paint_index = (clutter_timeline_get_current_frame (tl)
|
||||
% G_N_ELEMENTS (paint_func));
|
||||
gint paint_index = (clutter_timeline_get_progress (tl)
|
||||
* G_N_ELEMENTS (paint_func));
|
||||
|
||||
cogl_push_matrix ();
|
||||
|
||||
@ -108,8 +108,7 @@ test_cogl_primitives_main (int argc, char *argv[])
|
||||
|
||||
clutter_init(&argc, &argv);
|
||||
|
||||
/* One frame for each paint function at one frame per second */
|
||||
tl = clutter_timeline_new (G_N_ELEMENTS (paint_func), 1);
|
||||
tl = clutter_timeline_new (G_N_ELEMENTS (paint_func) * 1000);
|
||||
clutter_timeline_set_loop (tl, TRUE);
|
||||
clutter_timeline_start (tl);
|
||||
|
||||
|
@ -370,7 +370,7 @@ test_cogl_tex_polygon_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
|
||||
/* Timeline for animation */
|
||||
timeline = clutter_timeline_new (360, 60); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox);
|
||||
clutter_timeline_start (timeline);
|
||||
|
@ -202,7 +202,7 @@ test_cogl_tex_tile_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox);
|
||||
|
||||
/* Timeline for animation */
|
||||
timeline = clutter_timeline_new (360, 60); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (6000); /* num frames, fps */
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), coglbox);
|
||||
clutter_timeline_start (timeline);
|
||||
|
@ -59,8 +59,7 @@ frame_cb (ClutterTimeline *timeline,
|
||||
TestState *state)
|
||||
{
|
||||
guint x, y;
|
||||
guint n_frames = clutter_timeline_get_n_frames (timeline);
|
||||
float period_progress = ((float)frame_num / (float)n_frames) * 2.0 * G_PI;
|
||||
float period_progress = clutter_timeline_get_progress (timeline);
|
||||
float period_progress_sin = sinf (period_progress);
|
||||
float wave_shift = period_progress * WAVE_SPEED;
|
||||
float ripple_shift = period_progress * RIPPLE_SPEED;
|
||||
@ -354,7 +353,7 @@ test_cogl_vertex_buffer_main (int argc, char *argv[])
|
||||
(stage_geom.width / 2.0) - (dummy_width / 2.0),
|
||||
(stage_geom.height / 2.0) - (dummy_height / 2.0));
|
||||
|
||||
state.timeline = clutter_timeline_new (360, 60);
|
||||
state.timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (state.timeline, TRUE);
|
||||
g_signal_connect (state.timeline,
|
||||
"new-frame",
|
||||
|
@ -157,7 +157,7 @@ test_depth_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
||||
|
||||
/* 3 seconds, at 60 fps */
|
||||
timeline = clutter_timeline_new (180, 60);
|
||||
timeline = clutter_timeline_new (3000);
|
||||
g_signal_connect (timeline,
|
||||
"completed", G_CALLBACK (timeline_completed),
|
||||
NULL);
|
||||
|
@ -756,7 +756,7 @@ test_layout_main (int argc, char *argv[])
|
||||
|
||||
clutter_color_from_string (&bg_color, "Red");
|
||||
|
||||
main_timeline = clutter_timeline_new_for_duration (2000);
|
||||
main_timeline = clutter_timeline_new (2000);
|
||||
clutter_timeline_set_loop (main_timeline, TRUE);
|
||||
g_signal_connect (main_timeline, "new-frame",
|
||||
G_CALLBACK (relayout_on_frame),
|
||||
|
@ -72,7 +72,7 @@ on_button_press (ClutterActor *actor,
|
||||
win_title = g_strdup_printf ("Stage:%p", new_stage);
|
||||
clutter_stage_set_title (CLUTTER_STAGE(new_stage), win_title);
|
||||
|
||||
timeline = clutter_timeline_new_for_duration (2000);
|
||||
timeline = clutter_timeline_new (2000);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||
|
@ -88,17 +88,18 @@ input_cb (ClutterStage *stage,
|
||||
/* Timeline handler */
|
||||
static void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
gint msecs,
|
||||
gpointer data)
|
||||
{
|
||||
SuperOH *oh = (SuperOH *)data;
|
||||
gint i;
|
||||
SuperOH *oh = (SuperOH *)data;
|
||||
gint i;
|
||||
float rotation = clutter_timeline_get_progress (timeline) * 360.0f;
|
||||
|
||||
/* Rotate everything clockwise about stage center*/
|
||||
|
||||
clutter_actor_set_rotation (CLUTTER_ACTOR (oh->group),
|
||||
CLUTTER_Z_AXIS,
|
||||
frame_num,
|
||||
rotation,
|
||||
CLUTTER_STAGE_WIDTH () / 2,
|
||||
CLUTTER_STAGE_HEIGHT () / 2,
|
||||
0);
|
||||
@ -116,7 +117,7 @@ frame_cb (ClutterTimeline *timeline,
|
||||
* unit based functions to fix.
|
||||
*/
|
||||
clutter_actor_set_rotation (oh->hand[i], CLUTTER_Z_AXIS,
|
||||
- 6.0 * frame_num, 0, 0, 0);
|
||||
- 6.0 * rotation, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,7 +209,7 @@ test_paint_wrapper_main (int argc, char *argv[])
|
||||
oh = g_new(SuperOH, 1);
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
timeline = clutter_timeline_new (360, 60); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (6000);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
/* fire a callback for frame change */
|
||||
|
@ -233,7 +233,7 @@ test_pixmap_main (int argc, char **argv)
|
||||
clutter_actor_set_position (stage, 0, 150);
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage), &gry);
|
||||
|
||||
timeline = clutter_timeline_new (60*5, 60);
|
||||
timeline = clutter_timeline_new (5000);
|
||||
g_signal_connect (timeline,
|
||||
"completed", G_CALLBACK (timeline_completed),
|
||||
NULL);
|
||||
|
@ -44,7 +44,7 @@ test_rotate_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
||||
|
||||
/* Make a timeline */
|
||||
timeline = clutter_timeline_new (200, 26); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (7692); /* num frames, fps */
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
/* Set an alpha func to power behaviour */
|
||||
|
@ -86,7 +86,7 @@ test_scale_main (int argc, char *argv[])
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP (stage), rect);
|
||||
|
||||
timeline = clutter_timeline_new_for_duration (750);
|
||||
timeline = clutter_timeline_new (750);
|
||||
alpha = clutter_alpha_new_with_func (timeline,
|
||||
my_ramp_func,
|
||||
NULL, NULL);
|
||||
|
@ -61,28 +61,28 @@ test_score_main (int argc, char **argv)
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
timeline_1 = clutter_timeline_new_for_duration (1000);
|
||||
timeline_1 = clutter_timeline_new (1000);
|
||||
g_object_set_data_full (G_OBJECT (timeline_1),
|
||||
"timeline-name", g_strdup ("Timeline 1"),
|
||||
g_free);
|
||||
|
||||
timeline_2 = clutter_timeline_new_for_duration (1000);
|
||||
timeline_2 = clutter_timeline_new (1000);
|
||||
clutter_timeline_add_marker_at_time (timeline_2, "foo", 500);
|
||||
g_object_set_data_full (G_OBJECT (timeline_2),
|
||||
"timeline-name", g_strdup ("Timeline 2"),
|
||||
g_free);
|
||||
|
||||
timeline_3 = clutter_timeline_new_for_duration (1000);
|
||||
timeline_3 = clutter_timeline_new (1000);
|
||||
g_object_set_data_full (G_OBJECT (timeline_3),
|
||||
"timeline-name", g_strdup ("Timeline 3"),
|
||||
g_free);
|
||||
|
||||
timeline_4 = clutter_timeline_new_for_duration (1000);
|
||||
timeline_4 = clutter_timeline_new (1000);
|
||||
g_object_set_data_full (G_OBJECT (timeline_4),
|
||||
"timeline-name", g_strdup ("Timeline 4"),
|
||||
g_free);
|
||||
|
||||
timeline_5 = clutter_timeline_new_for_duration (1000);
|
||||
timeline_5 = clutter_timeline_new (1000);
|
||||
g_object_set_data_full (G_OBJECT (timeline_5),
|
||||
"timeline-name", g_strdup ("Timeline 5"),
|
||||
g_free);
|
||||
|
@ -61,7 +61,7 @@ static gboolean task (gpointer foo)
|
||||
|
||||
for (i=0; i<3; i++)
|
||||
{
|
||||
timeline = clutter_timeline_new (60*5, 60);
|
||||
timeline = clutter_timeline_new (5000);
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||
depth_behavior = clutter_behaviour_depth_new (alpha, -2500, 0);
|
||||
clutter_behaviour_apply (depth_behavior, image[i]);
|
||||
|
@ -77,7 +77,7 @@ test_texture_quality_main (int argc, char *argv[])
|
||||
(clutter_actor_get_height (stage) - clutter_actor_get_height (image))/2);
|
||||
clutter_container_add (CLUTTER_CONTAINER (stage), image, NULL);
|
||||
|
||||
timeline = clutter_timeline_new (60*5, 60);
|
||||
timeline = clutter_timeline_new (5000);
|
||||
g_signal_connect (timeline,
|
||||
"completed", G_CALLBACK (timeline_completed),
|
||||
NULL);
|
||||
|
@ -211,7 +211,7 @@ test_threads_main (int argc, char *argv[])
|
||||
rect, progress_rect,
|
||||
NULL);
|
||||
|
||||
timeline = clutter_timeline_new (150, 50);
|
||||
timeline = clutter_timeline_new (3000);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR);
|
||||
|
@ -36,7 +36,7 @@ test_viewport_main (int argc, char *argv[])
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), hand);
|
||||
|
||||
/* Make a timeline */
|
||||
timeline = clutter_timeline_new (200, 26); /* num frames, fps */
|
||||
timeline = clutter_timeline_new (7692);
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
|
||||
/* Set an alpha func to power behaviour */
|
||||
|
Loading…
Reference in New Issue
Block a user