diff options
| author | Matthew Hoops | 2011-07-02 22:05:45 -0400 |
|---|---|---|
| committer | Johannes Schickel | 2012-03-20 01:06:48 +0100 |
| commit | 765a8704454d705acc9ce5aa7a90c1c3079fb989 (patch) | |
| tree | ffb665cb56dc0b28b208ef13f5e0e75ed477fa7e /engines/mohawk | |
| parent | 4516b5ea24e6c0056984a65fe4fff33553931487 (diff) | |
| download | scummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.tar.gz scummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.tar.bz2 scummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.zip | |
GRAPHICS: Convert JPEG to the ImageDecoder API
Diffstat (limited to 'engines/mohawk')
| -rw-r--r-- | engines/mohawk/myst_graphics.cpp | 17 | ||||
| -rw-r--r-- | engines/mohawk/myst_graphics.h | 5 |
2 files changed, 5 insertions, 17 deletions
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp index 86eb4f2b1b..484e49d529 100644 --- a/engines/mohawk/myst_graphics.cpp +++ b/engines/mohawk/myst_graphics.cpp @@ -28,7 +28,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "engines/util.h" -#include "graphics/jpeg.h" +#include "graphics/decoders/jpeg.h" #include "graphics/decoders/pict.h" namespace Mohawk { @@ -49,12 +49,6 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { if (_pixelFormat.bytesPerPixel == 1) error("Myst requires greater than 256 colors to run"); - if (_vm->getFeatures() & GF_ME) { - _jpegDecoder = new Graphics::JPEG(); - } else { - _jpegDecoder = NULL; - } - _pictureFile.entries = NULL; // Initialize our buffer @@ -67,7 +61,6 @@ MystGraphics::MystGraphics(MohawkEngine_Myst* vm) : GraphicsManager(), _vm(vm) { MystGraphics::~MystGraphics() { delete _bmpDecoder; - delete _jpegDecoder; delete[] _pictureFile.entries; _backBuffer->free(); @@ -127,13 +120,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) { - Common::SeekableReadStream *stream = new Common::SeekableSubReadStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size); + Graphics::JPEGDecoder jpeg; + Common::SeekableSubReadStream subStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size); - if (!_jpegDecoder->read(stream)) + if (!jpeg.loadStream(subStream)) error("Could not decode Myst ME Mac JPEG"); - mhkSurface = new MohawkSurface(_jpegDecoder->getSurface(_pixelFormat)); - delete stream; + mhkSurface = new MohawkSurface(jpeg.getSurface()->convertTo(_pixelFormat)); } else if (_pictureFile.entries[i].type == 1) { Graphics::PICTDecoder pict; Common::SeekableSubReadStream subStream(&_pictureFile.picFile, _pictureFile.entries[i].offset, _pictureFile.entries[i].offset + _pictureFile.entries[i].size); diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h index 8074c9828b..20fd46c5b9 100644 --- a/engines/mohawk/myst_graphics.h +++ b/engines/mohawk/myst_graphics.h @@ -27,10 +27,6 @@ #include "common/file.h" -namespace Graphics { -class JPEG; -} - namespace Mohawk { class MystBitmap; @@ -69,7 +65,6 @@ protected: private: MohawkEngine_Myst *_vm; MystBitmap *_bmpDecoder; - Graphics::JPEG *_jpegDecoder; struct PictureFile { uint32 pictureCount; |
