From 61f387190c10274ccb649321c8244e1ca3d74b42 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Thu, 13 Dec 2012 22:17:36 +0100 Subject: WINTERMUTE: Avoid unneccessary alpha-blits when using dirty-rects. --- engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 13 +++++++------ engines/wintermute/base/gfx/osystem/base_render_osystem.h | 4 +++- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index c32054ac32..3a69e53d16 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -477,7 +477,7 @@ void BaseRenderOSystem::drawTickets() { dstClip.translate(-offsetX, -offsetY); _colorMod = ticket->_colorMod; - drawFromSurface(ticket->getSurface(), &ticket->_srcRect, &pos, &dstClip, ticket->_mirror); + drawFromSurface(ticket, &ticket->_srcRect, &pos, &dstClip); _needsFlip = true; } // Some tickets want redraw but don't actually clip the dirty area (typically the ones that shouldnt become clear-color) @@ -523,17 +523,18 @@ void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *clip delete clipRect; } } -void BaseRenderOSystem::drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror) { - TransparentSurface src(*surf, false); +void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect) { + TransparentSurface src(*ticket->getSurface(), false); bool doDelete = false; if (!clipRect) { doDelete = true; clipRect = new Common::Rect(); - clipRect->setWidth(surf->w); - clipRect->setHeight(surf->h); + clipRect->setWidth(ticket->getSurface()->w); + clipRect->setHeight(ticket->getSurface()->h); } - src.blit(*_renderSurface, dstRect->left, dstRect->top, mirror, clipRect, _colorMod, clipRect->width(), clipRect->height()); + src._enableAlphaBlit = ticket->_hasAlpha; + src.blit(*_renderSurface, dstRect->left, dstRect->top, ticket->_mirror, clipRect, _colorMod, clipRect->width(), clipRect->height()); if (doDelete) { delete clipRect; } diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index 1cef0038a1..e13085d68a 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -106,8 +106,10 @@ public: private: void addDirtyRect(const Common::Rect &rect); void drawTickets(); + // Non-dirty-rects: void drawFromSurface(RenderTicket *ticket, Common::Rect *clipRect); - void drawFromSurface(const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect, uint32 mirror); + // Dirty-rects: + void drawFromSurface(RenderTicket *ticket, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect); typedef Common::List::iterator RenderQueueIterator; Common::Rect *_dirtyRect; Common::List _renderQueue; -- cgit v1.2.3