[gtk] cssimagebuiltin: Don't create cairo nodes for empty icons
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] cssimagebuiltin: Don't create cairo nodes for empty icons
- Date: Tue, 15 Oct 2019 05:14:19 +0000 (UTC)
commit bb56b4ef5d975fff91e7caa39e058d02fd7373bb
Author: Timm Bäder <mail baedert org>
Date: Tue Oct 15 07:13:28 2019 +0200
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.
gtk/gtkcssimagebuiltin.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c
index f377e44e89..e005eb6e2a 100644
--- a/gtk/gtkcssimagebuiltin.c
+++ b/gtk/gtkcssimagebuiltin.c
@@ -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);
+ }
}
-
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]