diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-01 15:03:31 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-07 08:53:02 +0200 |
commit | 0ef483e9a940e8a2e236f923f1625a4aba77978a (patch) | |
tree | b673eae966583ecf99ffc399b28cae3f82aad000 /scene/gui/line_edit.cpp | |
parent | a41f1c67e5d45e08f38d55af2d0680c2b5fb2446 (diff) | |
download | redot-engine-0ef483e9a940e8a2e236f923f1625a4aba77978a.tar.gz |
[Complex Text Layouts] Performance optimizations.
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r-- | scene/gui/line_edit.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 299c1f2f8a..d06bdaad91 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -834,11 +834,13 @@ void LineEdit::_notification(int p_what) { RenderingServer::get_singleton()->canvas_item_add_rect(ci, rect, selection_color); } } - const Vector<TextServer::Glyph> glyphs = TS->shaped_text_get_glyphs(text_rid); + const Vector<TextServer::Glyph> visual = TS->shaped_text_get_glyphs(text_rid); + const TextServer::Glyph *glyphs = visual.ptr(); + int gl_size = visual.size(); // Draw text. ofs.y += TS->shaped_text_get_ascent(text_rid); - for (int i = 0; i < glyphs.size(); i++) { + for (int i = 0; i < gl_size; i++) { bool selected = selection.enabled && glyphs[i].start >= selection.begin && glyphs[i].end <= selection.end; for (int j = 0; j < glyphs[i].repeat; j++) { if (ceil(ofs.x) >= x_ofs && (ofs.x + glyphs[i].advance) <= ofs_max) { |