diff options
author | Benjamin Otte <otte@redhat.com> | 2016-04-21 22:28:58 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2016-04-21 23:01:31 +0200 |
commit | c081ca2d4c589fb77e097ad5ee2a9978bd91d2ed (patch) | |
tree | 735246059bffd578b8fd51d88f59d599537f57df /gtk/gtkcssshadowvalue.c | |
parent | f93eca560494ff9ad7657db611296ea961de2ace (diff) | |
download | gtk+-c081ca2d4c589fb77e097ad5ee2a9978bd91d2ed.tar.gz |
cssshadowsvalue: Avoid allocating new value if not needed
Diffstat (limited to 'gtk/gtkcssshadowvalue.c')
-rw-r--r-- | gtk/gtkcssshadowvalue.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c index c06de2d0f1..93b4dcf927 100644 --- a/gtk/gtkcssshadowvalue.c +++ b/gtk/gtkcssshadowvalue.c @@ -77,6 +77,21 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow, spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style), color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style); + if (hoffset == shadow->hoffset && + voffset == shadow->voffset && + radius == shadow->radius && + spread == shadow->spread && + color == shadow->color) + { + _gtk_css_value_unref (hoffset); + _gtk_css_value_unref (voffset); + _gtk_css_value_unref (radius); + _gtk_css_value_unref (spread); + _gtk_css_value_unref (color); + + return _gtk_css_value_ref (shadow); + } + return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color); } |