diff options
author | Joseph-Eugene Winzer | 2017-07-04 00:58:27 +0200 |
---|---|---|
committer | Thierry Crozat | 2018-01-22 23:42:08 +0000 |
commit | 4a68aef1d6d1a25f4084b1cd3dcdfb36ea36114c (patch) | |
tree | 68c97ab941e62247d616ca6e81568c5724555cd8 /engines | |
parent | 84eb970bb9af322ce3f054206a92603cd23f29cc (diff) | |
download | scummvm-rg350-4a68aef1d6d1a25f4084b1cd3dcdfb36ea36114c.tar.gz scummvm-rg350-4a68aef1d6d1a25f4084b1cd3dcdfb36ea36114c.tar.bz2 scummvm-rg350-4a68aef1d6d1a25f4084b1cd3dcdfb36ea36114c.zip |
SUPERNOVA: Fixes ScreenBufferStack
Diffstat (limited to 'engines')
-rw-r--r-- | engines/supernova/supernova.cpp | 13 | ||||
-rw-r--r-- | engines/supernova/supernova.h | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index e0adc7f548..4a4ede6ff5 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -595,11 +595,13 @@ void ScreenBufferStack::push(int x, int y, int width, int height, int pitch) { if (_last == ARRAYEND(_buffer)) return; - byte *pixels = new byte[width * height]; - const byte *screen = static_cast<byte *>(g_system->lockScreen()->getBasePtr(x, y)); + _last->_pixels = new byte[width * height]; + byte *pixels = _last->_pixels; + const byte *screen = static_cast<const byte *>(g_system->lockScreen()->getBasePtr(x, y)); for (int i = 0; i < height; ++i) { Common::copy(screen, screen + width, pixels); - screen += pitch * i; + screen += pitch; + pixels += width; } g_system->unlockScreen(); @@ -608,7 +610,6 @@ void ScreenBufferStack::push(int x, int y, int width, int height, int pitch) { _last->_width = width; _last->_height = height; _last->_pitch = pitch; - _last->_pixels = pixels; ++_last; } @@ -617,11 +618,13 @@ void ScreenBufferStack::restore() { if (_last == _buffer) return; + --_last; g_system->lockScreen()->copyRectToSurface( _last->_pixels, _last->_width, _last->_x, _last->_y, _last->_width, _last->_height); g_system->unlockScreen(); - --_last; + + delete[] _last->_pixels; } diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 7362438a69..78e9f72142 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -49,7 +49,7 @@ struct ScreenBuffer { , _width(0) , _height(0) , _pitch(0) - , _pixels(0) + , _pixels(NULL) {} byte *_pixels; |