diff options
author | Matthew Hoops | 2013-09-16 20:56:59 -0400 |
---|---|---|
committer | Matthew Hoops | 2013-09-16 20:56:59 -0400 |
commit | b88293914106fc3b9e503412ab72b030ea0960de (patch) | |
tree | 13c85877c00cc288fcbf792096aae98273ba0478 | |
parent | d9e6617818d0f013b2f70ceec29f4d86c3b6bc0f (diff) | |
download | scummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.tar.gz scummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.tar.bz2 scummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.zip |
GROOVIE: Fix ROQ JPEG decoding
-rw-r--r-- | engines/groovie/roq.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 5592d848a9..e1ca7fb945 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -28,6 +28,7 @@ #include "groovie/groovie.h" #include "common/debug.h" +#include "common/substream.h" #include "common/textconsole.h" #include "graphics/palette.h" @@ -436,14 +437,19 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) { Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder(); jpg->setOutputColorSpace(Graphics::JPEGDecoder::kColorSpaceYUV); - jpg->loadStream(*_file); + + uint32 startPos = _file->pos(); + Common::SeekableSubReadStream subStream(_file, startPos, startPos + blockHeader.size, DisposeAfterUse::NO); + jpg->loadStream(subStream); const Graphics::Surface *srcSurf = jpg->getSurface(); const byte *src = (const byte *)srcSurf->getPixels(); byte *ptr = (byte *)_currBuf->getPixels(); - memcpy(ptr, src, _currBuf->w * _currBuf->h); + memcpy(ptr, src, _currBuf->w * _currBuf->h * srcSurf->format.bytesPerPixel); delete jpg; + + _file->seek(startPos + blockHeader.size); return true; } |