[gtk/f16c.msvc: 5/61] textlayout: Don't call render_para too much




commit 69f7a2d38dda43307f7b4df8e84e6473056a6780
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 3 22:02:45 2021 -0400

    textlayout: Don't call render_para too much
    
    render_para produces no nodes for an empty paragraph.
    Don't call it over and over for those.

 gtk/gtktextlayout.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index ae6ed3bb31..4ab2b5cd4d 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -4245,7 +4245,9 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
                 g_clear_pointer (&line_display->node, gsk_render_node_unref);
             }
 
-          if (line_display->node == NULL)
+          if (line_display->node == NULL &&
+              (pango_layout_get_character_count (line_display->layout) > 0 ||
+               selection_start_index != -1 || selection_end_index != -1))
             {
               gtk_snapshot_push_collect (snapshot);
               render_para (crenderer, line_display,


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