1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-05 17:15:09 +00:00

Fix unnecessary break when calculating the height of visible lines

This break causes the minsize to be smaller than expected, and then
the size keeps increasing by one line to cover all visible lines.
This can cause performance issues when there are many visible lines.
This commit is contained in:
Rindbee
2023-05-20 22:58:14 +08:00
parent 809a982162
commit e5bebbc9ff

View File

@@ -290,9 +290,6 @@ void Label::_update_visible() {
int last_line = MIN(lines_rid.size(), lines_visible + lines_skipped); int last_line = MIN(lines_rid.size(), lines_visible + lines_skipped);
for (int64_t i = lines_skipped; i < last_line; i++) { for (int64_t i = lines_skipped; i < last_line; i++) {
minsize.height += TS->shaped_text_get_size(lines_rid[i]).y + line_spacing; minsize.height += TS->shaped_text_get_size(lines_rid[i]).y + line_spacing;
if (minsize.height > (get_size().height - style->get_minimum_size().height + line_spacing)) {
break;
}
} }
} }