aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2011-07-02 22:05:45 -0400
committerJohannes Schickel2012-03-20 01:06:48 +0100
commit765a8704454d705acc9ce5aa7a90c1c3079fb989 (patch)
treeffb665cb56dc0b28b208ef13f5e0e75ed477fa7e /engines
parent4516b5ea24e6c0056984a65fe4fff33553931487 (diff)
downloadscummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.tar.gz
scummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.tar.bz2
scummvm-rg350-765a8704454d705acc9ce5aa7a90c1c3079fb989.zip
GRAPHICS: Convert JPEG to the ImageDecoder API
Diffstat (limited to 'engines')
-rw-r--r--engines/groovie/roq.cpp6
-rw-r--r--engines/mohawk/myst_graphics.cpp17
-rw-r--r--engines/mohawk/myst_graphics.h5
3 files changed, 8 insertions, 20 deletions
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 53f335ce68..8da8671b5d 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -30,8 +30,8 @@
#include "common/debug.h"
#include "common/textconsole.h"
-#include "graphics/jpeg.h"
#include "graphics/palette.h"
+#include "graphics/decoders/jpeg.h"
#ifdef USE_RGB_COLOR
// Required for the YUV to RGB conversion
@@ -435,8 +435,8 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
warning("Groovie::ROQ: JPEG frame (unfinshed)");
- Graphics::JPEG *jpg = new Graphics::JPEG();
- jpg->read(_file);
+ Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder();
+ jpg->loadStream(*_file);
byte *y = (byte *)jpg->getComponent(1)->getBasePtr(0, 0);
byte *u = (byte *)jpg->getComponent(2)->getBasePtr(0, 0);
byte *v = (byte *)jpg->getComponent(3)->getBasePtr(0, 0);
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;