diff options
author | Matthew Hoops | 2010-12-16 01:35:13 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-12-16 01:35:13 +0000 |
commit | 375f32fbe94e8500a03c19ed32865efdcde8ca8e (patch) | |
tree | 3544a3da06401aea4192a7557294b61734e4d1ef /engines | |
parent | a2bb676c19c70cd79f141650fe0587148c71702b (diff) | |
download | scummvm-rg350-375f32fbe94e8500a03c19ed32865efdcde8ca8e.tar.gz scummvm-rg350-375f32fbe94e8500a03c19ed32865efdcde8ca8e.tar.bz2 scummvm-rg350-375f32fbe94e8500a03c19ed32865efdcde8ca8e.zip |
VIDEO: Make VideoDecoder::decodeNextFrame() return a const Surface pointer
svn-id: r54927
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/animation.cpp | 4 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 2 | ||||
-rw-r--r-- | engines/mohawk/video.cpp | 24 | ||||
-rw-r--r-- | engines/saga/introproc_saga2.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/kvideo.cpp | 2 | ||||
-rw-r--r-- | engines/sci/video/seq_decoder.cpp | 2 | ||||
-rw-r--r-- | engines/sci/video/seq_decoder.h | 2 | ||||
-rw-r--r-- | engines/scumm/he/animation_he.cpp | 2 | ||||
-rw-r--r-- | engines/sword1/animation.cpp | 2 | ||||
-rw-r--r-- | engines/sword2/animation.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/fmv/movieplayer.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/fmv/theora_decoder.cpp | 2 | ||||
-rw-r--r-- | engines/sword25/fmv/theora_decoder.h | 2 | ||||
-rw-r--r-- | engines/toon/movie.cpp | 2 | ||||
-rw-r--r-- | engines/tucker/sequences.cpp | 4 |
15 files changed, 28 insertions, 28 deletions
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index 4fe8f8e6bc..5406e9c7ef 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -267,7 +267,7 @@ void MoviePlayerDXA::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { uint h = getHeight(); uint w = getWidth(); - Graphics::Surface *surface = decodeNextFrame(); + const Graphics::Surface *surface = decodeNextFrame(); byte *src = (byte *)surface->pixels; dst += y * pitch + x; @@ -428,7 +428,7 @@ void MoviePlayerSMK::copyFrameToBuffer(byte *dst, uint x, uint y, uint pitch) { uint h = getHeight(); uint w = getWidth(); - Graphics::Surface *surface = decodeNextFrame(); + const Graphics::Surface *surface = decodeNextFrame(); byte *src = (byte *)surface->pixels; dst += y * pitch + x; diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 3d29c2ce26..7448c85ef1 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -325,7 +325,7 @@ bool VideoPlayer::playFrame(int slot, Properties &properties) { _vm->_draw->forceBlit(); } - Graphics::Surface *surface = video->decoder->decodeNextFrame(); + const Graphics::Surface *surface = video->decoder->decodeNextFrame(); WRITE_VAR(11, video->decoder->getCurFrame()); diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp index 863a14335f..e54aa67df3 100644 --- a/engines/mohawk/video.cpp +++ b/engines/mohawk/video.cpp @@ -178,18 +178,19 @@ bool VideoManager::updateBackgroundMovies() { // Check if we need to draw a frame if (_videoStreams[i]->needsUpdate()) { - Graphics::Surface *frame = _videoStreams[i]->decodeNextFrame(); - bool deleteFrame = false; + const Graphics::Surface *frame = _videoStreams[i]->decodeNextFrame(); + Graphics::Surface *convertedFrame = 0; if (frame && _videoStreams[i].enabled) { // Convert from 8bpp to the current screen format if necessary Graphics::PixelFormat pixelFormat = _vm->_system->getScreenFormat(); + if (frame->bytesPerPixel == 1 && pixelFormat.bytesPerPixel != 1) { - Graphics::Surface *newFrame = new Graphics::Surface(); + convertedFrame = new Graphics::Surface(); byte *palette = _videoStreams[i]->getPalette(); assert(palette); - newFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); + convertedFrame->create(frame->w, frame->h, pixelFormat.bytesPerPixel); for (uint16 j = 0; j < frame->h; j++) { for (uint16 k = 0; k < frame->w; k++) { @@ -198,14 +199,13 @@ bool VideoManager::updateBackgroundMovies() { byte g = palette[palIndex * 3 + 1]; byte b = palette[palIndex * 3 + 2]; if (pixelFormat.bytesPerPixel == 2) - *((uint16 *)newFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); + *((uint16 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); else - *((uint32 *)newFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); + *((uint32 *)convertedFrame->getBasePtr(k, j)) = pixelFormat.RGBToColor(r, g, b); } } - frame = newFrame; - deleteFrame = true; + frame = convertedFrame; } // Clip the width/height to make sure we stay on the screen (Myst does this a few times) @@ -216,10 +216,10 @@ bool VideoManager::updateBackgroundMovies() { // We've drawn something to the screen, make sure we update it updateScreen = true; - // Delete the frame if we're using the buffer from the 8bpp conversion - if (deleteFrame) { - frame->free(); - delete frame; + // Delete 8bpp conversion surface + if (convertedFrame) { + convertedFrame->free(); + delete convertedFrame; } } } diff --git a/engines/saga/introproc_saga2.cpp b/engines/saga/introproc_saga2.cpp index 785534729e..ec157b4a13 100644 --- a/engines/saga/introproc_saga2.cpp +++ b/engines/saga/introproc_saga2.cpp @@ -103,7 +103,7 @@ void Scene::playMovie(const char *filename) { while (!_vm->shouldQuit() && !smkDecoder->endOfVideo() && !skipVideo) { if (smkDecoder->needsUpdate()) { - Graphics::Surface *frame = smkDecoder->decodeNextFrame(); + const Graphics::Surface *frame = smkDecoder->decodeNextFrame(); if (frame) { _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index 9245572bbf..b4c3c3bddf 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -67,7 +67,7 @@ void playVideo(Graphics::VideoDecoder *videoDecoder) { while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { if (videoDecoder->needsUpdate()) { - Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); if (frame) { if (scaleBuffer) { // TODO: Probably should do aspect ratio correction in e.g. GK1 Windows diff --git a/engines/sci/video/seq_decoder.cpp b/engines/sci/video/seq_decoder.cpp index a08f837866..3f4bd458b8 100644 --- a/engines/sci/video/seq_decoder.cpp +++ b/engines/sci/video/seq_decoder.cpp @@ -108,7 +108,7 @@ void SeqDecoder::close() { reset(); } -Graphics::Surface *SeqDecoder::decodeNextFrame() { +const Graphics::Surface *SeqDecoder::decodeNextFrame() { int16 frameWidth = _fileStream->readUint16LE(); int16 frameHeight = _fileStream->readUint16LE(); int16 frameLeft = _fileStream->readUint16LE(); diff --git a/engines/sci/video/seq_decoder.h b/engines/sci/video/seq_decoder.h index 1714477083..4d94d145ce 100644 --- a/engines/sci/video/seq_decoder.h +++ b/engines/sci/video/seq_decoder.h @@ -47,7 +47,7 @@ public: uint16 getWidth() const { return SEQ_SCREEN_WIDTH; } uint16 getHeight() const { return SEQ_SCREEN_HEIGHT; } uint32 getFrameCount() const { return _frameCount; } - Graphics::Surface *decodeNextFrame(); + const Graphics::Surface *decodeNextFrame(); Graphics::PixelFormat getPixelFormat() const { return Graphics::PixelFormat::createFormatCLUT8(); } byte *getPalette() { _dirtyPalette = false; return _palette; } bool hasDirtyPalette() const { return _dirtyPalette; } diff --git a/engines/scumm/he/animation_he.cpp b/engines/scumm/he/animation_he.cpp index 9f1bf22c38..80cfcfcd0b 100644 --- a/engines/scumm/he/animation_he.cpp +++ b/engines/scumm/he/animation_he.cpp @@ -68,7 +68,7 @@ void MoviePlayer::copyFrameToBuffer(byte *dst, int dstType, uint x, uint y, uint uint h = getHeight(); uint w = getWidth(); - Graphics::Surface *surface = decodeNextFrame(); + const Graphics::Surface *surface = decodeNextFrame(); byte *src = (byte *)surface->pixels; if (hasDirtyPalette()) diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 441e622184..8df1812098 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -252,7 +252,7 @@ bool MoviePlayer::playVideo() { while (!_vm->shouldQuit() && !_decoder->endOfVideo()) { if (_decoder->needsUpdate()) { - Graphics::Surface *frame = _decoder->decodeNextFrame(); + const Graphics::Surface *frame = _decoder->decodeNextFrame(); if (frame) _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index f664e784d5..617c254ec4 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -279,7 +279,7 @@ bool MoviePlayer::playVideo() { while (!_vm->shouldQuit() && !_decoder->endOfVideo()) { if (_decoder->needsUpdate()) { - Graphics::Surface *frame = _decoder->decodeNextFrame(); + const Graphics::Surface *frame = _decoder->decodeNextFrame(); if (frame) _vm->_system->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 4193e02b2e..356c2d11ff 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -124,7 +124,7 @@ bool MoviePlayer::pause() { void MoviePlayer::update() { if (_decoder.isVideoLoaded()) { - Graphics::Surface *s = _decoder.decodeNextFrame(); + const Graphics::Surface *s = _decoder.decodeNextFrame(); if (s) { // Transfer the next frame assert(s->bytesPerPixel == 4); diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index d6c2544fe5..8a0397cdfc 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -329,7 +329,7 @@ void TheoraDecoder::close() { reset(); } -Graphics::Surface *TheoraDecoder::decodeNextFrame() { +const Graphics::Surface *TheoraDecoder::decodeNextFrame() { int i, j; // _stateFlag = false; // playback has not begun diff --git a/engines/sword25/fmv/theora_decoder.h b/engines/sword25/fmv/theora_decoder.h index f6c622563b..69bf41b741 100644 --- a/engines/sword25/fmv/theora_decoder.h +++ b/engines/sword25/fmv/theora_decoder.h @@ -67,7 +67,7 @@ public: * @note the return surface should *not* be freed * @note this may return 0, in which case the last frame should be kept on screen */ - Graphics::Surface *decodeNextFrame(); + const Graphics::Surface *decodeNextFrame(); bool isVideoLoaded() const { return _fileStream != 0; diff --git a/engines/toon/movie.cpp b/engines/toon/movie.cpp index f0c40366be..34769f028a 100644 --- a/engines/toon/movie.cpp +++ b/engines/toon/movie.cpp @@ -97,7 +97,7 @@ bool Movie::playVideo() { int32 y = 0; while (!_vm->shouldQuit() && !_decoder->endOfVideo()) { if (_decoder->needsUpdate()) { - Graphics::Surface *frame = _decoder->decodeNextFrame(); + const Graphics::Surface *frame = _decoder->decodeNextFrame(); if (frame) _vm->getSystem()->copyRectToScreen((byte *)frame->pixels, frame->pitch, x, y, frame->w, frame->h); _decoder->setSystemPalette(); diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 633ed2790d..d804d85d9a 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -765,7 +765,7 @@ void AnimationSequencePlayer::openAnimation(int index, const char *fileName) { } bool AnimationSequencePlayer::decodeNextAnimationFrame(int index, bool copyDirtyRects) { - ::Graphics::Surface *surface = _flicPlayer[index].decodeNextFrame(); + const ::Graphics::Surface *surface = _flicPlayer[index].decodeNextFrame(); if (!copyDirtyRects) { for (uint16 y = 0; (y < surface->h) && (y < kScreenHeight); y++) @@ -804,7 +804,7 @@ void AnimationSequencePlayer::playIntroSeq19_20() { // The intro credits animation. This uses 2 animations: the foreground one, which // is the actual intro credits, and the background one, which is an animation of // cogs, and is being replayed when an intro credit appears - ::Graphics::Surface *surface = 0; + const ::Graphics::Surface *surface = 0; if (_flicPlayer[0].getCurFrame() >= 115) { surface = _flicPlayer[1].decodeNextFrame(); |