forked from AuroraMiddleware/gtk
layoutoverlay: Avoid adding 0 sized color nodes
This way, the output node file of the listbox demo in gtk4-demo with enabled layout borders is only 3.8MB instead of 12MB.
This commit is contained in:
parent
fdda4e4e99
commit
2feac2772f
@ -65,9 +65,9 @@ static void
|
||||
recurse_child_widgets (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
gboolean needs_clip;
|
||||
int width = gtk_widget_get_width (widget);
|
||||
int height = gtk_widget_get_height (widget);
|
||||
gboolean needs_clip;
|
||||
GtkCssStyle *style;
|
||||
GtkWidget *child;
|
||||
GtkBorder boxes[4];
|
||||
@ -107,12 +107,16 @@ recurse_child_widgets (GtkWidget *widget,
|
||||
const GdkRGBA *color = &colors[i];
|
||||
const GtkBorder *box = &boxes[i];
|
||||
|
||||
if (box->top > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
|
||||
if (box->right > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (width, 0, box->right, height));
|
||||
if (box->bottom > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (0, height, width, box->bottom));
|
||||
if (box->left > 0)
|
||||
gtk_snapshot_append_color (snapshot, color,
|
||||
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user