From 0b76f66edcf283f48f8f945dc18a764bf427fdf1 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Tue, 21 Jan 2014 01:27:22 +0100 Subject: WINTERMUTE: Special-case FMV-handling to not fill the screen with background color. If we have only one thing being drawn, and that is opaque, we can skip filling the render surface with background color. This shaves another few wasted cycles of the FMV playback. (Since we now don’t have to write the entire render surface TWICE). This reduces the time spent in drawTickets() to ~60% of what it was before. --- .../base/gfx/osystem/base_render_osystem.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'engines/wintermute/base/gfx') diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index ff63789d18..35918b8e90 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -399,10 +399,23 @@ void BaseRenderOSystem::drawTickets() { return; } - // Apply the clear-color to the dirty rect. - _renderSurface->fillRect(*_dirtyRect, _clearColor); + it = _renderQueue.begin(); _lastFrameIter = _renderQueue.end(); - for (it = _renderQueue.begin(); it != _renderQueue.end(); ++it) { + // A special case: If the screen has one giant OPAQUE rect to be drawn, then we skip filling + // the background colour. Typical use-case: Fullscreen FMVs. + // Caveat: The FPS-counter will invalidate this. + if (it != _lastFrameIter && _renderQueue.front() == _renderQueue.back() && (*it)->_transform._alphaDisable == true) { + // If our single opaque rect fills the dirty rect, we can skip filling. + if (*_dirtyRect != (*it)->_dstRect) { + // Apply the clear-color to the dirty rect. + _renderSurface->fillRect(*_dirtyRect, _clearColor); + } + // Otherwise Do NOT fill. + } else { + // Apply the clear-color to the dirty rect. + _renderSurface->fillRect(*_dirtyRect, _clearColor); + } + for (; it != _renderQueue.end(); ++it) { RenderTicket *ticket = *it; if (ticket->_dstRect.intersects(*_dirtyRect)) { // dstClip is the area we want redrawn. -- cgit v1.2.3