aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sword1/screen.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index 985c62b52d..15df92b021 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -372,11 +372,11 @@ void Screen::draw(void) {
renderParallax(_parallax[0]);
uint8 *src = _layerBlocks[0];
uint8 *dest = _screenBuf;
- uint8 *indxScreen = NULL;
if(SwordEngine::isPsx()) {
- indxScreen = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
- src = indxScreen;
+ if (!_psxCache.decodedBackground)
+ _psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
+ src = _psxCache.decodedBackground;
}
for (uint16 cnty = 0; cnty < _scrnSizeY; cnty++)
@@ -388,8 +388,6 @@ void Screen::draw(void) {
src++;
}
- free(indxScreen);
-
} else if (!(SwordEngine::isPsx())) {
memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
} else { //We are using PSX version