diff options
-rw-r--r-- | engines/sci/gui/gui.cpp | 8 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.cpp | 26 | ||||
-rw-r--r-- | engines/sci/gui/gui_gfx.h | 7 | ||||
-rw-r--r-- | engines/sci/gui/gui_windowmgr.cpp | 20 |
4 files changed, 34 insertions, 27 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 7cf466a642..286de6cf61 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -217,7 +217,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { case SCI_DISPLAY_RESTOREUNDER: // TODO: get rect from SciMemoryHandle (argv[0]) //rect.translate(-_gfx->GetPort()->left, -_gfx->GetPort()->top); - _gfx->RestoreBits(argv[0]); + _gfx->BitsRestore(argv[0]); // TODO: ReAnimate(pArgs) // finishing loop argc = 0; @@ -236,7 +236,7 @@ void SciGui::display(const char *text, int argc, reg_t *argv) { _gfx->Move((orect->left <= _screen->_width ? 0 : _screen->_width - orect->left), (orect->top <= _screen->_height ? 0 : _screen->_height - orect->top)); // move port to (0,0) rect.moveTo(_gfx->GetPort()->curLeft, _gfx->GetPort()->curTop); if (doSaveUnder) - _s->r_acc = _gfx->SaveBits(rect, SCI_SCREEN_MASK_VISUAL); + _s->r_acc = _gfx->BitsSave(rect, SCI_SCREEN_MASK_VISUAL); if (bgcolor != -1) _gfx->FillRect(rect, SCI_SCREEN_MASK_VISUAL, bgcolor, 0, 0); _gfx->TextBox(text, 0, rect, align, -1); @@ -378,11 +378,11 @@ void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int } reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) { - return _gfx->SaveBits(rect, flags); + return _gfx->BitsSave(rect, flags); } void SciGui::graphRestoreBox(reg_t handle) { - _gfx->RestoreBits(handle); + _gfx->BitsRestore(handle); _screen->copyToScreen(); } diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 1c96f4471f..c3732dab98 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -527,7 +527,7 @@ void SciGuiGfx::ShowText(const char *text, int16 from, int16 len, GuiResourceId rect.left = _curPort->curLeft; DrawText(text, from, len, orgFontId, orgPenColor); rect.right = _curPort->curLeft; - ShowBits(rect, 1); + BitsShow(rect, 1); } // Draws a text in rect. @@ -575,7 +575,7 @@ void SciGuiGfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect, } // Update (part of) screen -void SciGuiGfx::ShowBits(const Common::Rect &r, uint16 screenMask) { +void SciGuiGfx::BitsShow(const Common::Rect &r, uint16 screenMask) { Common::Rect rect(r.left, r.top, r.right, r.bottom); rect.clip(_curPort->rect); if (rect.isEmpty()) // nothing to show @@ -588,7 +588,7 @@ void SciGuiGfx::ShowBits(const Common::Rect &r, uint16 screenMask) { // _system->updateScreen(); } -GuiMemoryHandle SciGuiGfx::SaveBits(const Common::Rect &rect, byte screenMask) { +GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) { GuiMemoryHandle memoryId; byte *memoryPtr; int size; @@ -609,7 +609,7 @@ GuiMemoryHandle SciGuiGfx::SaveBits(const Common::Rect &rect, byte screenMask) { return memoryId; } -void SciGuiGfx::RestoreBits(GuiMemoryHandle memoryHandle) { +void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) { byte *memoryPtr = NULL; if (!memoryHandle.isNull()) { @@ -622,6 +622,12 @@ void SciGuiGfx::RestoreBits(GuiMemoryHandle memoryHandle) { } } +void SciGuiGfx::BitsFree(GuiMemoryHandle memoryHandle) { + if (!memoryHandle.isNull()) { + kfree(_s->_segMan, memoryHandle); + } +} + // Sierra's Bresenham line drawing // WARNING: Do not just blindly replace this with Graphics::drawLine(), as it seems to create issues with flood fill void SciGuiGfx::drawLine(int16 left, int16 top, int16 right, int16 bottom, byte color, byte priority, byte control) { @@ -996,10 +1002,10 @@ void SciGuiGfx::AnimateUpdate() { if (!(signal & SCI_ANIMATE_SIGNAL_REMOVEVIEW)) { bitsHandle = GET_SEL32(curObject, underBits); if (_screen->_picNotValid != 1) { - RestoreBits(bitsHandle); + BitsRestore(bitsHandle); listEntry->showBitsFlag = true; } else { - //FreeBits(bits_gfx->UnloadBits(hBits); + BitsFree(bitsHandle); } PUT_SEL32V(curObject, underBits, 0); } @@ -1046,9 +1052,9 @@ void SciGuiGfx::AnimateUpdate() { } else { signal &= 0xFFFF ^ SCI_ANIMATE_SIGNAL_REMOVEVIEW; if (signal & SCI_ANIMATE_SIGNAL_IGNOREACTOR) - bitsHandle = SaveBits(listEntry->celRect, SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_PRIORITY); + bitsHandle = BitsSave(listEntry->celRect, SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_PRIORITY); else - bitsHandle = SaveBits(listEntry->celRect, SCI_SCREEN_MASK_ALL); + bitsHandle = BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL); PUT_SEL32(curObject, underBits, bitsHandle); } listEntry->signal = signal; @@ -1094,7 +1100,7 @@ void SciGuiGfx::AnimateDrawCels() { if (!(signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_HIDDEN | SCI_ANIMATE_SIGNAL_ALWAYSUPDATE))) { // Save background - bitsHandle = SaveBits(listEntry->celRect, SCI_SCREEN_MASK_ALL); + bitsHandle = BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL); PUT_SEL32(curObject, underBits, bitsHandle); // draw corresponding cel @@ -1141,7 +1147,7 @@ void SciGuiGfx::AnimateRestoreAndDelete(int argc, reg_t *argv) { } if ((signal & (SCI_ANIMATE_SIGNAL_NOUPDATE | SCI_ANIMATE_SIGNAL_REMOVEVIEW)) == 0) { - RestoreBits(GET_SEL32(curObject, underBits)); + BitsRestore(GET_SEL32(curObject, underBits)); PUT_SEL32V(curObject, underBits, 0); } diff --git a/engines/sci/gui/gui_gfx.h b/engines/sci/gui/gui_gfx.h index be20bbb396..2d99b14c2f 100644 --- a/engines/sci/gui/gui_gfx.h +++ b/engines/sci/gui/gui_gfx.h @@ -97,9 +97,10 @@ public: DrawText(str, 0, (int16)strlen(str), orgFontId, orgPenColor); } void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId); - void ShowBits(const Common::Rect &r, uint16 flags); - GuiMemoryHandle SaveBits(const Common::Rect &rect, byte screenFlags); - void RestoreBits(GuiMemoryHandle memoryHandle); + void BitsShow(const Common::Rect &r, uint16 flags); + GuiMemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags); + void BitsRestore(GuiMemoryHandle memoryHandle); + void BitsFree(GuiMemoryHandle memoryHandle); void drawLine(int16 left, int16 top, int16 right, int16 bottom, byte color, byte prio, byte control); void Draw_String(const char *text); diff --git a/engines/sci/gui/gui_windowmgr.cpp b/engines/sci/gui/gui_windowmgr.cpp index 249b876498..b9e0590ef5 100644 --- a/engines/sci/gui/gui_windowmgr.cpp +++ b/engines/sci/gui/gui_windowmgr.cpp @@ -202,9 +202,9 @@ void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) { GuiPort *oldport = _gfx->SetPort(_wmgrPort); _gfx->PenColor(0); if ((wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT) == 0) { - pWnd->hSaved1 = _gfx->SaveBits(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL); + pWnd->hSaved1 = _gfx->BitsSave(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL); if (pWnd->uSaveFlag & 2) { - pWnd->hSaved2 = _gfx->SaveBits(pWnd->restoreRect, 2); + pWnd->hSaved2 = _gfx->BitsSave(pWnd->restoreRect, 2); if ((wndStyle & SCI_WINDOWMGR_STYLE_USER) == 0) _gfx->FillRect(pWnd->restoreRect, SCI_SCREEN_MASK_PRIORITY, 0, 15); } @@ -240,17 +240,17 @@ void SciGuiWindowMgr::DrawWindow(GuiWindow *pWnd) { if (!(wndStyle & SCI_WINDOWMGR_STYLE_TRANSPARENT)) _gfx->FillRect(r, SCI_SCREEN_MASK_VISUAL, pWnd->backClr); - _gfx->ShowBits(pWnd->dims, SCI_SCREEN_MASK_VISUAL); + _gfx->BitsShow(pWnd->dims, SCI_SCREEN_MASK_VISUAL); } _gfx->SetPort(oldport); } void SciGuiWindowMgr::DisposeWindow(GuiWindow *pWnd, int16 arg2) { _gfx->SetPort(_wmgrPort); - _gfx->RestoreBits(pWnd->hSaved1); - _gfx->RestoreBits(pWnd->hSaved2); + _gfx->BitsRestore(pWnd->hSaved1); + _gfx->BitsRestore(pWnd->hSaved2); if (arg2) - _gfx->ShowBits(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL); + _gfx->BitsShow(pWnd->restoreRect, SCI_SCREEN_MASK_VISUAL); // else // g_sci->ReAnimate(&pwnd->dims); _windowList.remove(pWnd); @@ -263,12 +263,12 @@ void SciGuiWindowMgr::UpdateWindow(GuiWindow *wnd) { GuiMemoryHandle handle; if (wnd->uSaveFlag && wnd->bDrawn) { - handle = _gfx->SaveBits(wnd->restoreRect, SCI_SCREEN_MASK_VISUAL); - _gfx->RestoreBits(wnd->hSaved1); + handle = _gfx->BitsSave(wnd->restoreRect, SCI_SCREEN_MASK_VISUAL); + _gfx->BitsRestore(wnd->hSaved1); wnd->hSaved1 = handle; if (wnd->uSaveFlag & SCI_SCREEN_MASK_PRIORITY) { - handle = _gfx->SaveBits(wnd->restoreRect, SCI_SCREEN_MASK_PRIORITY); - _gfx->RestoreBits(wnd->hSaved2); + handle = _gfx->BitsSave(wnd->restoreRect, SCI_SCREEN_MASK_PRIORITY); + _gfx->BitsRestore(wnd->hSaved2); wnd->hSaved2 = handle; } } |