aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {