diff options
author | Benjamin Otte <otte@redhat.com> | 2012-09-17 17:00:02 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-09-17 20:40:01 +0200 |
commit | 0cecf315fd766748d2510a9f0af4820c260c9aca (patch) | |
tree | 2aa1082f3ec55e25c50c6a556b9e21a6cbd96f47 /gtk/gtkcsscomputedvalues.c | |
parent | d74e1b9ac9cb349511902d3543880fb14de7a098 (diff) | |
download | gtk+-0cecf315fd766748d2510a9f0af4820c260c9aca.tar.gz |
cssanimation: Implement pausing the animation
Diffstat (limited to 'gtk/gtkcsscomputedvalues.c')
-rw-r--r-- | gtk/gtkcsscomputedvalues.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c index cd2f66b2d6..250b0b0d29 100644 --- a/gtk/gtkcsscomputedvalues.c +++ b/gtk/gtkcsscomputedvalues.c @@ -434,6 +434,7 @@ gtk_css_computed_values_find_animation (GtkCssComputedValues *values, static void gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values, gint64 timestamp, + GtkCssComputedValues *source, GtkStyleContext *context) { GtkStyleProviderPrivate *provider; @@ -465,21 +466,34 @@ gtk_css_computed_values_create_css_animations (GtkCssComputedValues *values, if (animation) continue; - keyframes = _gtk_style_provider_private_get_keyframes (provider, name); - if (keyframes == NULL) - continue; + if (source) + animation = gtk_css_computed_values_find_animation (source, name); - keyframes = _gtk_css_keyframes_compute (keyframes, context); - - animation = _gtk_css_animation_new (name, - keyframes, - timestamp + _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC, - _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC, - _gtk_css_array_value_get_nth (timing_functions, i), - _gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)), - _gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)), - _gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)), - _gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100)); + if (animation) + { + animation = _gtk_css_animation_copy (GTK_CSS_ANIMATION (animation), + timestamp, + _gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i))); + } + else + { + keyframes = _gtk_style_provider_private_get_keyframes (provider, name); + if (keyframes == NULL) + continue; + + keyframes = _gtk_css_keyframes_compute (keyframes, context); + + animation = _gtk_css_animation_new (name, + keyframes, + timestamp, + _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC, + _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC, + _gtk_css_array_value_get_nth (timing_functions, i), + _gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)), + _gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)), + _gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)), + _gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100)); + } values->animations = g_slist_prepend (values->animations, animation); } } @@ -494,7 +508,7 @@ _gtk_css_computed_values_create_animations (GtkCssComputedValues *values, { if (source != NULL) gtk_css_computed_values_create_css_transitions (values, timestamp, source); - gtk_css_computed_values_create_css_animations (values, timestamp, context); + gtk_css_computed_values_create_css_animations (values, timestamp, source, context); } GtkBitmask * |