summaryrefslogtreecommitdiff
path: root/gtk/inspector/layoutoverlay.c
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2020-12-21 08:34:25 +0100
committerTimm Bäder <mail@baedert.org>2020-12-21 10:26:03 +0100
commitc34f98931e551b64141240820cd1eff218505b13 (patch)
treed0f33ba38d064dd8c6801e4cd6ae2bde9bb6725e /gtk/inspector/layoutoverlay.c
parent2feac2772fe79aadd9e0811b7ff8d44c19a276a6 (diff)
downloadgtk+-c34f98931e551b64141240820cd1eff218505b13.tar.gz
layoutoverlay: Avoid adding transparent color nodes
We have a region for the border here, but the color is defined as transparent black because we don't want to render anything for it. This way, the generated .node file for the listbox demo in gtk4-demo with enabled layout borders is 3.5MB instead of 3.8MB.
Diffstat (limited to 'gtk/inspector/layoutoverlay.c')
-rw-r--r--gtk/inspector/layoutoverlay.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gtk/inspector/layoutoverlay.c b/gtk/inspector/layoutoverlay.c
index 3924f03bb8..a72a40940e 100644
--- a/gtk/inspector/layoutoverlay.c
+++ b/gtk/inspector/layoutoverlay.c
@@ -107,6 +107,9 @@ recurse_child_widgets (GtkWidget *widget,
const GdkRGBA *color = &colors[i];
const GtkBorder *box = &boxes[i];
+ if (gdk_rgba_is_clear (color))
+ goto next;
+
if (box->top > 0)
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
@@ -120,6 +123,7 @@ recurse_child_widgets (GtkWidget *widget,
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
+next:
/* Grow box + offset */
width += box->left + box->right;
height += box->top + box->bottom;