diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-08-12 18:23:25 -0400 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2016-10-18 11:49:14 +0100 |
commit | b660361fb71b40346088b75ec70e9873bbc0dd01 (patch) | |
tree | ce26689a7b627e2a51a5c42220f9db1ba90bff71 /gtk/gtkrenderbackground.c | |
parent | cffb8ae4b50a9397c0c953a6e7d86a75fc018dc4 (diff) | |
download | gtk+-b660361fb71b40346088b75ec70e9873bbc0dd01.tar.gz |
Don't create render nodes for empty backgrounds
Diffstat (limited to 'gtk/gtkrenderbackground.c')
-rw-r--r-- | gtk/gtkrenderbackground.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index b87724537f..1189e4c9ac 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -442,6 +442,20 @@ gtk_css_style_add_background_render_nodes (GtkCssStyle *style, { GskRenderNode *bg_node; cairo_t *cr; + GtkCssValue *background_image; + GtkCssValue *box_shadow; + const GdkRGBA *bg_color; + + background_image = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE); + bg_color = _gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR)); + box_shadow = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW); + + /* This is the common default case of no background */ + if (gtk_rgba_is_clear (bg_color) && + _gtk_css_array_value_get_n_values (background_image) == 1 && + _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background_image, 0)) == NULL && + _gtk_css_shadows_value_is_none (box_shadow)) + return; bg_node = gsk_renderer_create_render_node (renderer); gsk_render_node_set_name (bg_node, name); |