[gtk+/composite-templates] cssanimation: Don't store the end value in a CSS transition
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates] cssanimation: Don't store the end value in a CSS transition
- Date: Sat, 6 Oct 2012 17:10:05 +0000 (UTC)
commit 70d541545ad696815b6b51885fb5867a7fa5b92a
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 1 13:09:49 2012 +0200
cssanimation: Don't store the end value in a CSS transition
Instead, query the intrinsic value at runtime.
gtk/gtkcsscomputedvalues.c | 1 -
gtk/gtkcsstransition.c | 14 ++++++--------
gtk/gtkcsstransitionprivate.h | 2 --
3 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 12424cc..ff89eee 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -412,7 +412,6 @@ gtk_css_computed_values_create_css_transitions (GtkCssComputedValues *values,
{
animation = _gtk_css_transition_new (i,
start,
- end,
_gtk_css_array_value_get_nth (timing_functions, i),
timestamp + delay * G_USEC_PER_SEC,
timestamp + (delay + duration) * G_USEC_PER_SEC);
diff --git a/gtk/gtkcsstransition.c b/gtk/gtkcsstransition.c
index 8aa7737..bbd2dcc 100644
--- a/gtk/gtkcsstransition.c
+++ b/gtk/gtkcsstransition.c
@@ -31,24 +31,26 @@ gtk_css_transition_set_values (GtkStyleAnimation *animation,
GtkCssComputedValues *values)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
- GtkCssValue *value;
+ GtkCssValue *value, *end;
double progress;
+ end = _gtk_css_computed_values_get_intrinsic_value (values, transition->property);
+
if (transition->start_time >= for_time_us)
value = _gtk_css_value_ref (transition->start);
else if (transition->end_time <= for_time_us)
- value = _gtk_css_value_ref (transition->end);
+ value = _gtk_css_value_ref (end);
else
{
progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time);
progress = _gtk_css_ease_value_transform (transition->ease, progress);
value = _gtk_css_value_transition (transition->start,
- transition->end,
+ end,
transition->property,
progress);
if (value == NULL)
- value = _gtk_css_value_ref (transition->end);
+ value = _gtk_css_value_ref (end);
}
_gtk_css_computed_values_set_animated_value (values, transition->property, value);
@@ -79,7 +81,6 @@ gtk_css_transition_finalize (GObject *object)
GtkCssTransition *transition = GTK_CSS_TRANSITION (object);
_gtk_css_value_unref (transition->start);
- _gtk_css_value_unref (transition->end);
_gtk_css_value_unref (transition->ease);
G_OBJECT_CLASS (_gtk_css_transition_parent_class)->finalize (object);
@@ -106,7 +107,6 @@ _gtk_css_transition_init (GtkCssTransition *transition)
GtkStyleAnimation *
_gtk_css_transition_new (guint property,
GtkCssValue *start,
- GtkCssValue *end,
GtkCssValue *ease,
gint64 start_time_us,
gint64 end_time_us)
@@ -114,7 +114,6 @@ _gtk_css_transition_new (guint property,
GtkCssTransition *transition;
g_return_val_if_fail (start != NULL, NULL);
- g_return_val_if_fail (end != NULL, NULL);
g_return_val_if_fail (ease != NULL, NULL);
g_return_val_if_fail (start_time_us <= end_time_us, NULL);
@@ -122,7 +121,6 @@ _gtk_css_transition_new (guint property,
transition->property = property;
transition->start = _gtk_css_value_ref (start);
- transition->end = _gtk_css_value_ref (end);
transition->ease = _gtk_css_value_ref (ease);
transition->start_time = start_time_us;
transition->end_time = end_time_us;
diff --git a/gtk/gtkcsstransitionprivate.h b/gtk/gtkcsstransitionprivate.h
index c8af3fc..2d075b0 100644
--- a/gtk/gtkcsstransitionprivate.h
+++ b/gtk/gtkcsstransitionprivate.h
@@ -40,7 +40,6 @@ struct _GtkCssTransition
guint property;
GtkCssValue *start;
- GtkCssValue *end;
GtkCssValue *ease;
gint64 start_time;
gint64 end_time;
@@ -55,7 +54,6 @@ GType _gtk_css_transition_get_type (void) G_GNUC_CONST;
GtkStyleAnimation * _gtk_css_transition_new (guint property,
GtkCssValue *start,
- GtkCssValue *end,
GtkCssValue *ease,
gint64 start_time_us,
gint64 end_time_us);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]