1
0
Fork 0

Fix #11226: Don't draw story page elements that won't be visible.

When drawing the story page elements, all of them were drawn even if they are not visible. This can be a significant performance hit for long strings.
pull/13736/head
Peter Nelson 2025-03-04 12:51:58 +00:00
parent 27761ae431
commit ec27b82531
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 4 additions and 0 deletions

View File

@ -706,7 +706,11 @@ public:
/* Page elements */
this->EnsureStoryPageElementLayout();
for (const LayoutCacheElement &ce : this->layout_cache) {
if (ce.bounds.bottom - scrollpos < fr.top) continue;
y_offset = ce.bounds.top - scrollpos;
if (y_offset > fr.bottom) return;
switch (ce.pe->type) {
case SPET_TEXT:
y_offset = DrawStringMultiLine(ce.bounds.left, ce.bounds.right, ce.bounds.top - scrollpos, ce.bounds.bottom - scrollpos,