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;
|
_pos = 0;
|
||||||
_activeKey.clear();
|
_activeKey.clear();
|
||||||
|
|
||||||
while (_text[_pos]) {
|
while (_text[_pos] && _state != kParserError) {
|
||||||
if (_state == kParserError)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (skipSpaces())
|
if (skipSpaces())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -535,13 +535,8 @@ public:
|
||||||
* @see VectorRenderer::copyFrame()
|
* @see VectorRenderer::copyFrame()
|
||||||
*/
|
*/
|
||||||
virtual void copyFrame(OSystem *sys, const Common::Rect &r) {
|
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),
|
sys->copyRectToOverlay((const OverlayColor*)_activeSurface->getBasePtr(r.left, r.top),
|
||||||
_activeSurface->w, r.top, r.left, r.width(), r.height());
|
_activeSurface->w, r.left, r.top, r.width(), r.height());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void copyWholeFrame(OSystem *sys) {
|
virtual void copyWholeFrame(OSystem *sys) {
|
||||||
|
|
|
@ -223,7 +223,9 @@ bool ThemeParser::parserCallback_DRAWSTEP() {
|
||||||
if (!parseDrawStep(stepNode, drawstep, true))
|
if (!parseDrawStep(stepNode, drawstep, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
_theme->addDrawStep(drawdataNode->values["id"], drawstep);
|
_theme->addDrawStep(drawdataNode->values["id"], *drawstep);
|
||||||
|
delete drawstep;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool ThemeRenderer::init() {
|
||||||
resetDrawArea();
|
resetDrawArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_themeOk || isThemeLoadingRequired()) {
|
if (isThemeLoadingRequired() || !_themeOk) {
|
||||||
loadTheme(_themeName);
|
loadTheme(_themeName);
|
||||||
|
|
||||||
Theme::loadTheme(_defaultConfig);
|
Theme::loadTheme(_defaultConfig);
|
||||||
|
@ -173,7 +173,7 @@ void ThemeRenderer::setGraphicsMode(GraphicsMode mode) {
|
||||||
_vectorRenderer->setSurface(_screen);
|
_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);
|
DrawData id = getDrawDataId(drawDataId);
|
||||||
|
|
||||||
assert(_widgets[id] != 0);
|
assert(_widgets[id] != 0);
|
||||||
|
@ -252,8 +252,9 @@ void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r) {
|
||||||
if (isWidgetCached(type, r)) {
|
if (isWidgetCached(type, r)) {
|
||||||
drawCached(type, r);
|
drawCached(type, r);
|
||||||
} else if (_widgets[type] != 0) {
|
} else if (_widgets[type] != 0) {
|
||||||
for (uint i = 0; i < _widgets[type]->_steps.size(); ++i)
|
for (Common::List<Graphics::DrawStep>::const_iterator step = _widgets[type]->_steps.begin();
|
||||||
_vectorRenderer->drawStep(r, *_widgets[type]->_steps[i]);
|
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() {
|
void ThemeRenderer::updateScreen() {
|
||||||
// renderDirtyScreen();
|
renderDirtyScreen();
|
||||||
_vectorRenderer->copyWholeFrame(_system);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeRenderer::renderDirtyScreen() {
|
void ThemeRenderer::renderDirtyScreen() {
|
||||||
|
@ -329,7 +329,6 @@ void ThemeRenderer::renderDirtyScreen() {
|
||||||
for (uint i = 0; i < _dirtyScreen.size(); ++i)
|
for (uint i = 0; i < _dirtyScreen.size(); ++i)
|
||||||
_vectorRenderer->copyFrame(_system, _dirtyScreen[i]);
|
_vectorRenderer->copyFrame(_system, _dirtyScreen[i]);
|
||||||
|
|
||||||
// _system->updateScreen();
|
|
||||||
_dirtyScreen.clear();
|
_dirtyScreen.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,16 +42,13 @@ namespace GUI {
|
||||||
struct WidgetDrawData;
|
struct WidgetDrawData;
|
||||||
|
|
||||||
struct WidgetDrawData {
|
struct WidgetDrawData {
|
||||||
Common::Array<Graphics::DrawStep*> _steps;
|
Common::List<Graphics::DrawStep> _steps;
|
||||||
|
|
||||||
bool _cached;
|
bool _cached;
|
||||||
Graphics::Surface *_surfaceCache;
|
Graphics::Surface *_surfaceCache;
|
||||||
uint32 _cachedW, _cachedH;
|
uint32 _cachedW, _cachedH;
|
||||||
|
|
||||||
~WidgetDrawData() {
|
~WidgetDrawData() {
|
||||||
for (uint i = 0; i < _steps.size(); ++i)
|
|
||||||
delete _steps[i];
|
|
||||||
|
|
||||||
_steps.clear();
|
_steps.clear();
|
||||||
|
|
||||||
if (_surfaceCache) {
|
if (_surfaceCache) {
|
||||||
|
@ -69,8 +66,11 @@ class ThemeRenderer : public Theme {
|
||||||
friend class GUI::Dialog;
|
friend class GUI::Dialog;
|
||||||
friend class GUI::GuiObject;
|
friend class GUI::GuiObject;
|
||||||
|
|
||||||
|
/** Strings representing each value in the DrawData enum */
|
||||||
static const char *kDrawDataStrings[];
|
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:
|
public:
|
||||||
enum GraphicsMode {
|
enum GraphicsMode {
|
||||||
|
@ -159,6 +159,7 @@ public:
|
||||||
void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state) {}
|
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) {
|
bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false) {
|
||||||
|
r.grow(kDirtyRectangleThreshold);
|
||||||
_dirtyScreen.push_back(r);
|
_dirtyScreen.push_back(r);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +173,7 @@ public:
|
||||||
return (DrawData)-1;
|
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);
|
bool addDrawData(DrawData data_id, bool cached);
|
||||||
|
|
||||||
ThemeParser *parser() {
|
ThemeParser *parser() {
|
||||||
|
|
|
@ -242,7 +242,7 @@ void NewGui::runLoop() {
|
||||||
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
|
while (!_dialogStack.empty() && activeDialog == getTopDialog()) {
|
||||||
if (_needRedraw) {
|
if (_needRedraw) {
|
||||||
redraw();
|
redraw();
|
||||||
// _needRedraw = false;
|
_needRedraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't "tickle" the dialog until the theme has had a chance
|
// Don't "tickle" the dialog until the theme has had a chance
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue