diff options
author | Vicent Marti | 2008-07-22 09:23:37 +0000 |
---|---|---|
committer | Vicent Marti | 2008-07-22 09:23:37 +0000 |
commit | 7f3b60e2dae633dc08db7b99b5c27101e1712ae4 (patch) | |
tree | 43793a0d05ed2149bd5c8c8eb69a2776aa869243 | |
parent | 7071a95a5753861bce494f1e7906e033ce8bd7c4 (diff) | |
download | scummvm-rg350-7f3b60e2dae633dc08db7b99b5c27101e1712ae4.tar.gz scummvm-rg350-7f3b60e2dae633dc08db7b99b5c27101e1712ae4.tar.bz2 scummvm-rg350-7f3b60e2dae633dc08db7b99b5c27101e1712ae4.zip |
Dirty screen handling!
svn-id: r33190
-rw-r--r-- | gui/ThemeRenderer.cpp | 41 | ||||
-rw-r--r-- | gui/ThemeRenderer.h | 2 |
2 files changed, 33 insertions, 10 deletions
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 84366a6f4a..c434a4a38b 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -369,6 +369,8 @@ void ThemeRenderer::drawDDText(const DrawQueueText &q) { _vectorRenderer->textStep(q.text, q.area, _widgets[q.type]->_textStep); } + + addDirtyRect(q.area); } void ThemeRenderer::calcBackgroundOffset(DrawData type) { @@ -554,8 +556,6 @@ void ThemeRenderer::debugWidgetPosition(const char *name, const Common::Rect &r) } void ThemeRenderer::updateScreen() { -// renderDirtyScreen(); - if (!_bufferQueue.empty()) { _vectorRenderer->setSurface(_backBuffer); @@ -583,18 +583,41 @@ void ThemeRenderer::updateScreen() { _textQueue.clear(); } - _vectorRenderer->copyWholeFrame(_system); + renderDirtyScreen(); } void ThemeRenderer::renderDirtyScreen() { - // TODO: This isn't really optimized. Check dirty squares for collisions - // and all that. if (_dirtyScreen.empty()) return; - - for (uint i = 0; i < _dirtyScreen.size(); ++i) - _vectorRenderer->copyFrame(_system, _dirtyScreen[i]); - + + Common::List<Common::Rect>::iterator cur; + for (Common::List<Common::Rect>::iterator d = _dirtyScreen.begin(); d != _dirtyScreen.end(); ++d) { + cur = d; + do { + ++d; + if (cur->intersects(*d)) + _dirtyScreen.erase(d); + } while (d != _dirtyScreen.end()); + + + // FIXME: this square-merging algorithm can be rather slow, and I don't think it + // benefits us *that* much. Maybe we should just stick to finding dirty squares that overlap. + + // d = cur; + // + // do { + // ++d; + // if ((cur->top == d->top && cur->bottom == d->bottom && (ABS(cur->left - d->right) < 10 || ABS(cur->right - d->left) < 10)) || + // (cur->left == d->left && cur->right == d->right && (ABS(cur->top - d->bottom) < 10 || ABS(cur->bottom - d->top) < 10))) { + // cur->extend(*d); + // _dirtyScreen.erase(d); + // } + // } while (d != _dirtyScreen.end()); + + d = cur; + _vectorRenderer->copyFrame(_system, *d); + } + _dirtyScreen.clear(); } diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h index abaff44c55..c54eaf3a1e 100644 --- a/gui/ThemeRenderer.h +++ b/gui/ThemeRenderer.h @@ -603,7 +603,7 @@ protected: Graphics::TextStep _texts[kTextColorMAX]; /** List of all the dirty screens that must be blitted to the overlay. */ - Common::Array<Common::Rect> _dirtyScreen; + Common::List<Common::Rect> _dirtyScreen; /** Queue with all the drawing that must be done to the Back Buffer */ Common::List<DrawQueue> _bufferQueue; |