[Scummvm-cvs-logs] SF.net SVN: scummvm:[53459] scummvm/trunk/engines/sword25/fmv

sev at users.sourceforge.net sev at users.sourceforge.net
Thu Oct 14 22:44:44 CEST 2010


Revision: 53459
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53459&view=rev
Author:   sev
Date:     2010-10-14 20:44:44 +0000 (Thu, 14 Oct 2010)

Log Message:
-----------
SWORD25: Attempt to optimize movie rendering

Current code makes about 5 blits of each frame which is a huge
overhead. This code is an attempt to make that 1. Doesn't work yet
as the rendering pipe keeps blitting invisible pictures.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
    scummvm/trunk/engines/sword25/fmv/movieplayer.h

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer.cpp
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer.cpp	2010-10-14 18:51:11 UTC (rev 53458)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer.cpp	2010-10-14 20:44:44 UTC (rev 53459)
@@ -41,6 +41,8 @@
 
 #ifdef USE_THEORADEC
 
+#define INDIRECTRENDERING 1
+
 namespace Sword25 {
 
 #define BS_LOG_PREFIX "MOVIEPLAYER"
@@ -69,6 +71,8 @@
 
 	// Ausgabebitmap erstellen
 	GraphicEngine *pGfx = Kernel::GetInstance()->GetGfx();
+
+#if INDIRECTRENDERING
 	_outputBitmap = pGfx->GetMainPanel()->addDynamicBitmap(_decoder.getWidth(), _decoder.getHeight());
 	if (!_outputBitmap.isValid()) {
 		BS_LOG_ERRORLN("Output bitmap for movie playback could not be created.");
@@ -91,7 +95,18 @@
 	// Ausgabebitmap auf dem Bildschirm zentrieren
 	_outputBitmap->setX((pGfx->GetDisplayWidth() - _outputBitmap->getWidth()) / 2);
 	_outputBitmap->setY((pGfx->GetDisplayHeight() - _outputBitmap->getHeight()) / 2);
+#else
+	_backSurface = pGfx->getSurface();
 
+	_outX = (pGfx->GetDisplayWidth() - _decoder.getWidth()) / 2;
+	_outY = (pGfx->GetDisplayHeight() - _decoder.getHeight()) / 2;
+
+	if (_outX < 0)
+		_outX = 0;
+	if (_outY < 0)
+		_outY = 0;
+#endif
+
 	return true;
 }
 
@@ -118,8 +133,14 @@
 
 		// Transfer the next frame
 		assert(s->bytesPerPixel == 4);
+
+#if INDIRECTRENDERING
 		byte *frameData = (byte *)s->getBasePtr(0, 0);
 		_outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch);
+#else
+		g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h));
+		g_system->updateScreen();
+#endif
 	}
 }
 

Modified: scummvm/trunk/engines/sword25/fmv/movieplayer.h
===================================================================
--- scummvm/trunk/engines/sword25/fmv/movieplayer.h	2010-10-14 18:51:11 UTC (rev 53458)
+++ scummvm/trunk/engines/sword25/fmv/movieplayer.h	2010-10-14 20:44:44 UTC (rev 53459)
@@ -140,6 +140,9 @@
 
 	TheoraDecoder _decoder;
 
+	Graphics::Surface *_backSurface;
+	int _outX, _outY;
+
 	RenderObjectPtr<Bitmap>	_outputBitmap;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list