aboutsummaryrefslogtreecommitdiff
path: root/gui/InterfaceManager.cpp
diff options
context:
space:
mode:
authorVicent Marti2008-06-12 11:26:11 +0000
committerVicent Marti2008-06-12 11:26:11 +0000
commit5dd77ea8203c7d63848b0423fbc3c9bfbb8987b5 (patch)
treec63aa96ba15f34669e3e56d0fc4430745c45ba60 /gui/InterfaceManager.cpp
parentda6e5c46607f733154f1f932a158678f5293c884 (diff)
downloadscummvm-rg350-5dd77ea8203c7d63848b0423fbc3c9bfbb8987b5.tar.gz
scummvm-rg350-5dd77ea8203c7d63848b0423fbc3c9bfbb8987b5.tar.bz2
scummvm-rg350-5dd77ea8203c7d63848b0423fbc3c9bfbb8987b5.zip
- Widget caching for Interface manager.
- Expanded theme Interface - Surface blitting for VectorRenderer svn-id: r32670
Diffstat (limited to 'gui/InterfaceManager.cpp')
-rw-r--r--gui/InterfaceManager.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/gui/InterfaceManager.cpp b/gui/InterfaceManager.cpp
index 613a445fa3..e64d292e16 100644
--- a/gui/InterfaceManager.cpp
+++ b/gui/InterfaceManager.cpp
@@ -81,6 +81,48 @@ bool InterfaceManager::init() {
return false;
}
+bool InterfaceManager::isWidgetCached(DrawData type, const Common::Rect &r) {
+ return _widgets[type] && _widgets[type]->_cached &&
+ _widgets[type]->_surfaceCache->w == r.width() &&
+ _widgets[type]->_surfaceCache->h == r.height();
+}
+
+void InterfaceManager::drawCached(DrawData type, const Common::Rect &r) {
+ assert(_widgets[type]->_surfaceCache->bytesPerPixel == _screen->bytesPerPixel);
+ _vectorRenderer->blitSurface(_widgets[type]->_surfaceCache, r);
+}
+
+void InterfaceManager::drawDD(DrawData type, const Common::Rect &r) {
+ if (isWidgetCached(type, r)) {
+ drawCached(type, r);
+ } else {
+ for (int i = 0; i < _widgets[type]->_stepCount; ++i)
+ _vectorRenderer->drawStep(r, _widgets[type]->_steps[i]);
+ }
+}
+
+void InterfaceManager::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) {
+ if (!_initOk)
+ return;
+
+ if (state == kStateEnabled)
+ drawDD(kDDButtonIdle, r);
+ else if (state == kStateHighlight)
+ drawDD(kDDButtonHover, r);
+
+ // TODO: Add text drawing.
+
+ addDirtyRect(r);
+}
+
+void InterfaceManager::drawLineSeparator(const Common::Rect &r, WidgetStateInfo state) {
+ if (!_initOk)
+ return;
+
+ drawDD(kDDSeparator, r);
+ addDirtyRect(r);
+}
+
int InterfaceManager::runGUI() {
Common::EventManager *eventMan = _system->getEventManager();
_system->showOverlay();