diff options
author | Martin Kiewitz | 2009-10-17 21:11:56 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-17 21:11:56 +0000 |
commit | 0af29fa746c1f9e71aedcf867ff05efa85609798 (patch) | |
tree | 727a917bd41ca6abcad032aebc9ae1b71b5361d7 /engines/sci | |
parent | d807d259b9b29b0603dbfd0ceeba48ec585a8753 (diff) | |
download | scummvm-rg350-0af29fa746c1f9e71aedcf867ff05efa85609798.tar.gz scummvm-rg350-0af29fa746c1f9e71aedcf867ff05efa85609798.tar.bz2 scummvm-rg350-0af29fa746c1f9e71aedcf867ff05efa85609798.zip |
SCI/newgui: kDisplay restoreUnder completed
svn-id: r45202
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gui/gui.cpp | 6 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 39 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 1 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.cpp | 30 | ||||
-rw-r--r-- | engines/sci/gui/gui_screen.h | 11 |
5 files changed, 52 insertions, 35 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 3a8dec5650..353dfc5bd8 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -223,10 +223,10 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { doSaveUnder = true; break; case SCI_DISPLAY_RESTOREUNDER: - // TODO: get rect from SciMemoryHandle (argv[0]) - //rect.translate(-_gfx->GetPort()->left, -_gfx->GetPort()->top); + _gfx->BitsGetRect(argv[0], &rect); + rect.translate(-_gfx->GetPort()->left, -_gfx->GetPort()->top); _gfx->BitsRestore(argv[0]); - // TODO: ReAnimate(pArgs) + _animate->reAnimate(rect); // finishing loop argc = 0; break; diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index de26e15452..22e8d036cf 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -588,15 +588,14 @@ void SciGuiGfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect, PenColor(orgPenColor); } -// Update (part of) screen -void SciGuiGfx::BitsShow(const Common::Rect &r) { - Common::Rect rect(r.left, r.top, r.right, r.bottom); - rect.clip(_curPort->rect); - if (rect.isEmpty()) // nothing to show +void SciGuiGfx::BitsShow(const Common::Rect &rect) { + Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom); + workerRect.clip(_curPort->rect); + if (workerRect.isEmpty()) // nothing to show return; - OffsetRect(rect); - _screen->copyRectToScreen(rect); + OffsetRect(workerRect); + _screen->copyRectToScreen(workerRect); } GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) { @@ -604,22 +603,34 @@ GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) { byte *memoryPtr; int size; - Common::Rect r(rect.left, rect.top, rect.right, rect.bottom); - r.clip(_curPort->rect); - if (r.isEmpty()) // nothing to save + Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom); + workerRect.clip(_curPort->rect); + if (workerRect.isEmpty()) // nothing to save return NULL_REG; - OffsetRect(r); //local port coords to screen coords + OffsetRect(workerRect); // now actually ask _screen how much space it will need for saving - size = _screen->getBitsDataSize(r, screenMask); + size = _screen->bitsGetDataSize(workerRect, screenMask); memoryId = kalloc(_s->_segMan, "SaveBits()", size); memoryPtr = kmem(_s->_segMan, memoryId); - _screen->saveBits(r, screenMask, memoryPtr); + _screen->bitsSave(workerRect, screenMask, memoryPtr); return memoryId; } +void SciGuiGfx::BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect) { + byte *memoryPtr = NULL; + + if (!memoryHandle.isNull()) { + memoryPtr = kmem(_s->_segMan, memoryHandle);; + + if (memoryPtr) { + _screen->bitsGetRect(memoryPtr, destRect); + } + } +} + void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) { byte *memoryPtr = NULL; @@ -627,7 +638,7 @@ void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) { memoryPtr = kmem(_s->_segMan, memoryHandle);; if (memoryPtr) { - _screen->restoreBits(memoryPtr); + _screen->bitsRestore(memoryPtr); kfree(_s->_segMan, memoryHandle); } } diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index 1cb4e7a037..64c34516e1 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -90,6 +90,7 @@ public: void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId); void BitsShow(const Common::Rect &r); GuiMemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags); + void BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect); void BitsRestore(GuiMemoryHandle memoryHandle); void BitsFree(GuiMemoryHandle memoryHandle); diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index 90f7875a9f..56b221f2dc 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -194,7 +194,7 @@ byte SciGuiScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color, return match; } -int SciGuiScreen::getBitsDataSize(Common::Rect rect, byte mask) { +int SciGuiScreen::bitsGetDataSize(Common::Rect rect, byte mask) { int byteCount = sizeof(rect) + sizeof(mask); int pixels = rect.width() * rect.height(); if (mask & SCI_SCREEN_MASK_VISUAL) { @@ -211,23 +211,23 @@ int SciGuiScreen::getBitsDataSize(Common::Rect rect, byte mask) { return byteCount; } -void SciGuiScreen::saveBits(Common::Rect rect, byte mask, byte *memoryPtr) { +void SciGuiScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) { memcpy(memoryPtr, (void *)&rect, sizeof(rect)); memoryPtr += sizeof(rect); memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & SCI_SCREEN_MASK_VISUAL) { - saveBitsScreen(rect, _visualScreen, memoryPtr); - saveBitsScreen(rect, _displayScreen, memoryPtr); + bitsSaveScreen(rect, _visualScreen, memoryPtr); + bitsSaveScreen(rect, _displayScreen, memoryPtr); } if (mask & SCI_SCREEN_MASK_PRIORITY) { - saveBitsScreen(rect, _priorityScreen, memoryPtr); + bitsSaveScreen(rect, _priorityScreen, memoryPtr); } if (mask & SCI_SCREEN_MASK_CONTROL) { - saveBitsScreen(rect, _controlScreen, memoryPtr); + bitsSaveScreen(rect, _controlScreen, memoryPtr); } } -void SciGuiScreen::saveBitsScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { +void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) { int width = rect.width(); int y; @@ -239,7 +239,11 @@ void SciGuiScreen::saveBitsScreen(Common::Rect rect, byte *screen, byte *&memory } } -void SciGuiScreen::restoreBits(byte *memoryPtr) { +void SciGuiScreen::bitsGetRect(byte *memoryPtr, Common::Rect *destRect) { + memcpy((void *)destRect, memoryPtr, sizeof(Common::Rect)); +} + +void SciGuiScreen::bitsRestore(byte *memoryPtr) { Common::Rect rect; byte mask; @@ -247,18 +251,18 @@ void SciGuiScreen::restoreBits(byte *memoryPtr) { memcpy((void *)&mask, memoryPtr, sizeof(mask)); memoryPtr += sizeof(mask); if (mask & SCI_SCREEN_MASK_VISUAL) { - restoreBitsScreen(rect, memoryPtr, _visualScreen); - restoreBitsScreen(rect, memoryPtr, _displayScreen); + bitsRestoreScreen(rect, memoryPtr, _visualScreen); + bitsRestoreScreen(rect, memoryPtr, _displayScreen); } if (mask & SCI_SCREEN_MASK_PRIORITY) { - restoreBitsScreen(rect, memoryPtr, _priorityScreen); + bitsRestoreScreen(rect, memoryPtr, _priorityScreen); } if (mask & SCI_SCREEN_MASK_CONTROL) { - restoreBitsScreen(rect, memoryPtr, _controlScreen); + bitsRestoreScreen(rect, memoryPtr, _controlScreen); } } -void SciGuiScreen::restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { +void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) { int width = rect.width(); int y; diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h index 179a7de3e8..74c5c53bc1 100644 --- a/engines/sci/gui/gui_screen.h +++ b/engines/sci/gui/gui_screen.h @@ -61,9 +61,10 @@ public: byte getControl(int x, int y); byte isFillMatch(int16 x, int16 y, byte drawMask, byte t_color, byte t_pri, byte t_con); - int getBitsDataSize(Common::Rect rect, byte mask); - void saveBits(Common::Rect rect, byte mask, byte *memoryPtr); - void restoreBits(byte *memoryPtr); + int bitsGetDataSize(Common::Rect rect, byte mask); + void bitsSave(Common::Rect rect, byte mask, byte *memoryPtr); + void bitsGetRect(byte *memoryPtr, Common::Rect *destRect); + void bitsRestore(byte *memoryPtr); void setPalette(GuiPalette*pal); @@ -85,8 +86,8 @@ public: int _picNotValid; // possible values 0, 1 and 2 private: - void restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *screen); - void saveBitsScreen(Common::Rect rect, byte *screen, byte *&memoryPtr); + void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen); + void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr); bool _unditherState; int16 _unditherMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE]; |