aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-12-16 23:13:09 +0100
committerEinar Johan Trøan Sømåen2012-12-16 23:13:58 +0100
commit127afbac8cffea5b0f0e5100de2d3bc28a8736ba (patch)
tree351b07980da3da6821ec93b7f644cd99e60ff08e /engines/wintermute/base
parent6d79a66766ede297ace36e060a0ab2b06aa42025 (diff)
downloadscummvm-rg350-127afbac8cffea5b0f0e5100de2d3bc28a8736ba.tar.gz
scummvm-rg350-127afbac8cffea5b0f0e5100de2d3bc28a8736ba.tar.bz2
scummvm-rg350-127afbac8cffea5b0f0e5100de2d3bc28a8736ba.zip
WINTERMUTE: Don't check the entire ticket-queue for every ticket.
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp11
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h2
2 files changed, 11 insertions, 2 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 32bb608d1c..097ea7fa42 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -260,6 +260,11 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
if ((dstRect->left < 0 && dstRect->right < 0) || (dstRect->top < 0 && dstRect->bottom < 0)) {
return;
}
+ // Start searching from the beginning for the first and second items (since it's empty the first time around
+ // then keep incrementing the start-position, to avoid comparing against already used tickets.
+ if (_drawNum == 0 || _drawNum == 1) {
+ _lastAddedTicket = _renderQueue.begin();
+ }
if (owner) { // Fade-tickets are owner-less
RenderTicket compare(owner, NULL, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
@@ -272,7 +277,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
// LOTS of tickets.
RenderQueueIterator endIterator = _renderQueue.end();
RenderTicket *compareTicket = NULL;
- for (it = _renderQueue.begin(); it != endIterator; ++it) {
+ for (it = _lastAddedTicket; it != endIterator; ++it) {
compareTicket = *it;
if (*(compareTicket) == compare && compareTicket->_isValid) {
compareTicket->_colorMod = _colorMod;
@@ -280,6 +285,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
drawFromSurface(compareTicket);
} else {
drawFromTicket(compareTicket);
+ _lastAddedTicket++;
}
return;
}
@@ -289,10 +295,11 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
ticket->_colorMod = _colorMod;
if (!_disableDirtyRects) {
drawFromTicket(ticket);
+ drawFromSurface(ticket);
+ _lastAddedTicket++;
} else {
ticket->_wantsDraw = true;
_renderQueue.push_back(ticket);
- drawFromSurface(ticket);
}
}
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index 039679a663..e79a0cee46 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -92,6 +92,8 @@ private:
typedef Common::List<RenderTicket *>::iterator RenderQueueIterator;
Common::Rect *_dirtyRect;
Common::List<RenderTicket *> _renderQueue;
+ RenderQueueIterator _lastAddedTicket;
+
bool _needsFlip;
uint32 _drawNum;
Common::Rect _renderRect;