Memory leaks.
Bug fixes. svn-id: r32908
This commit is contained in:
parent
3b73b199a6
commit
96f2d9ca18
6 changed files with 22 additions and 28 deletions
|
@ -143,10 +143,7 @@ bool XMLParser::parse() {
|
|||
_pos = 0;
|
||||
_activeKey.clear();
|
||||
|
||||
while (_text[_pos]) {
|
||||
if (_state == kParserError)
|
||||
break;
|
||||
|
||||
while (_text[_pos] && _state != kParserError) {
|
||||
if (skipSpaces())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -535,13 +535,8 @@ public:
|
|||
* @see VectorRenderer::copyFrame()
|
||||
*/
|
||||
virtual void copyFrame(OSystem *sys, const Common::Rect &r) {
|
||||
#ifdef OVERLAY_MULTIPLE_DEPTHS // TODO: change OSystem to support templated copyRectToOverlay
|
||||
sys->copyRectToOverlay((const PixelType*)_activeSurface->getBasePtr(r.left, r.top),
|
||||
_activeSurface->w, r.top, r.left, r.width(), r.height());
|
||||
#else
|
||||
sys->copyRectToOverlay((const OverlayColor*)_activeSurface->getBasePtr(r.left, r.top),
|
||||
_activeSurface->w, r.top, r.left, r.width(), r.height());
|
||||
#endif
|
||||
_activeSurface->w, r.left, r.top, r.width(), r.height());
|
||||
}
|
||||
|
||||
virtual void copyWholeFrame(OSystem *sys) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue