diff options
author | Benjamin Otte <otte@redhat.com> | 2012-09-13 16:23:36 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-09-17 20:39:12 +0200 |
commit | 7248c190373ae717b74d24d054a047c8d939efa4 (patch) | |
tree | 76f4be9ab6120b29bb9203c8f4441e2cedda774b | |
parent | 94a3bd21e5c21f32420f9deb2eb794fde8b66564 (diff) | |
download | gtk+-7248c190373ae717b74d24d054a047c8d939efa4.tar.gz |
csscomputedvalues: Store animated values here
Actually use the GtkCssComputedValues to store the computed values here
instead of putting them into the GtkCssAnimatedValues separately.
-rw-r--r-- | gtk/gtkcssanimatedvalues.c | 20 | ||||
-rw-r--r-- | gtk/gtkcssanimatedvaluesprivate.h | 1 | ||||
-rw-r--r-- | gtk/gtkcssanimation.c | 5 | ||||
-rw-r--r-- | gtk/gtkcsstransition.c | 3 |
4 files changed, 14 insertions, 15 deletions
diff --git a/gtk/gtkcssanimatedvalues.c b/gtk/gtkcssanimatedvalues.c index 92bd1e48f0..c7f9d0e3bf 100644 --- a/gtk/gtkcssanimatedvalues.c +++ b/gtk/gtkcssanimatedvalues.c @@ -41,7 +41,6 @@ gtk_css_animated_values_dispose (GObject *object) { GtkCssAnimatedValues *values = GTK_CSS_ANIMATED_VALUES (object); - g_clear_object (&values->computed); g_slist_free_full (values->animations, g_object_unref); values->animations = NULL; @@ -164,15 +163,11 @@ gtk_css_animated_values_start_transitions (GtkCssAnimatedValues *values, GtkCssComputedValues *source) { TransitionInfo transitions[GTK_CSS_PROPERTY_N_PROPERTIES] = { { 0, } }; - GtkCssComputedValues *source_computed, *computed; + GtkCssComputedValues *computed; GtkCssValue *durations, *delays, *timing_functions; guint i; computed = GTK_CSS_COMPUTED_VALUES (values); - if (GTK_IS_CSS_ANIMATED_VALUES (source)) - source_computed = GTK_CSS_ANIMATED_VALUES (source)->computed; - else - source_computed = source; transition_infos_set (transitions, _gtk_css_computed_values_get_value (computed, GTK_CSS_PROPERTY_TRANSITION_PROPERTY)); @@ -194,8 +189,8 @@ gtk_css_animated_values_start_transitions (GtkCssAnimatedValues *values, if (duration + delay == 0.0) continue; - start = _gtk_css_computed_values_get_value (source_computed, i); - end = _gtk_css_computed_values_get_value (values->computed, i); + start = _gtk_css_computed_values_get_intrinsic_value (source, i); + end = _gtk_css_computed_values_get_intrinsic_value (computed, i); if (_gtk_css_value_equal (start, end)) { if (GTK_IS_CSS_ANIMATED_VALUES (source)) @@ -321,7 +316,6 @@ _gtk_css_animated_values_new (GtkCssComputedValues *computed, values = g_object_new (GTK_TYPE_CSS_ANIMATED_VALUES, NULL); - values->computed = g_object_ref (computed); for (i = 0; ; i++) { value = _gtk_css_computed_values_get_value (computed, i); @@ -357,15 +351,20 @@ GtkBitmask * _gtk_css_animated_values_advance (GtkCssAnimatedValues *values, gint64 timestamp) { + GtkCssComputedValues *computed; GtkBitmask *changed; + GPtrArray *old_animated_values; GSList *list; g_return_val_if_fail (GTK_IS_CSS_ANIMATED_VALUES (values), NULL); g_return_val_if_fail (timestamp >= values->current_time, NULL); + computed = GTK_CSS_COMPUTED_VALUES (values); changed = _gtk_bitmask_new (); values->current_time = timestamp; + old_animated_values = computed->animated_values; + computed->animated_values = NULL; list = values->animations; while (list) @@ -386,6 +385,9 @@ _gtk_css_animated_values_advance (GtkCssAnimatedValues *values, } } + if (old_animated_values) + g_ptr_array_unref (old_animated_values); + return changed; } diff --git a/gtk/gtkcssanimatedvaluesprivate.h b/gtk/gtkcssanimatedvaluesprivate.h index 1877d3bc60..65340f5d0c 100644 --- a/gtk/gtkcssanimatedvaluesprivate.h +++ b/gtk/gtkcssanimatedvaluesprivate.h @@ -39,7 +39,6 @@ struct _GtkCssAnimatedValues GtkCssComputedValues parent; gint64 current_time; /* the current time in our world */ - GtkCssComputedValues *computed; /* the computed values we'd have without animations */ GSList *animations; /* the running animations */ }; diff --git a/gtk/gtkcssanimation.c b/gtk/gtkcssanimation.c index c0964de2ba..48ef62bc49 100644 --- a/gtk/gtkcssanimation.c +++ b/gtk/gtkcssanimation.c @@ -125,9 +125,8 @@ gtk_css_animation_set_values (GtkStyleAnimation *style_animation, value = _gtk_css_keyframes_get_value (animation->keyframes, i, progress, - _gtk_css_computed_values_get_value (values, i)); - /* XXX: Is using 0 correct here? */ - _gtk_css_computed_values_set_value (values, property_id, value, 0, NULL); + _gtk_css_computed_values_get_intrinsic_value (values, i)); + _gtk_css_computed_values_set_animated_value (values, property_id, value); _gtk_css_value_unref (value); changed = _gtk_bitmask_set (changed, property_id, TRUE); diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c index d1287f2de6..bc50e66c77 100644 --- a/gtk/gtkcsstransition.c +++ b/gtk/gtkcsstransition.c @@ -52,8 +52,7 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation, value = _gtk_css_value_ref (transition->end); } - /* XXX: Is using 0 correct here? */ - _gtk_css_computed_values_set_value (values, transition->property, value, 0, NULL); + _gtk_css_computed_values_set_animated_value (values, transition->property, value); _gtk_css_value_unref (value); return _gtk_bitmask_set (changed, transition->property, TRUE); |