aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/mohawk/graphics.cpp15
-rw-r--r--engines/mohawk/graphics.h9
2 files changed, 16 insertions, 8 deletions
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 19fb561e37..99822857ba 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -30,9 +30,8 @@
#include "mohawk/livingbooks.h"
#include "common/substream.h"
-
#include "engines/util.h"
-
+#include "graphics/jpeg.h"
#include "graphics/primitives.h"
#include "gui/message.h"
@@ -253,7 +252,7 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) {
error("Myst requires greater than 256 colors to run");
if (_vm->getFeatures() & GF_ME) {
- _jpegDecoder = new Graphics::JPEGDecoder();
+ _jpegDecoder = new Graphics::JPEG();
_pictDecoder = new Graphics::PictDecoder(_pixelFormat);
} else {
_jpegDecoder = NULL;
@@ -327,9 +326,13 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) {
for (uint32 i = 0; i < _pictureFile.pictureCount; i++)
if (_pictureFile.entries[i].id == id) {
if (_pictureFile.entries[i].type == 0) {
- Graphics::Surface *surface = new Graphics::Surface();
- surface->copyFrom(*_jpegDecoder->decodeImage(new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size)));
- mhkSurface = new MohawkSurface(surface);
+ Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size);
+
+ if (!_jpegDecoder->read(stream))
+ error("Could not decode Myst ME Mac JPEG");
+
+ mhkSurface = new MohawkSurface(_jpegDecoder->getSurface(_pixelFormat));
+ delete stream;
} else if (_pictureFile.entries[i].type == 1) {
mhkSurface = new MohawkSurface(_pictDecoder->decodeImage(new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size)));
} else
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index c664e76dcc..969188457a 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -31,7 +31,12 @@
#include "common/file.h"
#include "common/hashmap.h"
#include "graphics/pict.h"
-#include "graphics/video/codecs/mjpeg.h"
+
+namespace Graphics {
+
+class JPEG;
+
+}
namespace Mohawk {
@@ -132,7 +137,7 @@ private:
MohawkEngine_Myst *_vm;
MystBitmap *_bmpDecoder;
Graphics::PictDecoder *_pictDecoder;
- Graphics::JPEGDecoder *_jpegDecoder;
+ Graphics::JPEG *_jpegDecoder;
struct PictureFile {
uint32 pictureCount;