aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2010-10-14 20:44:44 +0000
committerEugene Sandulenko2010-10-14 20:44:44 +0000
commitf67bbc4eccd483e329845c05c8aa2dc5ab6f8215 (patch)
treead4db0272853566115c4846a4efc580790f81ff8
parent00a477fa79c3b9d5317203a9f839fac04ffe8b1d (diff)
downloadscummvm-rg350-f67bbc4eccd483e329845c05c8aa2dc5ab6f8215.tar.gz
scummvm-rg350-f67bbc4eccd483e329845c05c8aa2dc5ab6f8215.tar.bz2
scummvm-rg350-f67bbc4eccd483e329845c05c8aa2dc5ab6f8215.zip
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. svn-id: r53459
-rw-r--r--engines/sword25/fmv/movieplayer.cpp21
-rw-r--r--engines/sword25/fmv/movieplayer.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp
index 1ca7b43dae..164f46eb09 100644
--- a/engines/sword25/fmv/movieplayer.cpp
+++ b/engines/sword25/fmv/movieplayer.cpp
@@ -41,6 +41,8 @@
#ifdef USE_THEORADEC
+#define INDIRECTRENDERING 1
+
namespace Sword25 {
#define BS_LOG_PREFIX "MOVIEPLAYER"
@@ -69,6 +71,8 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
// 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,6 +95,17 @@ bool MoviePlayer::loadMovie(const Common::String &filename, uint z) {
// 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 @@ void MoviePlayer::update() {
// 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
}
}
diff --git a/engines/sword25/fmv/movieplayer.h b/engines/sword25/fmv/movieplayer.h
index c02285df74..26b5cdd0d8 100644
--- a/engines/sword25/fmv/movieplayer.h
+++ b/engines/sword25/fmv/movieplayer.h
@@ -140,6 +140,9 @@ private:
TheoraDecoder _decoder;
+ Graphics::Surface *_backSurface;
+ int _outX, _outY;
+
RenderObjectPtr<Bitmap> _outputBitmap;
};