cssimagebuiltin: Don't create cairo nodes for empty icons

GTK_CSS_IMAGE_BUILTIN_NONE is not going to draw anything of course, so
don't bother creating an empty cairo node for it.
This commit is contained in:
Timm Bäder 2019-10-15 07:13:28 +02:00
parent 5ea21f7910
commit bb56b4ef5d

View File

@ -649,8 +649,6 @@ gtk_css_image_builtin_snapshot (GtkCssImage *image,
double height,
GtkCssImageBuiltinType image_type)
{
cairo_t *cr;
g_return_if_fail (GTK_IS_CSS_IMAGE (image));
g_return_if_fail (snapshot != NULL);
g_return_if_fail (width > 0);
@ -662,10 +660,11 @@ gtk_css_image_builtin_snapshot (GtkCssImage *image,
return;
}
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_css_image_builtin_draw (image, cr, width, height, image_type);
cairo_destroy (cr);
if (image_type != GTK_CSS_IMAGE_BUILTIN_NONE)
{
cairo_t *cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_css_image_builtin_draw (image, cr, width, height, image_type);
cairo_destroy (cr);
}
}