[gtk+/wip/css: 18/37] csscomputedvalues: Store animated values here
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 18/37] csscomputedvalues: Store animated values here
- Date: Mon, 17 Sep 2012 15:09:52 +0000 (UTC)
commit 2a46da8cf9607a65a5d867616429e05e7fdd665c
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 13 16:23:36 2012 +0200
csscomputedvalues: Store animated values here
Actually use the GtkCssComputedValues to store the computed values here
instead of putting them into the GtkCssAnimatedValues separately.
gtk/gtkcssanimatedvalues.c | 20 +++++++++++---------
gtk/gtkcssanimatedvaluesprivate.h | 1 -
gtk/gtkcssanimation.c | 5 ++---
gtk/gtkcsstransition.c | 3 +--
4 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkcssanimatedvalues.c b/gtk/gtkcssanimatedvalues.c
index 92bd1e4..c7f9d0e 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 1877d3b..65340f5 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 c0964de..48ef62b 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 d1287f2..bc50e66 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]