1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

[Complex Text Layouts] Performance optimizations.

This commit is contained in:
bruvzg
2020-12-01 15:03:31 +02:00
parent a41f1c67e5
commit 0ef483e9a9
7 changed files with 211 additions and 124 deletions

View File

@@ -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) {