summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-04-03 22:02:45 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-04-04 14:20:25 -0400
commit67ee6b274048deebfb31abf539d09ef4b5e579fe (patch)
treeac98f4e75ec8be6659bfb223ab04df00deb2027c
parent07a3fb833c06f9e0dd20b6357f6c26865e22b941 (diff)
downloadgtk+-67ee6b274048deebfb31abf539d09ef4b5e579fe.tar.gz
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.
-rw-r--r--gtk/gtktextlayout.c4
1 files changed, 3 insertions, 1 deletions
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,