1
0
Fork 0

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

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/13737/head
Peter Nelson 2025-03-04 13:38:37 +00:00 committed by GitHub
parent 27761ae431
commit 8a09bb8127
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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,