summaryrefslogtreecommitdiffstats
path: root/scene/gui/line_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/line_edit.cpp
parenta41f1c67e5d45e08f38d55af2d0680c2b5fb2446 (diff)
downloadredot-engine-0ef483e9a940e8a2e236f923f1625a4aba77978a.tar.gz
[Complex Text Layouts] Performance optimizations.
Diffstat (limited to 'scene/gui/line_edit.cpp')
-rw-r--r--scene/gui/line_edit.cpp6
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) {