[gtk/constraint-grid-2: 6/10] constraint layout: freeze/thaw on mass ops



commit db2ebb17ff8312bc9b2ab2f44dda8edca2ce20b3
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 29 05:06:56 2019 +0000

    constraint layout: freeze/thaw on mass ops
    
    In measure and allocate we are potentially
    changing quite a few constraints. Don't
    optimize at every step.

 gtk/gtkconstraintlayout.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index b3d0fe1d63..50670c2139 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -775,6 +775,8 @@ gtk_constraint_layout_measure (GtkLayoutManager *manager,
   if (solver == NULL)
     return;
 
+  gtk_constraint_solver_freeze (solver);
+
   /* We measure each child in the layout and impose restrictions on the
    * minimum and natural size, so we can solve the size of the overall
    * layout later on
@@ -799,6 +801,8 @@ gtk_constraint_layout_measure (GtkLayoutManager *manager,
       update_child_constraint (self, info, child, NAT_HEIGHT, nat_req.height);
     }
 
+  gtk_constraint_solver_thaw (solver);
+
   switch (orientation)
     {
     case GTK_ORIENTATION_HORIZONTAL:
@@ -904,6 +908,8 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
                      gtk_constraint_variable_get_value (layout_width),
                      gtk_constraint_variable_get_value (layout_height)));
 
+  gtk_constraint_solver_freeze (solver);
+
   /* We reset the constraints on the size of each child, so we are sure the
    * layout is up to date
    */
@@ -927,6 +933,8 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
       update_child_constraint (self, info, child, NAT_HEIGHT, nat_req.height);
     }
 
+  gtk_constraint_solver_thaw (solver);
+
   for (child = _gtk_widget_get_first_child (widget);
        child != NULL;
        child = _gtk_widget_get_next_sibling (child))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]