diff options
author | Fabio Battaglia | 2009-03-17 08:03:29 +0000 |
---|---|---|
committer | Fabio Battaglia | 2009-03-17 08:03:29 +0000 |
commit | a9da116ceb318d3223bb515cad46f613dfdc0d36 (patch) | |
tree | eee5d71ad67a0304da19e1667806c7843fdbf999 | |
parent | ebfdd92727456174a5a2e8fe752c193f75805daf (diff) | |
download | scummvm-rg350-a9da116ceb318d3223bb515cad46f613dfdc0d36.tar.gz scummvm-rg350-a9da116ceb318d3223bb515cad46f613dfdc0d36.tar.bz2 scummvm-rg350-a9da116ceb318d3223bb515cad46f613dfdc0d36.zip |
sword1: optimize drawing routine for screen 54
svn-id: r39477
-rw-r--r-- | engines/sword1/screen.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp index 15df92b021..72ce14b427 100644 --- a/engines/sword1/screen.cpp +++ b/engines/sword1/screen.cpp @@ -376,17 +376,28 @@ void Screen::draw(void) { if(SwordEngine::isPsx()) { if (!_psxCache.decodedBackground) _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY); - src = _psxCache.decodedBackground; - } - + memcpy(_screenBuf, _psxCache.decodedBackground, _scrnSizeX * _scrnSizeY); + } else { +#if 0 for (uint16 cnty = 0; cnty < _scrnSizeY; cnty++) for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) { - if (*src) + if (*(src + cnty * _scrnSizeX + cntx)) if (!(SwordEngine::isMac()) || *src != 255) // see bug #1701058 - *dest = *src; - dest++; - src++; + *(dest + cnty * _scrnSizeX + cntx) = *(src + cnty * _scrnSizeX + cntx); } +#endif + + uint16 scrnScrlY = MIN((uint32)_oldScrollY, Logic::_scriptVars[SCROLL_OFFSET_Y]); + uint16 scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)Logic::_scriptVars[SCROLL_OFFSET_Y]); + + // In this background to create transparency we have to iterate through all pixels, avoid checking those out of screen + for (uint16 cnty = scrnScrlY; (cnty < _scrnSizeY) && (cnty < scrnHeight + scrnScrlY); cnty++) + for (uint16 cntx = 0; cntx < _scrnSizeX; cntx++) { + if (*(src + cnty * _scrnSizeX + cntx)) + if (!(SwordEngine::isMac()) || *src != 255) // see bug #1701058 + *(dest + cnty * _scrnSizeX + cntx) = *(src + cnty * _scrnSizeX + cntx); + } + } } else if (!(SwordEngine::isPsx())) { memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY); |