diff options
author | Benjamin Otte <otte@redhat.com> | 2012-07-11 06:56:07 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-08-28 15:40:56 +0200 |
commit | 9b953829fbf1332d00c2ca8a99c7da5e4bda8c64 (patch) | |
tree | d11d83a1dbe54909d5ee729a77b55bfa4393649d /gtk/gtkcssshadowsvalue.c | |
parent | 3f00801e9aedd971378a6aad70e945903db7a798 (diff) | |
download | gtk+-9b953829fbf1332d00c2ca8a99c7da5e4bda8c64.tar.gz |
css: Introduce _gtk_css_value_compute()
This commit is essentially a large reorganization. Instead of all value
subtypes having their own compute function, there is the general
_gtk_css_value_compute() function that then calls a vfunc on the
subtype.
Diffstat (limited to 'gtk/gtkcssshadowsvalue.c')
-rw-r--r-- | gtk/gtkcssshadowsvalue.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/gtk/gtkcssshadowsvalue.c b/gtk/gtkcssshadowsvalue.c index d4f7655b52..2b105a5cd5 100644 --- a/gtk/gtkcssshadowsvalue.c +++ b/gtk/gtkcssshadowsvalue.c @@ -47,6 +47,25 @@ gtk_css_value_shadows_free (GtkCssValue *value) g_slice_free1 (sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (value->len - 1), value); } +static GtkCssValue * +gtk_css_value_shadows_compute (GtkCssValue *value, + GtkStyleContext *context) +{ + GtkCssValue *result; + guint i; + + if (value->len == 0) + return _gtk_css_value_ref (value); + + result = gtk_css_shadows_value_new (value->values, value->len); + for (i = 0; i < value->len; i++) + { + result->values[i] = _gtk_css_value_compute (value->values[i], context); + } + + return result; +} + static gboolean gtk_css_value_shadows_equal (const GtkCssValue *value1, const GtkCssValue *value2) @@ -132,6 +151,7 @@ gtk_css_value_shadows_print (const GtkCssValue *value, static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = { gtk_css_value_shadows_free, + gtk_css_value_shadows_compute, gtk_css_value_shadows_equal, gtk_css_value_shadows_transition, gtk_css_value_shadows_print @@ -190,27 +210,6 @@ _gtk_css_shadows_value_parse (GtkCssParser *parser) return result; } -GtkCssValue * -_gtk_css_shadows_value_compute (GtkCssValue *value, - GtkStyleContext *context) -{ - GtkCssValue *result; - guint i; - - g_return_val_if_fail (value->class == >K_CSS_VALUE_SHADOWS, NULL); - - if (value->len == 0) - return _gtk_css_value_ref (value); - - result = gtk_css_shadows_value_new (value->values, value->len); - for (i = 0; i < value->len; i++) - { - result->values[i] = _gtk_css_shadow_value_compute (value->values[i], context); - } - - return result; -} - void _gtk_css_shadows_value_paint_layout (const GtkCssValue *shadows, cairo_t *cr, |