mirror of https://github.com/OpenTTD/OpenTTD
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
parent
27761ae431
commit
8a09bb8127
|
@ -706,7 +706,11 @@ public:
|
||||||
/* Page elements */
|
/* Page elements */
|
||||||
this->EnsureStoryPageElementLayout();
|
this->EnsureStoryPageElementLayout();
|
||||||
for (const LayoutCacheElement &ce : this->layout_cache) {
|
for (const LayoutCacheElement &ce : this->layout_cache) {
|
||||||
|
if (ce.bounds.bottom - scrollpos < fr.top) continue;
|
||||||
|
|
||||||
y_offset = ce.bounds.top - scrollpos;
|
y_offset = ce.bounds.top - scrollpos;
|
||||||
|
if (y_offset > fr.bottom) return;
|
||||||
|
|
||||||
switch (ce.pe->type) {
|
switch (ce.pe->type) {
|
||||||
case SPET_TEXT:
|
case SPET_TEXT:
|
||||||
y_offset = DrawStringMultiLine(ce.bounds.left, ce.bounds.right, ce.bounds.top - scrollpos, ce.bounds.bottom - scrollpos,
|
y_offset = DrawStringMultiLine(ce.bounds.left, ce.bounds.right, ce.bounds.top - scrollpos, ce.bounds.bottom - scrollpos,
|
||||||
|
|
Loading…
Reference in New Issue