[Scummvm-tracker] [ScummVM :: Bugs] #14574: GOB: Excessive blitting drags performance down
ScummVM :: Bugs
trac at scummvm.org
Fri Mar 20 04:48:21 UTC 2026
#14574: GOB: Excessive blitting drags performance down
-----------------------------------+--------------------------
Reporter: mikrosk | Owner: sdelamarre
Type: defect | Status: new
Priority: normal | Component: Engine: Gob
Version: | Resolution:
Keywords: gobliiins, performance | Game: Gobliiins
-----------------------------------+--------------------------
Comment (by mikrosk):
I might have found both the culprit and fix at the same time.
{{{
void Goblin::drawObjects() {
Util::ListNode *ptr;
Util::ListNode *ptr2;
Gob_Object *objDesc;
Gob_Object *gobDesc2;
int16 layer;
ptr = _objList->pHead;
for (ptr = _objList->pHead; ptr != nullptr; ptr = ptr->pNext) {
objDesc = (Gob_Object *)ptr->pData;
if (objDesc->type == 3)
objDesc->toRedraw = 1;
else if (objDesc->type == 1)
objDesc->toRedraw = 0;
}
for (ptr = _objList->pHead; ptr != nullptr; ptr = ptr->pNext) {
objDesc = (Gob_Object *)ptr->pData;
if (objDesc->toRedraw == 0)
continue;
_vm->_draw->_backSurface->blit(*_vm->_mult->_animSurf,
objDesc->left, objDesc->top, objDesc->right,
objDesc->bottom, objDesc->left, objDesc->top);
_vm->_draw->invalidateRect(objDesc->left, objDesc->top,
objDesc->right, objDesc->bottom);
if (objDesc->type != 0)
continue;
layer =
objDesc->stateMach[objDesc->state][objDesc->stateColumn]->
layer;
_vm->_scenery->updateAnim(layer, objDesc->curFrame,
objDesc->animation,
0, objDesc->xPos, objDesc->yPos, 0);
if (_vm->_scenery->_toRedrawLeft == -12345) {
objDesc->dirtyLeft = objDesc->left;
objDesc->dirtyRight = objDesc->right;
objDesc->dirtyTop = objDesc->top;
objDesc->dirtyBottom = objDesc->bottom;
} else {
objDesc->dirtyLeft =
MIN(objDesc->left,
_vm->_scenery->_toRedrawLeft);
objDesc->dirtyRight =
MAX(objDesc->right,
_vm->_scenery->_toRedrawRight);
objDesc->dirtyTop =
MIN(objDesc->top,
_vm->_scenery->_toRedrawTop);
objDesc->dirtyBottom =
MAX(objDesc->bottom,
_vm->_scenery->_toRedrawBottom);
}
objDesc->dirtyLeft = 0;
objDesc->dirtyRight = 319;
objDesc->dirtyTop = 0;
objDesc->dirtyBottom = 199;
}
}}}
Note how for every object we carefully calculate its dirty rect only to
overwrite it with a fullscreen update!
This was there since its 2005 inception and I believe that it is some kind
of debug leftover. When I remove that override, number of blits is
decreased from 3700 to 10. :) And visually I couldn't notice any
difference.
--
Ticket URL: <https://bugs.scummvm.org/ticket/14574#comment:8>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM
More information about the Scummvm-tracker
mailing list