[Scummvm-cvs-logs] SF.net SVN: scummvm:[44935] scummvm/trunk/engines/sci/gui
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Oct 11 19:59:23 CEST 2009
Revision: 44935
http://scummvm.svn.sourceforge.net/scummvm/?rev=44935&view=rev
Author: thebluegr
Date: 2009-10-11 17:59:23 +0000 (Sun, 11 Oct 2009)
Log Message:
-----------
Optimized some screen updates in the new GUI to only update the changed rectangle, instead of the whole screen
Modified Paths:
--------------
scummvm/trunk/engines/sci/gui/gui.cpp
scummvm/trunk/engines/sci/gui/gui_screen.cpp
scummvm/trunk/engines/sci/gui/gui_screen.h
Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-11 16:47:01 UTC (rev 44934)
+++ scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-11 17:59:23 UTC (rev 44935)
@@ -283,7 +283,9 @@
_gfx->Draw_String(text);
_gfx->SetPort(oldPort);
// _gfx->ShowBits(*_theMenuBar, 1);
- _screen->copyToScreen();
+ Common::Rect screenRect = _gfx->_menuRect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::drawMenuBar() {
@@ -332,7 +334,11 @@
} else {
_gfx->InvertRect(rect);
}
- _screen->copyToScreen();
+
+ Common::Rect screenRect = rect;
+ screenRect.grow(2);
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite) {
@@ -347,7 +353,11 @@
} else {
_gfx->InvertRect(rect);
}
- _screen->copyToScreen();
+
+ Common::Rect screenRect = rect;
+ screenRect.grow(1);
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
@@ -362,7 +372,10 @@
} else {
_gfx->InvertRect(rect);
}
- _screen->copyToScreen();
+
+ Common::Rect screenRect = rect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
@@ -372,7 +385,9 @@
if (isAlias && (style & 8)) {
_gfx->FrameRect(rect);
}
- _screen->copyToScreen();
+ Common::Rect screenRect = rect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
}
@@ -381,17 +396,23 @@
void SciGui::graphFillBoxForeground(Common::Rect rect) {
_gfx->PaintRect(rect);
- _screen->copyToScreen();
+ Common::Rect screenRect = rect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::graphFillBoxBackground(Common::Rect rect) {
_gfx->EraseRect(rect);
- _screen->copyToScreen();
+ Common::Rect screenRect = rect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
_gfx->FillRect(rect, colorMask, color, priority, control);
- _screen->copyToScreen();
+ Common::Rect screenRect = rect;
+ _gfx->OffsetRect(screenRect);
+ _screen->copyRectToScreen(screenRect);
}
void SciGui::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp 2009-10-11 16:47:01 UTC (rev 44934)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp 2009-10-11 17:59:23 UTC (rev 44935)
@@ -74,6 +74,11 @@
g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight);
}
+void SciGuiScreen::copyRectToScreen(const Common::Rect &rect) {
+ //g_system->copyRectToScreen(_activeScreen, _displayWidth, 0, 0, _displayWidth, _displayHeight);
+ g_system->copyRectToScreen(_activeScreen + rect.top * _displayWidth + rect.left, _displayWidth, rect.left, rect.top, rect.width(), rect.height());
+}
+
byte SciGuiScreen::getDrawingMask(byte color, byte prio, byte control) {
byte flag = 0;
if (color != 255)
Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h 2009-10-11 16:47:01 UTC (rev 44934)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h 2009-10-11 17:59:23 UTC (rev 44935)
@@ -46,6 +46,7 @@
~SciGuiScreen();
void copyToScreen();
+ void copyRectToScreen(const Common::Rect &rect);
byte getDrawingMask(byte color, byte prio, byte control);
void putPixel(int x, int y, byte drawMask, byte color, byte prio, byte control);
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