aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/ThemeParser.cpp4
-rw-r--r--gui/ThemeRenderer.cpp13
-rw-r--r--gui/ThemeRenderer.h13
-rw-r--r--gui/newgui.cpp2
4 files changed, 17 insertions, 15 deletions
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index cd9ebc83a4..2726e15587 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -223,7 +223,9 @@ bool ThemeParser::parserCallback_DRAWSTEP() {
if (!parseDrawStep(stepNode, drawstep, true))
return false;
- _theme->addDrawStep(drawdataNode->values["id"], drawstep);
+ _theme->addDrawStep(drawdataNode->values["id"], *drawstep);
+ delete drawstep;
+
return true;
}
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index a5a1625fb6..d17698c9c1 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -99,7 +99,7 @@ bool ThemeRenderer::init() {
resetDrawArea();
}
- if (!_themeOk || isThemeLoadingRequired()) {
+ if (isThemeLoadingRequired() || !_themeOk) {
loadTheme(_themeName);
Theme::loadTheme(_defaultConfig);
@@ -173,7 +173,7 @@ void ThemeRenderer::setGraphicsMode(GraphicsMode mode) {
_vectorRenderer->setSurface(_screen);
}
-void ThemeRenderer::addDrawStep(Common::String &drawDataId, Graphics::DrawStep *step) {
+void ThemeRenderer::addDrawStep(Common::String &drawDataId, Graphics::DrawStep step) {
DrawData id = getDrawDataId(drawDataId);
assert(_widgets[id] != 0);
@@ -252,8 +252,9 @@ void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r) {
if (isWidgetCached(type, r)) {
drawCached(type, r);
} else if (_widgets[type] != 0) {
- for (uint i = 0; i < _widgets[type]->_steps.size(); ++i)
- _vectorRenderer->drawStep(r, *_widgets[type]->_steps[i]);
+ for (Common::List<Graphics::DrawStep>::const_iterator step = _widgets[type]->_steps.begin();
+ step != _widgets[type]->_steps.end(); ++step)
+ _vectorRenderer->drawStep(r, *step);
}
}
@@ -316,8 +317,7 @@ void ThemeRenderer::drawScrollbar(const Common::Rect &r, int sliderY, int slider
}
void ThemeRenderer::updateScreen() {
-// renderDirtyScreen();
- _vectorRenderer->copyWholeFrame(_system);
+ renderDirtyScreen();
}
void ThemeRenderer::renderDirtyScreen() {
@@ -329,7 +329,6 @@ void ThemeRenderer::renderDirtyScreen() {
for (uint i = 0; i < _dirtyScreen.size(); ++i)
_vectorRenderer->copyFrame(_system, _dirtyScreen[i]);
-// _system->updateScreen();
_dirtyScreen.clear();
}
diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h
index 3ce17c25b0..56b81b21fc 100644
--- a/gui/ThemeRenderer.h
+++ b/gui/ThemeRenderer.h
@@ -42,16 +42,13 @@ namespace GUI {
struct WidgetDrawData;
struct WidgetDrawData {
- Common::Array<Graphics::DrawStep*> _steps;
+ Common::List<Graphics::DrawStep> _steps;
bool _cached;
Graphics::Surface *_surfaceCache;
uint32 _cachedW, _cachedH;
~WidgetDrawData() {
- for (uint i = 0; i < _steps.size(); ++i)
- delete _steps[i];
-
_steps.clear();
if (_surfaceCache) {
@@ -69,8 +66,11 @@ class ThemeRenderer : public Theme {
friend class GUI::Dialog;
friend class GUI::GuiObject;
+ /** Strings representing each value in the DrawData enum */
static const char *kDrawDataStrings[];
- static const int kMaxDialogDepth = 4;
+
+ /** Constant value to expand dirty rectangles, to make sure they are fully copied */
+ static const int kDirtyRectangleThreshold = 2;
public:
enum GraphicsMode {
@@ -159,6 +159,7 @@ public:
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state) {}
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false) {
+ r.grow(kDirtyRectangleThreshold);
_dirtyScreen.push_back(r);
return true;
}
@@ -172,7 +173,7 @@ public:
return (DrawData)-1;
}
- void addDrawStep(Common::String &drawDataId, Graphics::DrawStep *step);
+ void addDrawStep(Common::String &drawDataId, Graphics::DrawStep step);
bool addDrawData(DrawData data_id, bool cached);
ThemeParser *parser() {
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index efa7a910e2..4d0b3905b9 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -242,7 +242,7 @@ void NewGui::runLoop() {
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
if (_needRedraw) {
redraw();
-// _needRedraw = false;
+ _needRedraw = false;
}
// Don't "tickle" the dialog until the theme has had a chance