aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2013-09-16 20:56:59 -0400
committerMatthew Hoops2013-09-16 20:56:59 -0400
commitb88293914106fc3b9e503412ab72b030ea0960de (patch)
tree13c85877c00cc288fcbf792096aae98273ba0478
parentd9e6617818d0f013b2f70ceec29f4d86c3b6bc0f (diff)
downloadscummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.tar.gz
scummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.tar.bz2
scummvm-rg350-b88293914106fc3b9e503412ab72b030ea0960de.zip
GROOVIE: Fix ROQ JPEG decoding
-rw-r--r--engines/groovie/roq.cpp10
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;
}