From d1ea591f18f71e059a76af8d659540c10293270a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Sun, 10 Feb 2019 10:27:27 +0100 Subject: [PATCH] rendericon: Ignore transparent icons If the recoloring would end up multiplying the alpha component with 0 anyway, just skip drawing anything altogether. This increases the icon count in the switch demo of the fishbowl from ~260 to ~280 on my system. --- gtk/gtkrendericon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c index 2d2dfa05f5..a4d867001f 100644 --- a/gtk/gtkrendericon.c +++ b/gtk/gtkrendericon.c @@ -133,6 +133,9 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, gtk_icon_theme_lookup_symbolic_colors (style, &fg, &sc, &wc, &ec); + if (fg.alpha == 0.0f) + goto transparent; + graphene_matrix_init_from_float (&color_matrix, (float[16]) { sc.red - fg.red, sc.green - fg.green, sc.blue - fg.blue, 0, wc.red - fg.red, wc.green - fg.green, wc.blue - fg.blue, 0, @@ -171,5 +174,6 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style, if (has_shadow) gtk_snapshot_pop (snapshot); +transparent: gtk_css_filter_value_pop_snapshot (filter_value, snapshot); } -- 2.30.2