[gtk/misc-speedups: 11/11] sizerequest: Simplify some code




commit d76460343a9b91afda6cfe6a5fab6ad4732c6b34
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 24 18:44:33 2021 -0400

    sizerequest: Simplify some code
    
    Avoid some repeated MAX().

 gtk/gtksizerequest.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 0a1bc48774..45770d5498 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -234,13 +234,16 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
                                           &minimum_for_size, &natural_for_size,
                                           NULL, NULL);
 
-              if (for_size < MAX (minimum_for_size, css_min_for_size))
-                for_size = MAX (minimum_for_size, css_min_for_size);
+              if (minimum_for_size < css_min_for_size)
+                minimum_for_size = css_min_for_size;
+
+              if (for_size < minimum_for_size)
+                for_size = minimum_for_size;
 
               adjusted_for_size = for_size - widget_margins_for_size;
               adjusted_for_size -= css_extra_for_size;
               if (adjusted_for_size < 0)
-                adjusted_for_size = MAX (minimum_for_size, css_min_for_size);
+                adjusted_for_size = minimum_for_size;
 
               push_recursion_check (widget, orientation);
               gtk_layout_manager_measure (layout_manager, widget,
@@ -272,13 +275,16 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
               gtk_widget_measure (widget, OPPOSITE_ORIENTATION (orientation), -1,
                                   &minimum_for_size, &natural_for_size, NULL, NULL);
 
-              if (for_size < MAX (minimum_for_size, css_min_for_size))
-                for_size = MAX (minimum_for_size, css_min_for_size);
+              if (minimum_for_size < css_min_for_size)
+                minimum_for_size = css_min_for_size;
+
+              if (for_size < minimum_for_size)
+                for_size = minimum_for_size;
 
               adjusted_for_size = for_size - widget_margins_for_size;
               adjusted_for_size -= css_extra_for_size;
               if (adjusted_for_size < 0)
-                adjusted_for_size = MAX (minimum_for_size, css_min_for_size);
+                adjusted_for_size = minimum_for_size;
 
               push_recursion_check (widget, orientation);
               widget_class->measure (widget,


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