[Scummvm-cvs-logs] SF.net SVN: scummvm:[44903] scummvm/trunk/engines/sci/gui

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Oct 11 11:47:12 CEST 2009


Revision: 44903
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44903&view=rev
Author:   m_kiewitz
Date:     2009-10-11 09:47:12 +0000 (Sun, 11 Oct 2009)

Log Message:
-----------
SCI/newgui: SciGuiGfx::BitsFree() implemented, currently used in kAnimate, Bits-methods renamed

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui_gfx.cpp
    scummvm/trunk/engines/sci/gui/gui_gfx.h
    scummvm/trunk/engines/sci/gui/gui_windowmgr.cpp

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-11 09:39:53 UTC (rev 44902)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-11 09:47:12 UTC (rev 44903)
@@ -217,7 +217,7 @@
 		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 @@
 	_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 @@
 }
 
 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();
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-11 09:39:53 UTC (rev 44902)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.cpp	2009-10-11 09:47:12 UTC (rev 44903)
@@ -527,7 +527,7 @@
 	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 @@
 }
 
 // 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 @@
 //	_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 @@
 	return memoryId;
 }
 
-void SciGuiGfx::RestoreBits(GuiMemoryHandle memoryHandle) {
+void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) {
 	byte *memoryPtr = NULL;
 
 	if (!memoryHandle.isNull()) {
@@ -622,6 +622,12 @@
 	}
 }
 
+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 @@
 			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 @@
 			} 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 @@
 
 		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 @@
 		}
 
 		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);
 		}
 

Modified: scummvm/trunk/engines/sci/gui/gui_gfx.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_gfx.h	2009-10-11 09:39:53 UTC (rev 44902)
+++ scummvm/trunk/engines/sci/gui/gui_gfx.h	2009-10-11 09:47:12 UTC (rev 44903)
@@ -97,9 +97,10 @@
 		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);

Modified: scummvm/trunk/engines/sci/gui/gui_windowmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_windowmgr.cpp	2009-10-11 09:39:53 UTC (rev 44902)
+++ scummvm/trunk/engines/sci/gui/gui_windowmgr.cpp	2009-10-11 09:47:12 UTC (rev 44903)
@@ -202,9 +202,9 @@
 	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 @@
 		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 @@
 	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;
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list