Don't create render nodes for empty backgrounds

This commit is contained in:
Matthias Clasen 2016-08-12 18:23:25 -04:00 committed by Emmanuele Bassi
parent cffb8ae4b5
commit b660361fb7

View File

@ -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);