aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/gfx
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-08-07 16:28:44 +0200
committerEinar Johan Trøan Sømåen2012-08-07 16:28:44 +0200
commit688f792c9f280a3cf1bb5b30149a05669ba4bfb5 (patch)
treeec33a6f33f07de1f7fe123be2855b6279dd20ace /engines/wintermute/base/gfx
parent8883a9ffd587de0cfca9a42925d2f1071d4ccb35 (diff)
downloadscummvm-rg350-688f792c9f280a3cf1bb5b30149a05669ba4bfb5.tar.gz
scummvm-rg350-688f792c9f280a3cf1bb5b30149a05669ba4bfb5.tar.bz2
scummvm-rg350-688f792c9f280a3cf1bb5b30149a05669ba4bfb5.zip
WINTERMUTE: Cache scaled images, to avoid having to rescale every frame.
Diffstat (limited to 'engines/wintermute/base/gfx')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 3ec04b1ab1..9cc94449ff 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -199,6 +199,20 @@ bool BaseRenderOSystem::indicatorFlip() {
bool BaseRenderOSystem::flip() {
if (!_disableDirtyRects) {
drawTickets();
+ } else {
+ // Clear the scale-buffered tickets that wasn't reused.
+ RenderQueueIterator it = _renderQueue.begin();
+ while (it != _renderQueue.end()) {
+ if ((*it)->_wantsDraw == false) {
+ RenderTicket *ticket = *it;
+ addDirtyRect((*it)->_dstRect);
+ it = _renderQueue.erase(it);
+ delete ticket;
+ } else {
+ (*it)->_wantsDraw = false;
+ it++;
+ }
+ }
}
if (_needsFlip || _disableDirtyRects) {
if (_disableDirtyRects) {
@@ -292,13 +306,6 @@ Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const {
}
void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) {
- if (_disableDirtyRects) {
- RenderTicket renderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
- // HINT: The surface-data contains other info than it should.
- // drawFromSurface(renderTicket._surface, srcRect, dstRect, NULL, mirrorX, mirrorY);
- drawFromSurface(&renderTicket, NULL);
- return;
- }
// Skip rects that are completely outside the screen:
if ((dstRect->left < 0 && dstRect->right < 0) || (dstRect->top < 0 && dstRect->bottom < 0)) {
return;
@@ -311,14 +318,24 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
for (it = _renderQueue.begin(); it != _renderQueue.end(); it++) {
if ((*it)->_owner == owner && *(*it) == compare && (*it)->_isValid) {
(*it)->_colorMod = _colorMod;
- drawFromTicket(*it);
+ if (_disableDirtyRects) {
+ drawFromSurface(*it, NULL);
+ } else {
+ drawFromTicket(*it);
+ }
return;
}
}
}
RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, mirrorX, mirrorY, disableAlpha);
ticket->_colorMod = _colorMod;
- drawFromTicket(ticket);
+ if (!_disableDirtyRects) {
+ drawFromTicket(ticket);
+ } else {
+ ticket->_wantsDraw = true;
+ _renderQueue.push_back(ticket);
+ drawFromSurface(ticket, NULL);
+ }
}
void BaseRenderOSystem::invalidateTicket(RenderTicket *renderTicket) {