diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-09-28 01:43:03 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-09-28 06:29:51 -0400 |
commit | 130fc6ce9bb8e5df381b9e6956fb42ea889bb769 (patch) | |
tree | d983bd9bd52883d3d28eaf762db3b2f38653f804 /gtk/gtkcssstyle.c | |
parent | ac198a3ce6548b59d7833add4ac8853060ab1b39 (diff) | |
download | gtk+-130fc6ce9bb8e5df381b9e6956fb42ea889bb769.tar.gz |
css style: Accumulate changes in place
This avoids allocating a temporary bitmask, and lets us
avoid some value comparisons altogether.
Diffstat (limited to 'gtk/gtkcssstyle.c')
-rw-r--r-- | gtk/gtkcssstyle.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c index c4afe13468..d577dc79d3 100644 --- a/gtk/gtkcssstyle.c +++ b/gtk/gtkcssstyle.c @@ -83,25 +83,27 @@ gtk_css_style_get_section (GtkCssStyle *style, } GtkBitmask * -gtk_css_style_get_difference (GtkCssStyle *style, +gtk_css_style_add_difference (GtkBitmask *accumulated, + GtkCssStyle *style, GtkCssStyle *other) { - GtkBitmask *result; - guint i, len; + gint len, i; if (style == other) - return _gtk_bitmask_new (); + return accumulated; - result = _gtk_bitmask_new (); len = _gtk_css_style_property_get_n_properties (); for (i = 0; i < len; i++) { + if (_gtk_bitmask_get (accumulated, i)) + continue; + if (!_gtk_css_value_equal (gtk_css_style_get_value (style, i), gtk_css_style_get_value (other, i))) - result = _gtk_bitmask_set (result, i, TRUE); + accumulated = _gtk_bitmask_set (accumulated, i, TRUE); } - return result; + return accumulated; } gboolean |