summaryrefslogtreecommitdiffstats
path: root/scene/gui/text_edit.cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-12-01 15:03:31 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-12-07 08:53:02 +0200
commit0ef483e9a940e8a2e236f923f1625a4aba77978a (patch)
treeb673eae966583ecf99ffc399b28cae3f82aad000 /scene/gui/text_edit.cpp
parenta41f1c67e5d45e08f38d55af2d0680c2b5fb2446 (diff)
downloadredot-engine-0ef483e9a940e8a2e236f923f1625a4aba77978a.tar.gz
[Complex Text Layouts] Performance optimizations.
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r--scene/gui/text_edit.cpp7
1 files changed, 5 insertions, 2 deletions
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<TextServer::Glyph> glyphs = TS->shaped_text_get_glyphs(rid);
+ const Vector<TextServer::Glyph> 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) {