aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-11 17:59:23 +0000
committerFilippos Karapetis2009-10-11 17:59:23 +0000
commit6fda9a5067ca642ccf569a0845e170a6a74ce442 (patch)
tree5cb05763b5169b6f26be1947904cc1a943aebccf
parent9b97f21486e7c84611140c05a1e8aa20df238777 (diff)
downloadscummvm-rg350-6fda9a5067ca642ccf569a0845e170a6a74ce442.tar.gz
scummvm-rg350-6fda9a5067ca642ccf569a0845e170a6a74ce442.tar.bz2
scummvm-rg350-6fda9a5067ca642ccf569a0845e170a6a74ce442.zip
Optimized some screen updates in the new GUI to only update the changed rectangle, instead of the whole screen
svn-id: r44935
-rw-r--r--engines/sci/gui/gui.cpp37
-rw-r--r--engines/sci/gui/gui_screen.cpp5
-rw-r--r--engines/sci/gui/gui_screen.h1
3 files changed, 35 insertions, 8 deletions
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 71df9eaab3..6757efe155 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -283,7 +283,9 @@ void SciGui::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
_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 @@ void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, i
} 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 @@ void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int
} 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 @@ void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId,
} 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 @@ void SciGui::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16
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::editControl(reg_t controlObject, reg_t eventObject) {
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) {
diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp
index 606ad2ef09..eb58dda28d 100644
--- a/engines/sci/gui/gui_screen.cpp
+++ b/engines/sci/gui/gui_screen.cpp
@@ -74,6 +74,11 @@ void SciGuiScreen::copyToScreen() {
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)
diff --git a/engines/sci/gui/gui_screen.h b/engines/sci/gui/gui_screen.h
index daafdc31ff..6b2a5b5ca7 100644
--- a/engines/sci/gui/gui_screen.h
+++ b/engines/sci/gui/gui_screen.h
@@ -46,6 +46,7 @@ public:
~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);