aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie/roq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/groovie/roq.cpp')
-rw-r--r--engines/groovie/roq.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 72a61fefb2..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"
@@ -160,7 +161,7 @@ bool ROQPlayer::playFrameInternal() {
if (_dirty) {
// Update the screen
- _syst->copyRectToScreen(_bg->getBasePtr(0, 0), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
+ _syst->copyRectToScreen(_bg->getPixels(), _bg->pitch, 0, (_syst->getHeight() - _bg->h) / 2, _bg->w, _bg->h);
_syst->updateScreen();
// Clear the dirty flag
@@ -291,8 +292,8 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
}
// Clear the buffers with black YUV values
- byte *ptr1 = (byte *)_currBuf->getBasePtr(0, 0);
- byte *ptr2 = (byte *)_prevBuf->getBasePtr(0, 0);
+ byte *ptr1 = (byte *)_currBuf->getPixels();
+ byte *ptr2 = (byte *)_prevBuf->getPixels();
for (int i = 0; i < width * height; i++) {
*ptr1++ = 0;
*ptr1++ = 128;
@@ -435,19 +436,20 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
warning("Groovie::ROQ: JPEG frame (unfinished)");
Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder();
- jpg->loadStream(*_file);
- const byte *y = (const byte *)jpg->getComponent(1)->getBasePtr(0, 0);
- const byte *u = (const byte *)jpg->getComponent(2)->getBasePtr(0, 0);
- const byte *v = (const byte *)jpg->getComponent(3)->getBasePtr(0, 0);
+ jpg->setOutputColorSpace(Graphics::JPEGDecoder::kColorSpaceYUV);
- byte *ptr = (byte *)_currBuf->getBasePtr(0, 0);
- for (int i = 0; i < _currBuf->w * _currBuf->h; i++) {
- *ptr++ = *y++;
- *ptr++ = *u++;
- *ptr++ = *v++;
- }
+ 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 * srcSurf->format.bytesPerPixel);
delete jpg;
+
+ _file->seek(startPos + blockHeader.size);
return true;
}