[gtk+/wip/css: 28/37] csscomputedvalues: Compute the changes by animations ourselves



commit a96c178f19b2bebad35b9801fc53056015a6c608
Author: Benjamin Otte <otte redhat com>
Date:   Sun Sep 16 18:51:07 2012 +0200

    csscomputedvalues: Compute the changes by animations ourselves
    
    Instead of letting the animation set a bitmask unconditionally, actually
    compare the before and after values for changes.

 gtk/gtkcsscomputedvalues.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 1450068..98d827d 100644
--- a/gtk/gtkcsscomputedvalues.c
+++ b/gtk/gtkcsscomputedvalues.c
@@ -508,6 +508,7 @@ _gtk_css_computed_values_advance (GtkCssComputedValues *values,
   GtkBitmask *changed;
   GPtrArray *old_computed_values;
   GSList *list;
+  guint i;
 
   g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
   g_return_val_if_fail (timestamp >= values->current_time, NULL);
@@ -536,7 +537,23 @@ _gtk_css_computed_values_advance (GtkCssComputedValues *values,
           g_object_unref (animation);
         }
     }
+
+  _gtk_bitmask_free (changed);
   
+  /* figure out changes */
+  changed = _gtk_bitmask_new ();
+
+  for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
+    {
+      GtkCssValue *old_animated, *new_animated;
+
+      old_animated = old_computed_values && i < old_computed_values->len ? g_ptr_array_index (old_computed_values, i) : NULL;
+      new_animated = values->animated_values && i < values->animated_values->len ? g_ptr_array_index (values->animated_values, i) : NULL;
+
+      if (!_gtk_css_value_equal0 (old_animated, new_animated))
+        changed = _gtk_bitmask_set (changed, i, TRUE);
+    }
+
   if (old_computed_values)
     g_ptr_array_unref (old_computed_values);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]