diff options
author | Alexander Larsson <alexl@redhat.com> | 2012-03-08 14:52:10 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2012-03-08 14:52:10 +0100 |
commit | 616cc5b96dc6d04ec0dcb43fe1024dc5473bfc9b (patch) | |
tree | a9a2b4704f9ece7d5350362898d024f6ec945b32 /gtk/gtkcssstylefuncs.c | |
parent | 3cfd1d93dc303f21ef7593848ec63165eb1f5dad (diff) | |
download | gtk+-616cc5b96dc6d04ec0dcb43fe1024dc5473bfc9b.tar.gz |
Use GtkCssValue in symbolic color resolving
We now store the symbolic colors as a GtkCssValue which means that
we can reuse the color when resolving and storing the color in
the computed values in the style context.
Additionally we keep a last_resolved GtkCssValue cache in the
GtkSymbolicColor, and if resolving the color returns the same as
last time we reuse the old value. This further increases sharing
of Css Values.
Diffstat (limited to 'gtk/gtkcssstylefuncs.c')
-rw-r--r-- | gtk/gtkcssstylefuncs.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index b1e373e82a..0693e04487 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -215,7 +215,8 @@ static GtkCssValue * rgba_value_compute (GtkStyleContext *context, GtkCssValue *specified) { - GdkRGBA rgba, white = { 1, 1, 1, 1 }; + GdkRGBA white = { 1, 1, 1, 1 }; + GtkCssValue *res; if (_gtk_css_value_holds (specified, GTK_TYPE_CSS_SPECIAL_VALUE)) { @@ -227,12 +228,13 @@ rgba_value_compute (GtkStyleContext *context, if (symbolic == _gtk_symbolic_color_get_current_color ()) return _gtk_css_value_ref (_gtk_style_context_peek_property (context, "color")); - else if (_gtk_style_context_resolve_color (context, - symbolic, - &rgba)) - return _gtk_css_value_new_from_rgba (&rgba); - else + else { + res = _gtk_style_context_resolve_color_value (context, symbolic); + if (res != NULL) + return res; + return _gtk_css_value_new_from_rgba (&white); + } } else return _gtk_css_value_ref (specified); |