aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-20 03:53:13 +0200
committerEinar Johan Trøan Sømåen2012-07-20 03:53:13 +0200
commitb618f7985f33cbb24e36eaf6490ddc59cc148a0a (patch)
treef03e6d545d3258838b61b18e60a5a1f92cc4cac8
parent958cb16f9e9d0995c71a54bd20d4b8464775a9e6 (diff)
downloadscummvm-rg350-b618f7985f33cbb24e36eaf6490ddc59cc148a0a.tar.gz
scummvm-rg350-b618f7985f33cbb24e36eaf6490ddc59cc148a0a.tar.bz2
scummvm-rg350-b618f7985f33cbb24e36eaf6490ddc59cc148a0a.zip
WINTERMUTE: Decrement tickets when reinserting a ticket that has swapped places.
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp12
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index fc971357bf..ee971ab6c9 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -352,7 +352,7 @@ void CBRenderOSystem::drawSurface(CBSurfaceOSystem *owner, const Graphics::Surfa
RenderTicket renderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY);
// HINT: The surface-data contains other info than it should.
// drawFromSurface(renderTicket._surface, srcRect, dstRect, NULL, mirrorX, mirrorY);
- drawFromSurface(renderTicket._surface, &renderTicket._srcRect, &renderTicket._dstRect, NULL, renderTicket._mirror);
+ drawFromSurface(renderTicket.getSurface(), &renderTicket._srcRect, &renderTicket._dstRect, NULL, renderTicket._mirror);
return;
}
// Skip rects that are completely outside the screen:
@@ -432,6 +432,12 @@ void CBRenderOSystem::drawFromTicket(RenderTicket *renderTicket) {
it++;
}
}
+ if (it != _renderQueue.end()) {
+ // Decreement the following tickets.
+ for (; it != _renderQueue.end(); it++) {
+ (*it)->_drawNum--;
+ }
+ }
// Is not in order, so readd it as if it was a new ticket
renderTicket->_drawNum = 0;
drawFromTicket(renderTicket);
@@ -475,8 +481,10 @@ void CBRenderOSystem::drawTickets() {
// Apply the clear-color to the dirty rect.
_renderSurface->fillRect(*_dirtyRect, _clearColor);
+ _drawNum = 1;
for (it = _renderQueue.begin(); it != _renderQueue.end(); it++) {
RenderTicket *ticket = *it;
+ assert(ticket->_drawNum == _drawNum++);
if (ticket->_isValid && ticket->_dstRect.intersects(*_dirtyRect)) {
// dstClip is the area we want redrawn.
Common::Rect dstClip(ticket->_dstRect);
@@ -490,7 +498,7 @@ void CBRenderOSystem::drawTickets() {
dstClip.translate(-offsetX, -offsetY);
_colorMod = ticket->_colorMod;
- drawFromSurface(ticket->_surface, &ticket->_srcRect, &pos, &dstClip, ticket->_mirror);
+ drawFromSurface(ticket->getSurface(), &ticket->_srcRect, &pos, &dstClip, ticket->_mirror);
_needsFlip = true;
}
// Some tickets want redraw but don't actually clip the dirty area (typically the ones that shouldnt become clear-color)
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index d41d14ef35..8a8eb88ede 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -37,11 +37,12 @@
namespace WinterMute {
class CBSurfaceOSystem;
class RenderTicket {
+ Graphics::Surface *_surface;
public:
RenderTicket(CBSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false);
RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {}
~RenderTicket();
- Graphics::Surface *_surface;
+ const Graphics::Surface *getSurface() { return _surface; }
Common::Rect _srcRect;
Common::Rect _dstRect;
uint32 _mirror;