aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/screen.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2016-02-06 22:44:43 +0100
committerJohannes Schickel2016-02-06 22:50:53 +0100
commit74154f2101c55c261ad0113923fa9beafcbd387b (patch)
tree4271e2b6c13324df318f9e975393fc5f919603db /engines/sci/graphics/screen.cpp
parentd18483142d4a639c0965d65a8fb9ea2d3d5c0828 (diff)
downloadscummvm-rg350-74154f2101c55c261ad0113923fa9beafcbd387b.tar.gz
scummvm-rg350-74154f2101c55c261ad0113923fa9beafcbd387b.tar.bz2
scummvm-rg350-74154f2101c55c261ad0113923fa9beafcbd387b.zip
SCI: Properly use pitch in GfxScreen::copyFromScreen.
Diffstat (limited to 'engines/sci/graphics/screen.cpp')
-rw-r--r--engines/sci/graphics/screen.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index 4cd6344600..a76f462c7b 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -270,9 +270,21 @@ void GfxScreen::copyToScreen() {
}
void GfxScreen::copyFromScreen(byte *buffer) {
- // TODO this ignores the pitch
Graphics::Surface *screen = g_system->lockScreen();
- memcpy(buffer, screen->getPixels(), _displayPixels);
+
+ if (screen->pitch == _displayWidth) {
+ memcpy(buffer, screen->getPixels(), _displayPixels);
+ } else {
+ const byte *src = (const byte *)screen->getPixels();
+ uint height = _displayHeight;
+
+ while (height--) {
+ memcpy(buffer, src, _displayWidth);
+ buffer += _displayWidth;
+ src += screen->pitch;
+ }
+ }
+
g_system->unlockScreen();
}