[gtk+] csscomputedvalues: Allow storing animated values here
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] csscomputedvalues: Allow storing animated values here
- Date: Mon, 17 Sep 2012 19:15:33 +0000 (UTC)
commit 94a3bd21e5c21f32420f9deb2eb794fde8b66564
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 13 14:25:52 2012 +0200
csscomputedvalues: Allow storing animated values here
It's not used yet, but that will come in the next patch(es). This is a
separate patch to make sure we didn't mess up anything.
gtk/gtkcsscomputedvalues.c | 40 ++++++++++++++++++++++++++++++++++++-
gtk/gtkcsscomputedvaluesprivate.h | 6 +++++
2 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 7f651a9..ea44341 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -42,6 +42,11 @@ gtk_css_computed_values_dispose (GObject *object)
g_ptr_array_unref (values->sections);
values->sections = NULL;
}
+ if (values->animated_values)
+ {
+ g_ptr_array_unref (values->animated_values);
+ values->animated_values = NULL;
+ }
G_OBJECT_CLASS (_gtk_css_computed_values_parent_class)->dispose (object);
}
@@ -127,7 +132,26 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
_gtk_css_value_unref (value);
_gtk_css_value_unref (specified);
}
-
+
+void
+_gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
+ guint id,
+ GtkCssValue *value)
+{
+ g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
+ g_return_if_fail (value != NULL);
+
+ if (values->animated_values == NULL)
+ values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
+ if (id >= values->animated_values->len)
+ g_ptr_array_set_size (values->animated_values, id + 1);
+
+ if (g_ptr_array_index (values->animated_values, id))
+ _gtk_css_value_unref (g_ptr_array_index (values->animated_values, id));
+ g_ptr_array_index (values->animated_values, id) = _gtk_css_value_ref (value);
+
+}
+
void
_gtk_css_computed_values_set_value (GtkCssComputedValues *values,
guint id,
@@ -172,6 +196,20 @@ _gtk_css_computed_values_get_value (GtkCssComputedValues *values,
{
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+ if (values->animated_values &&
+ id < values->animated_values->len &&
+ g_ptr_array_index (values->animated_values, id))
+ return g_ptr_array_index (values->animated_values, id);
+
+ return _gtk_css_computed_values_get_intrinsic_value (values, id);
+}
+
+GtkCssValue *
+_gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
+ guint id)
+{
+ g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+
if (values->values == NULL ||
id >= values->values->len)
return NULL;
diff --git a/gtk/gtkcsscomputedvaluesprivate.h b/gtk/gtkcsscomputedvaluesprivate.h
index 799121b..1ddc4a7 100644
--- a/gtk/gtkcsscomputedvaluesprivate.h
+++ b/gtk/gtkcsscomputedvaluesprivate.h
@@ -45,6 +45,7 @@ struct _GtkCssComputedValues
GPtrArray *values;
GPtrArray *sections;
+ GPtrArray *animated_values;
GtkBitmask *depends_on_parent;
GtkBitmask *equals_parent;
GtkBitmask *depends_on_color;
@@ -70,11 +71,16 @@ void _gtk_css_computed_values_set_value (GtkCssCom
GtkCssValue *value,
GtkCssDependencies dependencies,
GtkCssSection *section);
+void _gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
+ guint id,
+ GtkCssValue *value);
GtkCssValue * _gtk_css_computed_values_get_value (GtkCssComputedValues *values,
guint id);
GtkCssSection * _gtk_css_computed_values_get_section (GtkCssComputedValues *values,
guint id);
+GtkCssValue * _gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
+ guint id);
GtkBitmask * _gtk_css_computed_values_get_difference (GtkCssComputedValues *values,
GtkCssComputedValues *other);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]