[gtk] widget: Re-shuffle preconditions in snapshot_child()



commit 203bb42cc1e2e2034b4d46dbcccd10fbf4f15cad
Author: Timm Bäder <mail baedert org>
Date:   Sat Jun 6 12:22:46 2020 +0200

    widget: Re-shuffle preconditions in snapshot_child()
    
    The GtkNative type check is more expensive than the mapped one, so avoid
    the former for unmapped widgets

 gtk/gtkwidget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a95c1cc13e..0986b25382 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12045,10 +12045,10 @@ gtk_widget_snapshot_child (GtkWidget   *widget,
   g_return_if_fail (_gtk_widget_get_parent (child) == widget);
   g_return_if_fail (snapshot != NULL);
 
-  if (GTK_IS_NATIVE (child))
+  if (!_gtk_widget_get_mapped (child))
     return;
 
-  if (!_gtk_widget_get_mapped (child))
+  if (GTK_IS_NATIVE (child))
     return;
 
   gtk_widget_do_snapshot (child, snapshot);


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