diff options
author | Timm Bäder <mail@baedert.org> | 2017-04-24 18:23:53 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-04-25 13:05:27 +0200 |
commit | 3fe03d80a7e154fba03e3d72d675dca176344163 (patch) | |
tree | 9d707b137e39227618fbff91c4b9fdd6c2828c77 | |
parent | 5e602e438e9498449d43b77ddda2ce8c9484165c (diff) | |
download | gtk+-3fe03d80a7e154fba03e3d72d675dca176344163.tar.gz |
grid: Compute clip directly
Instead of iterating over the children again in
gtk_container_get_children_clip
-rw-r--r-- | gtk/gtkgrid.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index 7b794b1275..e1a944673a 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -1572,12 +1572,14 @@ allocate_child (GtkGridRequest *request, static void gtk_grid_request_allocate_children (GtkGridRequest *request, - const GtkAllocation *allocation) + const GtkAllocation *allocation, + GtkAllocation *out_clip) { GtkGridPrivate *priv = request->grid->priv; GList *list; GtkGridChild *child; GtkAllocation child_allocation; + GtkAllocation child_clip; gint x, y, width, height, baseline, ignore; for (list = priv->children; list; list = list->next) @@ -1600,6 +1602,8 @@ gtk_grid_request_allocate_children (GtkGridRequest *request, - (child_allocation.x - allocation->x) - child_allocation.width; gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline); + gtk_widget_get_clip (child->widget, &child_clip); + gdk_rectangle_union (out_clip, out_clip, &child_clip); } } @@ -1662,9 +1666,8 @@ gtk_grid_allocate (GtkCssGadget *gadget, gtk_grid_request_position (&request, 0); gtk_grid_request_position (&request, 1); - gtk_grid_request_allocate_children (&request, allocation); - - gtk_container_get_children_clip (GTK_CONTAINER (grid), out_clip); + *out_clip = *allocation; + gtk_grid_request_allocate_children (&request, allocation, out_clip); } static gboolean |