diff options
author | Martin Kiewitz | 2010-01-07 15:50:58 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-07 15:50:58 +0000 |
commit | 9577a45cdd70ca7b9e471434478f9eba8e60374e (patch) | |
tree | e6c831122e724c3155926583898676c1830201a7 | |
parent | 8e54ce73a50f167e1b1f6efc0d128e1a9482eca2 (diff) | |
download | scummvm-rg350-9577a45cdd70ca7b9e471434478f9eba8e60374e.tar.gz scummvm-rg350-9577a45cdd70ca7b9e471434478f9eba8e60374e.tar.bz2 scummvm-rg350-9577a45cdd70ca7b9e471434478f9eba8e60374e.zip |
SCI: fixed save/restorebits within screen class for displayscreen case, fixes kq6 menu bar
svn-id: r47125
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 1 | ||||
-rw-r--r-- | engines/sci/graphics/gfx.cpp | 10 | ||||
-rw-r--r-- | engines/sci/graphics/screen.cpp | 28 | ||||
-rw-r--r-- | engines/sci/graphics/screen.h | 4 |
4 files changed, 25 insertions, 18 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index ea323f84b8..dc83530762 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -266,6 +266,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) { case K_GRAPH_UPDATE_BOX: kGraphCreateRect(x, y, x1, y1, &rect); + // argc == 7 on upscaled hires s->_gui->graphUpdateBox(rect); break; diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index a6aed9ec5c..5f4e6a5b02 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -277,6 +277,12 @@ reg_t Gfx::BitsSave(const Common::Rect &rect, byte screenMask) { OffsetRect(workerRect); + if (screenMask == SCI_SCREEN_MASK_DISPLAY) { + // Adjust rect to upscaled hires + workerRect.top *= 2; workerRect.bottom *= 2; workerRect.bottom++; + workerRect.left *= 2; workerRect.right *= 2; workerRect.right++; + } + // now actually ask _screen how much space it will need for saving size = _screen->bitsGetDataSize(workerRect, screenMask); @@ -383,8 +389,8 @@ void Gfx::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo, u // adjust curPort to upscaled hires clipRect = celRect; curPortRect = _curPort->rect; - curPortRect.top *= 2; curPortRect.bottom *= 2; - curPortRect.left *= 2; curPortRect.right *= 2; + curPortRect.top *= 2; curPortRect.bottom *= 2; curPortRect.bottom++; + curPortRect.left *= 2; curPortRect.right *= 2; curPortRect.right++; clipRect.clip(curPortRect); if (clipRect.isEmpty()) // nothing to draw return; diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp index 6260645f53..a3131dec02 100644 --- a/engines/sci/graphics/screen.cpp +++ b/engines/sci/graphics/screen.cpp @@ -280,31 +280,31 @@ void Screen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & SCI_SCREEN_MASK_VISUAL) { - bitsSaveScreen(rect, _visualScreen, memoryPtr); + bitsSaveScreen(rect, _visualScreen, _width, memoryPtr); bitsSaveDisplayScreen(rect, memoryPtr); } if (mask & SCI_SCREEN_MASK_PRIORITY) { - bitsSaveScreen(rect, _priorityScreen, memoryPtr); + bitsSaveScreen(rect, _priorityScreen, _width, memoryPtr); } if (mask & SCI_SCREEN_MASK_CONTROL) { - bitsSaveScreen(rect, _controlScreen, memoryPtr); + bitsSaveScreen(rect, _controlScreen, _width, memoryPtr); } if (mask & SCI_SCREEN_MASK_DISPLAY) { if (!_upscaledHires) error("bitsSave() called w/o being in upscaled hires mode"); - bitsSaveScreen(rect, _displayScreen, memoryPtr); + bitsSaveScreen(rect, _displayScreen, _displayWidth, memoryPtr); } } -void Screen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { +void Screen::bitsSaveScreen(Common::Rect rect, byte *screen, uint16 screenWidth, byte *&memoryPtr) { int width = rect.width(); int y; - screen += (rect.top * _width) + rect.left; + screen += (rect.top * screenWidth) + rect.left; for (y = rect.top; y < rect.bottom; y++) { memcpy(memoryPtr, (void*)screen, width); memoryPtr += width; - screen += _width; + screen += screenWidth; } } @@ -339,31 +339,31 @@ void Screen::bitsRestore(byte *memoryPtr) { memcpy((void *)&mask, memoryPtr, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & SCI_SCREEN_MASK_VISUAL) { - bitsRestoreScreen(rect, memoryPtr, _visualScreen); + bitsRestoreScreen(rect, memoryPtr, _visualScreen, _width); bitsRestoreDisplayScreen(rect, memoryPtr); } if (mask & SCI_SCREEN_MASK_PRIORITY) { - bitsRestoreScreen(rect, memoryPtr, _priorityScreen); + bitsRestoreScreen(rect, memoryPtr, _priorityScreen, _width); } if (mask & SCI_SCREEN_MASK_CONTROL) { - bitsRestoreScreen(rect, memoryPtr, _controlScreen); + bitsRestoreScreen(rect, memoryPtr, _controlScreen, _width); } if (mask & SCI_SCREEN_MASK_DISPLAY) { if (!_upscaledHires) error("bitsRestore() called w/o being in upscaled hires mode"); - bitsRestoreScreen(rect, memoryPtr, _displayScreen); + bitsRestoreScreen(rect, memoryPtr, _displayScreen, _displayWidth); } } -void Screen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { +void Screen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen, uint16 screenWidth) { int width = rect.width(); int y; - screen += (rect.top * _width) + rect.left; + screen += (rect.top * screenWidth) + rect.left; for (y = rect.top; y < rect.bottom; y++) { memcpy((void*) screen, memoryPtr, width); memoryPtr += width; - screen += _width; + screen += screenWidth; } } diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h index 881025cec0..fcf8b2b002 100644 --- a/engines/sci/graphics/screen.h +++ b/engines/sci/graphics/screen.h @@ -106,9 +106,9 @@ private: byte _colorWhite; byte _colorDefaultVectorData; - void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen); + void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen, uint16 screenWidth); void bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr); - void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr); + void bitsSaveScreen(Common::Rect rect, byte *screen, uint16 screenWidth, byte *&memoryPtr); void bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr); bool _unditherState; |