aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-12-13 20:55:49 +0100
committerEinar Johan Trøan Sømåen2012-12-13 20:55:49 +0100
commit9f9b6e2af8342b88b45d858c979503f3df64f551 (patch)
tree7fa4a61aad04ba04889c09d757e69293cab850df
parentaf857147c2198161a8389245fe31fe706e1faef2 (diff)
downloadscummvm-rg350-9f9b6e2af8342b88b45d858c979503f3df64f551.tar.gz
scummvm-rg350-9f9b6e2af8342b88b45d858c979503f3df64f551.tar.bz2
scummvm-rg350-9f9b6e2af8342b88b45d858c979503f3df64f551.zip
WINTERMUTE: Further optimize drawTicket-checking.
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index c7af2b1787..7c0e9e76d9 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -83,8 +83,8 @@ bool RenderTicket::operator==(RenderTicket &t) {
(t._hasAlpha != _hasAlpha) ||
(t._mirror != _mirror) ||
(t._colorMod != _colorMod) ||
- (t._srcRect != _srcRect) ||
- (t._dstRect != _dstRect)) {
+ (t._dstRect != _dstRect) ||
+ (t._srcRect != _srcRect)) {
return false;
}
return true;
@@ -312,13 +312,18 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
RenderTicket compare(owner, NULL, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
compare._colorMod = _colorMod;
RenderQueueIterator it;
- for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) {
- if ((*it)->_owner == owner && *(*it) == compare && (*it)->_isValid) {
- (*it)->_colorMod = _colorMod;
+ // Avoid calling end() and operator* every time, when potentially going through
+ // LOTS of tickets.
+ RenderQueueIterator endIterator = _renderQueue.end();
+ RenderTicket *compareTicket = NULL;
+ for (it = _renderQueue.begin(); it != endIterator; ++it) {
+ compareTicket = *it;
+ if (compareTicket->_owner == owner && *(compareTicket) == compare && compareTicket->_isValid) {
+ compareTicket->_colorMod = _colorMod;
if (_disableDirtyRects) {
- drawFromSurface(*it, NULL);
+ drawFromSurface(compareTicket, NULL);
} else {
- drawFromTicket(*it);
+ drawFromTicket(compareTicket);
}
return;
}