From 0ef483e9a940e8a2e236f923f1625a4aba77978a Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 1 Dec 2020 15:03:31 +0200 Subject: [Complex Text Layouts] Performance optimizations. --- scene/gui/text_edit.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scene/gui/text_edit.cpp') diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 051fcef8f4..906dd94fff 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1240,10 +1240,13 @@ void TextEdit::_notification(int p_what) { ofs_y += (row_height - text_height) / 2; - const Vector glyphs = TS->shaped_text_get_glyphs(rid); + const Vector visual = TS->shaped_text_get_glyphs(rid); + const TextServer::Glyph *glyphs = visual.ptr(); + int gl_size = visual.size(); + ofs_y += ldata->get_line_ascent(line_wrap_index); float char_ofs = 0.f; - for (int j = 0; j < glyphs.size(); j++) { + for (int j = 0; j < gl_size; j++) { if (color_map.has(glyphs[j].start)) { current_color = color_map[glyphs[j].start].get("color"); if (readonly && current_color.a > cache.font_color_readonly.a) { -- cgit v1.2.3