[gtk+/wip/cssstyle: 18/27] stylecontext: Simplify code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssstyle: 18/27] stylecontext: Simplify code
- Date: Wed, 24 Dec 2014 02:20:54 +0000 (UTC)
commit 46aacab47646d56e597205a16d4e6d2beb3b1a47
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 16 06:40:10 2014 +0100
stylecontext: Simplify code
Compute the differences only once and not in both if branches.
gtk/gtkstylecontext.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 8509aa2..e09af0e 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2824,16 +2824,6 @@ _gtk_style_context_validate (GtkStyleContext *context,
style_info_set_values (info, values);
_gtk_style_context_update_animating (context);
- if (current)
- {
- changes = gtk_css_style_get_difference (values, current);
- }
- else
- {
- changes = _gtk_bitmask_new ();
- changes = _gtk_bitmask_invert_range (changes, 0, _gtk_css_style_property_get_n_properties ());
- }
-
g_object_unref (values);
}
else
@@ -2848,21 +2838,17 @@ _gtk_style_context_validate (GtkStyleContext *context,
else
update_properties (context, current, info->decl, changes);
}
+ _gtk_bitmask_free (changes);
if (change & GTK_CSS_CHANGE_ANIMATE &&
gtk_style_context_is_animating (context))
{
GtkCssStyle *new_values;
- GtkBitmask *animation_changes;
new_values = gtk_css_animated_style_new_advance (GTK_CSS_ANIMATED_STYLE (info->values), timestamp);
- animation_changes = gtk_css_style_get_difference (new_values, info->values);
style_info_set_values (info, new_values);
g_object_unref (new_values);
- changes = _gtk_bitmask_union (changes, animation_changes);
- _gtk_bitmask_free (animation_changes);
-
if (!GTK_IS_CSS_ANIMATED_STYLE (info->values) ||
gtk_css_animated_style_is_static (GTK_CSS_ANIMATED_STYLE (info->values)))
_gtk_style_context_update_animating (context);
@@ -2870,7 +2856,15 @@ _gtk_style_context_validate (GtkStyleContext *context,
}
if (current)
- g_object_unref (current);
+ {
+ changes = gtk_css_style_get_difference (info->values, current);
+ g_object_unref (current);
+ }
+ else
+ {
+ changes = _gtk_bitmask_new ();
+ changes = _gtk_bitmask_invert_range (changes, 0, _gtk_css_style_property_get_n_properties ());
+ }
if (!_gtk_bitmask_is_empty (changes))
gtk_style_context_do_invalidate (context, changes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]