aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-11-22 19:25:23 -0500
committerPaul Gilbert2016-11-22 19:25:23 -0500
commit2a20ce75c3ca2f8e6f4a02e571e373f19a8ec115 (patch)
treea81b476431ed375824c1808f57397cd271be73bd
parent88868ec67ce1270f20e79ed338cec7d0384cd486 (diff)
downloadscummvm-rg350-2a20ce75c3ca2f8e6f4a02e571e373f19a8ec115.tar.gz
scummvm-rg350-2a20ce75c3ca2f8e6f4a02e571e373f19a8ec115.tar.bz2
scummvm-rg350-2a20ce75c3ca2f8e6f4a02e571e373f19a8ec115.zip
TITANIC: Defer creating movie frame surfaces until renderFrame
-rw-r--r--engines/titanic/support/avi_surface.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index 79614d2c40..17a6fcf68f 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -227,13 +227,11 @@ void AVISurface::setupDecompressor() {
return;
for (int idx = 0; idx < _streamCount; ++idx) {
- // Setup frame surface
- _movieFrameSurface[idx] = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(),
- _decoder->getVideoTrack(idx).getPixelFormat());
-
+ Graphics::PixelFormat format = _decoder->getVideoTrack(idx).getPixelFormat();
+ int decoderPitch = _decoder->getWidth() * format.bytesPerPixel;
bool flag = false;
- if (idx == 0 && _videoSurface &&
- _videoSurface->getPitch() == _movieFrameSurface[idx]->pitch) {
+
+ if (idx == 0 && _videoSurface && _videoSurface->getPitch() == decoderPitch) {
const uint bitCount = _decoder->getVideoTrack(0).getBitCount();
const int vDepth = _videoSurface->getPixelDepth();
@@ -314,6 +312,12 @@ bool AVISurface::renderFrame() {
const Graphics::Surface *frame = (idx == 0) ?
_decoder->decodeNextFrame() : _decoder->decodeNextTransparency();
+ if (!_movieFrameSurface[idx]) {
+ // Setup frame surface
+ _movieFrameSurface[idx] = new Graphics::ManagedSurface(_decoder->getWidth(), _decoder->getHeight(),
+ _decoder->getVideoTrack(idx).getPixelFormat());
+ }
+
if (_movieFrameSurface[idx]->format == frame->format) {
_movieFrameSurface[idx]->blitFrom(*frame);
} else {