diff options
-rw-r--r-- | Makefile.common | 1 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard-parser.cpp | 4 | ||||
-rw-r--r-- | devtools/create_project/create_project.cpp | 1 | ||||
-rw-r--r-- | engines/dreamweb/vgagrafx.cpp | 4 | ||||
-rw-r--r-- | engines/gob/inter_v7.cpp | 5 | ||||
-rw-r--r-- | engines/gob/surface.cpp | 5 | ||||
-rw-r--r-- | engines/groovie/roq.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/hugo/dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/hugo/file.cpp | 5 | ||||
-rw-r--r-- | engines/mohawk/bitmap.cpp | 4 | ||||
-rw-r--r-- | engines/mohawk/myst_graphics.cpp | 5 | ||||
-rw-r--r-- | engines/parallaction/disk_br.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 10 | ||||
-rw-r--r-- | engines/pegasus/cursor.cpp | 6 | ||||
-rw-r--r-- | engines/pegasus/surface.cpp | 4 | ||||
-rw-r--r-- | engines/queen/display.cpp | 9 | ||||
-rw-r--r-- | engines/saga/scene.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/maciconbar.cpp | 4 | ||||
-rw-r--r-- | engines/sword25/gfx/image/imgloader.cpp | 4 | ||||
-rw-r--r-- | engines/tucker/resource.cpp | 5 | ||||
-rw-r--r-- | engines/wintermute/base/base_persistence_manager.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_image.cpp | 20 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_image.h | 7 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp | 4 | ||||
-rw-r--r-- | engines/zvision/graphics/render_manager.cpp | 4 | ||||
-rw-r--r-- | graphics/module.mk | 9 | ||||
-rw-r--r-- | gui/ThemeEngine.cpp | 5 | ||||
-rw-r--r-- | image/bmp.cpp (renamed from graphics/decoders/bmp.cpp) | 8 | ||||
-rw-r--r-- | image/bmp.h (renamed from graphics/decoders/bmp.h) | 19 | ||||
-rw-r--r-- | image/iff.cpp (renamed from graphics/decoders/iff.cpp) | 8 | ||||
-rw-r--r-- | image/iff.h (renamed from graphics/decoders/iff.h) | 20 | ||||
-rw-r--r-- | image/image_decoder.h (renamed from graphics/decoders/image_decoder.h) | 15 | ||||
-rw-r--r-- | image/jpeg.cpp (renamed from graphics/decoders/jpeg.cpp) | 8 | ||||
-rw-r--r-- | image/jpeg.h (renamed from graphics/decoders/jpeg.h) | 10 | ||||
-rw-r--r-- | image/module.mk | 13 | ||||
-rw-r--r-- | image/pcx.cpp (renamed from graphics/decoders/pcx.cpp) | 8 | ||||
-rw-r--r-- | image/pcx.h (renamed from graphics/decoders/pcx.h) | 17 | ||||
-rw-r--r-- | image/pict.cpp (renamed from graphics/decoders/pict.cpp) | 14 | ||||
-rw-r--r-- | image/pict.h (renamed from graphics/decoders/pict.h) | 15 | ||||
-rw-r--r-- | image/png.cpp (renamed from graphics/decoders/png.cpp) | 6 | ||||
-rw-r--r-- | image/png.h (renamed from graphics/decoders/png.h) | 15 | ||||
-rw-r--r-- | image/tga.cpp (renamed from graphics/decoders/tga.cpp) | 22 | ||||
-rw-r--r-- | image/tga.h (renamed from graphics/decoders/tga.h) | 18 | ||||
-rw-r--r-- | video/codecs/jpeg.cpp | 4 | ||||
-rw-r--r-- | video/codecs/mjpeg.cpp | 4 |
46 files changed, 199 insertions, 188 deletions
diff --git a/Makefile.common b/Makefile.common index b56300a115..4071d97150 100644 --- a/Makefile.common +++ b/Makefile.common @@ -25,6 +25,7 @@ MODULES += \ engines \ video \ graphics \ + image \ audio \ common \ po diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index bb8286d1f5..25c0161ae6 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -34,7 +34,7 @@ #include "common/tokenizer.h" #include "common/stream.h" -#include "graphics/decoders/bmp.h" +#include "image/bmp.h" namespace Common { @@ -267,7 +267,7 @@ bool VirtualKeyboardParser::parserCallback_layout(ParserNode *node) { const Graphics::PixelFormat format = g_system->getOverlayFormat(); { - Graphics::BitmapDecoder bmp; + Image::BitmapDecoder bmp; if (!bmp.loadStream(*file)) return parserError("Error loading bitmap '" + _mode->bitmapName + "'"); diff --git a/devtools/create_project/create_project.cpp b/devtools/create_project/create_project.cpp index 9d7ed532cb..876c116b5c 100644 --- a/devtools/create_project/create_project.cpp +++ b/devtools/create_project/create_project.cpp @@ -1305,6 +1305,7 @@ void ProjectProvider::createProject(BuildSetup &setup) { createModuleList(setup.srcDir + "/audio", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/audio/softsynth/mt32", setup.defines, setup.testDirs, in, ex); createModuleList(setup.srcDir + "/video", setup.defines, setup.testDirs, in, ex); + createModuleList(setup.srcDir + "/image", setup.defines, setup.testDirs, in, ex); // Resource files in.push_back(setup.srcDir + "/icons/" + setup.projectName + ".ico"); diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index e8531343f8..c59d3e3ad5 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -23,7 +23,7 @@ #include "dreamweb/dreamweb.h" #include "engines/util.h" #include "graphics/surface.h" -#include "graphics/decoders/pcx.h" +#include "image/pcx.h" namespace DreamWeb { @@ -161,7 +161,7 @@ void DreamWebEngine::showPCX(const Common::String &suffix) { return; } - Graphics::PCXDecoder pcx; + Image::PCXDecoder pcx; if (!pcx.loadStream(pcxFile)) { warning("showpcx: Could not process '%s'", name.c_str()); return; diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp index 75278d9477..fd9406054c 100644 --- a/engines/gob/inter_v7.cpp +++ b/engines/gob/inter_v7.cpp @@ -27,7 +27,8 @@ #include "graphics/cursorman.h" #include "graphics/wincursor.h" -#include "graphics/decoders/iff.h" + +#include "image/iff.h" #include "gob/gob.h" #include "gob/global.h" @@ -547,7 +548,7 @@ void Inter_v7::o7_loadIFFPalette() { return; } - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(*iffFile); if (!decoder.getPalette() || decoder.getPaletteColorCount() != 256) { warning("o7_loadIFFPalette(): Failed reading palette from IFF \"%s\"", file.c_str()); diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp index 00203ff312..42ac2b0d74 100644 --- a/engines/gob/surface.cpp +++ b/engines/gob/surface.cpp @@ -31,7 +31,8 @@ #include "graphics/primitives.h" #include "graphics/pixelformat.h" #include "graphics/surface.h" -#include "graphics/decoders/iff.h" + +#include "image/iff.h" namespace Gob { @@ -814,7 +815,7 @@ bool Surface::loadTGA(Common::SeekableReadStream &stream) { } bool Surface::loadIFF(Common::SeekableReadStream &stream) { - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(stream); if (!decoder.getSurface()) diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 88f14b859e..4b3fb81828 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -32,7 +32,7 @@ #include "common/textconsole.h" #include "graphics/palette.h" -#include "graphics/decoders/jpeg.h" +#include "image/jpeg.h" #ifdef USE_RGB_COLOR // Required for the YUV to RGB conversion @@ -435,20 +435,18 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) { warning("Groovie::ROQ: JPEG frame (unfinished)"); - Graphics::JPEGDecoder *jpg = new Graphics::JPEGDecoder(); - jpg->setOutputColorSpace(Graphics::JPEGDecoder::kColorSpaceYUV); + Image::JPEGDecoder jpg; + jpg.setOutputColorSpace(Image::JPEGDecoder::kColorSpaceYUV); uint32 startPos = _file->pos(); Common::SeekableSubReadStream subStream(_file, startPos, startPos + blockHeader.size, DisposeAfterUse::NO); - jpg->loadStream(subStream); + jpg.loadStream(subStream); - const Graphics::Surface *srcSurf = jpg->getSurface(); + 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; } diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index e1f5037895..7227c3e833 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -28,7 +28,7 @@ #include "common/system.h" #include "graphics/palette.h" -#include "graphics/decoders/pcx.h" +#include "image/pcx.h" #include "common/file.h" #include "common/rect.h" #include "engines/util.h" @@ -301,7 +301,7 @@ void GraphicsManager::fillSurface(byte *surface, byte *col, int size) { void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte *palette, bool typeFlag) { Common::File f; - Graphics::PCXDecoder pcxDecoder; + Image::PCXDecoder pcxDecoder; // Clear the passed surface memset(surface, 0, SCREEN_WIDTH * 2 * SCREEN_HEIGHT); diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index 6894030b2b..8b145b78d8 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -21,9 +21,9 @@ */ #include "common/substream.h" -#include "graphics/decoders/bmp.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" +#include "image/bmp.h" #include "hugo/hugo.h" #include "hugo/display.h" @@ -130,7 +130,7 @@ void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { uint32 filPos = in.pos(); Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize); - Graphics::BitmapDecoder bitmapDecoder; + Image::BitmapDecoder bitmapDecoder; if (!bitmapDecoder.loadStream(stream)) error("TopMenu::loadBmpArr(): Could not load bitmap"); diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 359d4a3e6a..e2633977a8 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -34,11 +34,12 @@ #include "common/config-manager.h" #include "graphics/surface.h" -#include "graphics/decoders/pcx.h" #include "graphics/thumbnail.h" #include "gui/saveload.h" +#include "image/pcx.h" + #include "hugo/hugo.h" #include "hugo/file.h" #include "hugo/schedule.h" @@ -110,7 +111,7 @@ Seq *FileManager::readPCX(Common::SeekableReadStream &f, Seq *seqPtr, byte *imag error("Insufficient memory to run game."); } - Graphics::PCXDecoder pcx; + Image::PCXDecoder pcx; if (!pcx.loadStream(f)) error("Error while reading PCX image"); diff --git a/engines/mohawk/bitmap.cpp b/engines/mohawk/bitmap.cpp index fe2a308170..6435daf46f 100644 --- a/engines/mohawk/bitmap.cpp +++ b/engines/mohawk/bitmap.cpp @@ -29,7 +29,7 @@ #include "common/substream.h" #include "common/system.h" #include "common/textconsole.h" -#include "graphics/decoders/bmp.h" +#include "image/bmp.h" namespace Mohawk { @@ -635,7 +635,7 @@ MohawkSurface *MystBitmap::decodeImage(Common::SeekableReadStream *stream) { Common::SeekableReadStream *bmpStream = decompressLZ(stream, uncompressedSize); delete stream; - Graphics::BitmapDecoder bitmapDecoder; + Image::BitmapDecoder bitmapDecoder; if (!bitmapDecoder.loadStream(*bmpStream)) error("Could not decode Myst bitmap"); diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp index 6f7e8a8e84..9ea9f15444 100644 --- a/engines/mohawk/myst_graphics.cpp +++ b/engines/mohawk/myst_graphics.cpp @@ -28,8 +28,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "engines/util.h" -#include "graphics/decoders/jpeg.h" -#include "graphics/decoders/pict.h" +#include "image/pict.h" namespace Mohawk { @@ -94,7 +93,7 @@ MohawkSurface *MystGraphics::decodeImage(uint16 id) { MohawkSurface *mhkSurface = 0; if (isPict) { - Graphics::PICTDecoder pict; + Image::PICTDecoder pict; if (!pict.loadStream(*dataStream)) error("Could not decode Myst ME PICT"); diff --git a/engines/parallaction/disk_br.cpp b/engines/parallaction/disk_br.cpp index b31418a916..7458065b8c 100644 --- a/engines/parallaction/disk_br.cpp +++ b/engines/parallaction/disk_br.cpp @@ -23,7 +23,7 @@ #include "common/config-manager.h" #include "common/fs.h" #include "common/textconsole.h" -#include "graphics/decoders/iff.h" +#include "image/iff.h" #include "parallaction/parallaction.h" #include "parallaction/parser.h" @@ -460,7 +460,7 @@ void AmigaDisk_br::loadBackground(BackgroundInfo& info, const char *filename) { byte r,g,b; const byte *p; Common::SeekableReadStream *stream; - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; uint i; stream = tryOpenFile("backs/" + Common::String(filename), ".ap"); @@ -544,7 +544,7 @@ MaskBuffer *AmigaDisk_br::loadMask(const char *name, uint32 w, uint32 h) { return 0; } - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.setNumRelevantPlanes(2); // use only 2 first bits from each pixels decoder.setPixelPacking(true); // pack 4 2bit pixels into 1 byte decoder.loadStream(*stream); @@ -583,7 +583,7 @@ GfxObj* AmigaDisk_br::loadStatic(const char* name) { Common::String sName = name; Common::SeekableReadStream *stream = openFile("ras/" + sName, ".ras"); - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(*stream); Graphics::Surface *surf = new Graphics::Surface; @@ -720,7 +720,7 @@ GfxObj* AmigaDisk_br::loadObjects(const char *name, uint8 part) { debugC(5, kDebugDisk, "AmigaDisk_br::loadObjects"); Common::SeekableReadStream *stream = openFile(name); - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(*stream); uint16 max = objectsMax[part]; diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index a5fef16e56..28e61b04f9 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -26,7 +26,7 @@ #include "common/memstream.h" #include "common/substream.h" #include "common/textconsole.h" -#include "graphics/decoders/iff.h" +#include "image/iff.h" #include "parallaction/parser.h" #include "parallaction/parallaction.h" @@ -917,7 +917,7 @@ void AmigaDisk_ns::buildMask(byte* buf) { void AmigaDisk_ns::loadBackground(BackgroundInfo& info, const char *name) { Common::SeekableReadStream *s = openFile(name); - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(*s); info.bg.copyFrom(*decoder.getSurface()); @@ -935,7 +935,7 @@ void AmigaDisk_ns::loadBackground(BackgroundInfo& info, const char *name) { info.palette.setEntry(i, r, g, b); } - const Common::Array<Graphics::IFFDecoder::PaletteRange> &paletteRanges = decoder.getPaletteRanges(); + const Common::Array<Image::IFFDecoder::PaletteRange> &paletteRanges = decoder.getPaletteRanges(); for (uint j = 0; j < 6 && j < paletteRanges.size(); j++) { PaletteFxRange range; range._timer = paletteRanges[j].timer; @@ -959,7 +959,7 @@ void AmigaDisk_ns::loadMask_internal(BackgroundInfo& info, const char *name) { return; // no errors if missing mask files: not every location has one } - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.setNumRelevantPlanes(2); // use only 2 first bits from each pixel decoder.setPixelPacking(true); // pack 4 2bit pixels into 1 byte decoder.loadStream(*s); @@ -990,7 +990,7 @@ void AmigaDisk_ns::loadPath_internal(BackgroundInfo& info, const char *name) { return; // no errors if missing path files: not every location has one } - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.setNumRelevantPlanes(1); // use only first bit from each pixel decoder.setPixelPacking(true); // pack 8 1bit pixels into 1 byte decoder.loadStream(*s); diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp index ad0d2c2d7d..602ae88068 100644 --- a/engines/pegasus/cursor.cpp +++ b/engines/pegasus/cursor.cpp @@ -28,7 +28,7 @@ #include "common/system.h" #include "graphics/cursorman.h" #include "graphics/surface.h" -#include "graphics/decoders/pict.h" +#include "image/pict.h" #include "pegasus/cursor.h" #include "pegasus/graphics.h" @@ -148,7 +148,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) { Common::SeekableReadStream *pictStream = vm->_resFork->getResource(MKTAG('P', 'I', 'C', 'T'), cursorInfo.tag + 1000); if (pictStream) { - Graphics::PICTDecoder pict; + Image::PICTDecoder pict; if (!pict.loadStream(*pictStream)) error("Failed to decode cursor PICT %d", cursorInfo.tag + 1000); @@ -166,7 +166,7 @@ void Cursor::loadCursorImage(CursorInfo &cursorInfo) { error("Failed to find color icon %d", cursorInfo.tag); // PixMap section - Graphics::PICTDecoder::PixMap pixMap = Graphics::PICTDecoder::readPixMap(*cicnStream); + Image::PICTDecoder::PixMap pixMap = Image::PICTDecoder::readPixMap(*cicnStream); // Mask section cicnStream->readUint32BE(); // mask baseAddr diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp index cdcb3c6e79..cb1e2e7bcc 100644 --- a/engines/pegasus/surface.cpp +++ b/engines/pegasus/surface.cpp @@ -28,7 +28,7 @@ #include "common/stream.h" #include "common/system.h" #include "graphics/surface.h" -#include "graphics/decoders/pict.h" +#include "image/pict.h" #include "video/video_decoder.h" #include "pegasus/pegasus.h" @@ -101,7 +101,7 @@ void Surface::getImageFromPICTResource(Common::MacResManager *resFork, uint16 id } bool Surface::getImageFromPICTStream(Common::SeekableReadStream *stream) { - Graphics::PICTDecoder pict; + Image::PICTDecoder pict; if (!pict.loadStream(*stream)) return false; diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp index 85cc7cadaa..b2213f7fee 100644 --- a/engines/queen/display.cpp +++ b/engines/queen/display.cpp @@ -29,8 +29,9 @@ #include "graphics/cursorman.h" #include "graphics/palette.h" #include "graphics/surface.h" -#include "graphics/decoders/iff.h" -#include "graphics/decoders/pcx.h" + +#include "image/iff.h" +#include "image/pcx.h" #include "queen/display.h" #include "queen/input.h" @@ -813,7 +814,7 @@ void Display::fill(uint8 *dstBuf, uint16 dstPitch, uint16 x, uint16 y, uint16 w, void Display::decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd) { Common::MemoryReadStream str(src, srcSize); - ::Graphics::PCXDecoder pcx; + Image::PCXDecoder pcx; if (!pcx.loadStream(str)) error("Error while reading PCX image"); @@ -832,7 +833,7 @@ void Display::decodePCX(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dst void Display::decodeIFF(const uint8 *src, uint32 srcSize, uint8 *dst, uint16 dstPitch, uint16 *w, uint16 *h, uint8 *pal, uint16 palStart, uint16 palEnd, uint8 colorBase) { Common::MemoryReadStream str(src, srcSize); - ::Graphics::IFFDecoder iff; + Image::IFFDecoder iff; if (!iff.loadStream(str)) error("Error while reading IFF image"); diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index 5ca2f8d31a..7f77cbab38 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -43,7 +43,7 @@ #include "common/util.h" -#include "graphics/decoders/iff.h" +#include "image/iff.h" namespace Saga { @@ -463,7 +463,7 @@ void Scene::changeScene(int16 sceneNumber, int actorsEntrance, SceneTransitionTy _vm->_interface->setMode(kPanelSceneSubstitute); if (file.open(sceneSubstitutes[i].image)) { - Graphics::IFFDecoder decoder; + Image::IFFDecoder decoder; decoder.loadStream(file); pal = decoder.getPalette(); rect.setWidth(decoder.getSurface()->w); diff --git a/engines/sci/graphics/maciconbar.cpp b/engines/sci/graphics/maciconbar.cpp index db9843ffb3..8e2e12b7bd 100644 --- a/engines/sci/graphics/maciconbar.cpp +++ b/engines/sci/graphics/maciconbar.cpp @@ -32,7 +32,7 @@ #include "common/memstream.h" #include "common/system.h" #include "graphics/surface.h" -#include "graphics/decoders/pict.h" +#include "image/pict.h" namespace Sci { @@ -201,12 +201,12 @@ void GfxMacIconBar::setInventoryIcon(int16 icon) { } Graphics::Surface *GfxMacIconBar::loadPict(ResourceId id) { - Graphics::PICTDecoder pictDecoder; Resource *res = g_sci->getResMan()->findResource(id, false); if (!res || res->size == 0) return 0; + Image::PICTDecoder pictDecoder; Common::MemoryReadStream stream(res->data, res->size); if (!pictDecoder.loadStream(stream)) return 0; diff --git a/engines/sword25/gfx/image/imgloader.cpp b/engines/sword25/gfx/image/imgloader.cpp index 3212c8daee..b4b3030de8 100644 --- a/engines/sword25/gfx/image/imgloader.cpp +++ b/engines/sword25/gfx/image/imgloader.cpp @@ -33,14 +33,14 @@ #include "sword25/gfx/image/image.h" #include "sword25/gfx/image/imgloader.h" #include "graphics/pixelformat.h" -#include "graphics/decoders/png.h" +#include "image/png.h" namespace Sword25 { bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, byte *&uncompressedDataPtr, int &width, int &height, int &pitch) { Common::MemoryReadStream *fileStr = new Common::MemoryReadStream(fileDataPtr, fileSize, DisposeAfterUse::NO); - Graphics::PNGDecoder png; + ::Image::PNGDecoder png; if (!png.loadStream(*fileStr)) // the fileStr pointer, and thus pFileData will be deleted after this is done error("Error while reading PNG image"); diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 1c223c67d3..48ddefe455 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -30,7 +30,8 @@ #include "audio/decoders/wave.h" #include "graphics/surface.h" -#include "graphics/decoders/pcx.h" + +#include "image/pcx.h" #include "tucker/tucker.h" #include "tucker/graphics.h" @@ -302,7 +303,7 @@ void TuckerEngine::loadImage(const char *fname, uint8 *dst, int type) { } } - ::Graphics::PCXDecoder pcx; + Image::PCXDecoder pcx; if (!pcx.loadStream(f)) error("Error while reading PCX image"); diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 3b7026cb08..bea55fb857 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -38,8 +38,8 @@ #include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/graphics/transparent_surface.h" #include "engines/wintermute/wintermute.h" -#include "graphics/decoders/bmp.h" #include "graphics/scaler.h" +#include "image/bmp.h" #include "common/memstream.h" #include "common/str.h" #include "common/system.h" @@ -170,7 +170,7 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des if (thumbSize > 0) { Common::MemoryReadStream thumbStream(thumbData, thumbSize, DisposeAfterUse::NO); - Graphics::BitmapDecoder bmpDecoder; + Image::BitmapDecoder bmpDecoder; if (bmpDecoder.loadStream(thumbStream)) { const Graphics::Surface *bmpSurface = bmpDecoder.getSurface(); TransparentSurface *scaleableSurface = new TransparentSurface(*bmpSurface, false); diff --git a/engines/wintermute/base/gfx/base_image.cpp b/engines/wintermute/base/gfx/base_image.cpp index e5ec879fee..e676fafdbf 100644 --- a/engines/wintermute/base/gfx/base_image.cpp +++ b/engines/wintermute/base/gfx/base_image.cpp @@ -29,11 +29,11 @@ #include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/graphics/transparent_surface.h" -#include "graphics/decoders/png.h" -#include "graphics/decoders/jpeg.h" -#include "graphics/decoders/bmp.h" -#include "graphics/decoders/tga.h" #include "graphics/surface.h" +#include "image/png.h" +#include "image/jpeg.h" +#include "image/bmp.h" +#include "image/tga.h" #include "common/textconsole.h" #include "common/stream.h" #include "common/system.h" @@ -62,16 +62,14 @@ BaseImage::~BaseImage() { bool BaseImage::loadFile(const Common::String &filename) { _filename = filename; _filename.toLowercase(); - if (filename.hasPrefix("savegame:")) { - _decoder = new Graphics::BitmapDecoder(); + if (filename.hasPrefix("savegame:") || _filename.hasSuffix(".bmp")) { + _decoder = new Image::BitmapDecoder(); } else if (_filename.hasSuffix(".png")) { - _decoder = new Graphics::PNGDecoder(); - } else if (_filename.hasSuffix(".bmp")) { - _decoder = new Graphics::BitmapDecoder(); + _decoder = new Image::PNGDecoder(); } else if (_filename.hasSuffix(".tga")) { - _decoder = new Graphics::TGADecoder(); + _decoder = new Image::TGADecoder(); } else if (_filename.hasSuffix(".jpg")) { - _decoder = new Graphics::JPEGDecoder(); + _decoder = new Image::JPEGDecoder(); } else { error("BaseImage::loadFile : Unsupported fileformat %s", filename.c_str()); } diff --git a/engines/wintermute/base/gfx/base_image.h b/engines/wintermute/base/gfx/base_image.h index a7d6846345..56be9fc453 100644 --- a/engines/wintermute/base/gfx/base_image.h +++ b/engines/wintermute/base/gfx/base_image.h @@ -31,11 +31,14 @@ #include "graphics/surface.h" #include "graphics/pixelformat.h" -#include "graphics/decoders/image_decoder.h" #include "common/endian.h" #include "common/str.h" #include "common/stream.h" +namespace Image { +class ImageDecoder; +} + namespace Wintermute { class BaseSurface; class BaseFileManager; @@ -60,7 +63,7 @@ public: void copyFrom(const Graphics::Surface *surface); private: Common::String _filename; - Graphics::ImageDecoder *_decoder; + Image::ImageDecoder *_decoder; const Graphics::Surface *_surface; Graphics::Surface *_deletableSurface; const byte *_palette; diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index bb57d308c0..983f9c1296 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -32,10 +32,6 @@ #include "engines/wintermute/base/gfx/osystem/base_render_osystem.h" #include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/platform_osystem.h" -#include "graphics/decoders/png.h" -#include "graphics/decoders/bmp.h" -#include "graphics/decoders/jpeg.h" -#include "graphics/decoders/tga.h" #include "engines/wintermute/graphics/transparent_surface.h" #include "engines/wintermute/graphics/transform_tools.h" #include "graphics/pixelformat.h" diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp index 86e27aa30d..aed30ea12c 100644 --- a/engines/zvision/graphics/render_manager.cpp +++ b/engines/zvision/graphics/render_manager.cpp @@ -32,7 +32,7 @@ #include "engines/util.h" -#include "graphics/decoders/tga.h" +#include "image/tga.h" namespace ZVision { @@ -238,7 +238,7 @@ void RenderManager::readImageToSurface(const Common::String &fileName, Graphics: uint32 imageWidth; uint32 imageHeight; - Graphics::TGADecoder tga; + Image::TGADecoder tga; uint16 *buffer; bool isTransposed = _renderTable.getRenderState() == RenderTable::PANORAMA; // All ZVision images are in RGB 555 diff --git a/graphics/module.mk b/graphics/module.mk index 8b63435905..5918775240 100644 --- a/graphics/module.mk +++ b/graphics/module.mk @@ -21,14 +21,7 @@ MODULE_OBJS := \ VectorRenderer.o \ VectorRendererSpec.o \ wincursor.o \ - yuv_to_rgb.o \ - decoders/bmp.o \ - decoders/iff.o \ - decoders/jpeg.o \ - decoders/pcx.o \ - decoders/pict.o \ - decoders/png.o \ - decoders/tga.o + yuv_to_rgb.o ifdef USE_SCALERS MODULE_OBJS += \ diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 9fe482ddcc..9e54597dd4 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -34,7 +34,8 @@ #include "graphics/VectorRenderer.h" #include "graphics/fonts/bdf.h" #include "graphics/fonts/ttf.h" -#include "graphics/decoders/bmp.h" + +#include "image/bmp.h" #include "gui/widget.h" #include "gui/ThemeEngine.h" @@ -638,7 +639,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { return true; // If not, try to load the bitmap via the BitmapDecoder class. - Graphics::BitmapDecoder bitmapDecoder; + Image::BitmapDecoder bitmapDecoder; const Graphics::Surface *srcSurface = 0; Common::ArchiveMemberList members; _themeFiles.listMatchingMembers(members, filename); diff --git a/graphics/decoders/bmp.cpp b/image/bmp.cpp index 608c843cea..113e268956 100644 --- a/graphics/decoders/bmp.cpp +++ b/image/bmp.cpp @@ -20,14 +20,14 @@ * */ +#include "image/bmp.h" + #include "common/stream.h" #include "common/textconsole.h" - #include "graphics/pixelformat.h" #include "graphics/surface.h" -#include "graphics/decoders/bmp.h" -namespace Graphics { +namespace Image { BitmapDecoder::BitmapDecoder() { _surface = 0; @@ -180,4 +180,4 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) { return true; } -} // End of namespace Graphics +} // End of namespace Image diff --git a/graphics/decoders/bmp.h b/image/bmp.h index da11f04920..bc4cfc3edd 100644 --- a/graphics/decoders/bmp.h +++ b/image/bmp.h @@ -28,21 +28,22 @@ * - wintermute */ -#ifndef GRAPHICS_DECODERS_BMP_H -#define GRAPHICS_DECODERS_BMP_H +#ifndef IMAGE_BMP_H +#define IMAGE_BMP_H #include "common/scummsys.h" #include "common/str.h" -#include "graphics/decoders/image_decoder.h" +#include "image/image_decoder.h" -namespace Common{ +namespace Common { class SeekableReadStream; } namespace Graphics { - -struct PixelFormat; struct Surface; +} + +namespace Image { class BitmapDecoder : public ImageDecoder { public: @@ -52,16 +53,16 @@ public: // ImageDecoder API void destroy(); virtual bool loadStream(Common::SeekableReadStream &stream); - virtual const Surface *getSurface() const { return _surface; } + virtual const Graphics::Surface *getSurface() const { return _surface; } const byte *getPalette() const { return _palette; } uint16 getPaletteColorCount() const { return _paletteColorCount; } private: - Surface *_surface; + Graphics::Surface *_surface; byte *_palette; uint16 _paletteColorCount; }; -} // End of namespace Graphics +} // End of namespace Image #endif diff --git a/graphics/decoders/iff.cpp b/image/iff.cpp index c5fd46bf25..d93e9ff878 100644 --- a/graphics/decoders/iff.cpp +++ b/image/iff.cpp @@ -20,13 +20,13 @@ * */ +#include "image/iff.h" + #include "common/iff_container.h" #include "common/stream.h" #include "common/util.h" -#include "graphics/decoders/iff.h" - -namespace Graphics { +namespace Image { IFFDecoder::IFFDecoder() { _surface = 0; @@ -241,4 +241,4 @@ void IFFDecoder::packPixels(byte *scanlines, byte *data, const uint16 scanlinePi } } -} // End of namespace Graphics +} // End of namespace Image diff --git a/graphics/decoders/iff.h b/image/iff.h index eb8e0b98bc..3d342b3173 100644 --- a/graphics/decoders/iff.h +++ b/image/iff.h @@ -29,22 +29,24 @@ * - saga */ -#ifndef GRAPHICS_DECODERS_IFF_H -#define GRAPHICS_DECODERS_IFF_H +#ifndef IMAGE_IFF_H +#define IMAGE_IFF_H #include "common/array.h" #include "common/endian.h" - #include "graphics/surface.h" -#include "graphics/decoders/image_decoder.h" + +#include "image/image_decoder.h" namespace Common { class SeekableReadStream; } namespace Graphics { - struct Surface; +} + +namespace Image { class IFFDecoder : public ImageDecoder { public: @@ -78,7 +80,7 @@ public: void destroy(); bool loadStream(Common::SeekableReadStream &stream); const Header *getHeader() const { return &_header; } - const Surface *getSurface() const { return _surface; } + const Graphics::Surface *getSurface() const { return _surface; } const byte *getPalette() const { return _palette; } const Common::Array<PaletteRange> &getPaletteRanges() const { return _paletteRanges; } uint16 getPaletteColorCount() const { return _paletteColorCount; } @@ -104,7 +106,7 @@ public: private: Header _header; - Surface *_surface; + Graphics::Surface *_surface; byte *_palette; Common::Array<PaletteRange> _paletteRanges; Type _type; @@ -119,6 +121,6 @@ private: void packPixels(byte *scanlines, byte *data, const uint16 scanlinePitch, const uint16 outPitch); }; -} // End of namespace Graphics +} // End of namespace Image -#endif // GRAPHICS_DECODERS_IFF_H +#endif diff --git a/graphics/decoders/image_decoder.h b/image/image_decoder.h index cad3a1db06..08fa4d82b4 100644 --- a/graphics/decoders/image_decoder.h +++ b/image/image_decoder.h @@ -20,20 +20,21 @@ * */ -#ifndef GRAPHICS_DECODERS_IMAGEDECODER_H -#define GRAPHICS_DECODERS_IMAGEDECODER_H +#ifndef IMAGE_IMAGEDECODER_H +#define IMAGE_IMAGEDECODER_H #include "common/scummsys.h" #include "common/str.h" -namespace Common{ +namespace Common { class SeekableReadStream; } namespace Graphics { - -struct PixelFormat; struct Surface; +} + +namespace Image { /** * A representation of an image decoder that maintains ownership of the surface @@ -73,7 +74,7 @@ public: * * @return the decoded surface, or 0 if no surface is present */ - virtual const Surface *getSurface() const = 0; + virtual const Graphics::Surface *getSurface() const = 0; /** * Get the decoded palette @@ -100,6 +101,6 @@ public: virtual uint16 getPaletteColorCount() const { return 0; } }; -} // End of namespace Graphics +} // End of namespace Image #endif diff --git a/graphics/decoders/jpeg.cpp b/image/jpeg.cpp index aa62ff96b6..9d4b0a7cfe 100644 --- a/graphics/decoders/jpeg.cpp +++ b/image/jpeg.cpp @@ -24,13 +24,13 @@ // here. #define FORBIDDEN_SYMBOL_ALLOW_ALL -#include "graphics/pixelformat.h" -#include "graphics/decoders/jpeg.h" +#include "image/jpeg.h" #include "common/debug.h" #include "common/endian.h" #include "common/stream.h" #include "common/textconsole.h" +#include "graphics/pixelformat.h" #ifdef USE_JPEG // The original release of libjpeg v6b did not contain any extern "C" in case @@ -42,7 +42,7 @@ extern "C" { } #endif -namespace Graphics { +namespace Image { JPEGDecoder::JPEGDecoder() : ImageDecoder(), _surface(), _colorSpace(kColorSpaceRGBA) { } @@ -51,7 +51,7 @@ JPEGDecoder::~JPEGDecoder() { destroy(); } -const Surface *JPEGDecoder::getSurface() const { +const Graphics::Surface *JPEGDecoder::getSurface() const { return &_surface; } diff --git a/graphics/decoders/jpeg.h b/image/jpeg.h index 8fd03ca86b..f578170517 100644 --- a/graphics/decoders/jpeg.h +++ b/image/jpeg.h @@ -28,17 +28,17 @@ * - wintermute */ -#ifndef GRAPHICS_JPEG_H -#define GRAPHICS_JPEG_H +#ifndef IMAGE_JPEG_H +#define IMAGE_JPEG_H #include "graphics/surface.h" -#include "graphics/decoders/image_decoder.h" +#include "image/image_decoder.h" namespace Common { class SeekableReadStream; } -namespace Graphics { +namespace Image { class JPEGDecoder : public ImageDecoder { public: @@ -48,7 +48,7 @@ public: // ImageDecoder API virtual void destroy(); virtual bool loadStream(Common::SeekableReadStream &str); - virtual const Surface *getSurface() const; + virtual const Graphics::Surface *getSurface() const; // Special API for JPEG enum ColorSpace { diff --git a/image/module.mk b/image/module.mk new file mode 100644 index 0000000000..22febe1460 --- /dev/null +++ b/image/module.mk @@ -0,0 +1,13 @@ +MODULE := image + +MODULE_OBJS := \ + bmp.o \ + iff.o \ + jpeg.o \ + pcx.o \ + pict.o \ + png.o \ + tga.o + +# Include common rules +include $(srcdir)/rules.mk diff --git a/graphics/decoders/pcx.cpp b/image/pcx.cpp index bc82275d9e..282a6c68c7 100644 --- a/graphics/decoders/pcx.cpp +++ b/image/pcx.cpp @@ -20,12 +20,12 @@ * */ +#include "image/pcx.h" + #include "common/stream.h" #include "common/textconsole.h" - #include "graphics/pixelformat.h" #include "graphics/surface.h" -#include "graphics/decoders/pcx.h" /** * Based on the PCX specs: @@ -34,7 +34,7 @@ * http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/pcx.c */ -namespace Graphics { +namespace Image { PCXDecoder::PCXDecoder() { _surface = 0; @@ -211,4 +211,4 @@ void PCXDecoder::decodeRLE(Common::SeekableReadStream &stream, byte *dst, uint32 } } -} // End of namespace Graphics +} // End of namespace Image diff --git a/graphics/decoders/pcx.h b/image/pcx.h index 675ab505dc..ce30ab5eb2 100644 --- a/graphics/decoders/pcx.h +++ b/image/pcx.h @@ -28,21 +28,18 @@ * - tucker */ -#ifndef GRAPHICS_DECODERS_PCX_H -#define GRAPHICS_DECODERS_PCX_H +#ifndef IMAGE_PCX_H +#define IMAGE_PCX_H #include "common/scummsys.h" #include "common/str.h" -#include "graphics/decoders/image_decoder.h" +#include "image/image_decoder.h" namespace Common{ class SeekableReadStream; } -namespace Graphics { - -struct PixelFormat; -struct Surface; +namespace Image { class PCXDecoder : public ImageDecoder { public: @@ -52,18 +49,18 @@ public: // ImageDecoder API void destroy(); virtual bool loadStream(Common::SeekableReadStream &stream); - virtual const Surface *getSurface() const { return _surface; } + virtual const Graphics::Surface *getSurface() const { return _surface; } const byte *getPalette() const { return _palette; } uint16 getPaletteColorCount() const { return _paletteColorCount; } private: void decodeRLE(Common::SeekableReadStream &stream, byte *dst, uint32 bytesPerScanline, bool compressed); - Surface *_surface; + Graphics::Surface *_surface; byte *_palette; uint16 _paletteColorCount; }; -} // End of namespace Graphics +} // End of namespace Image #endif diff --git a/graphics/decoders/pict.cpp b/image/pict.cpp index 8849a83ca1..07e657f4b2 100644 --- a/graphics/decoders/pict.cpp +++ b/image/pict.cpp @@ -20,17 +20,17 @@ * */ +#include "image/jpeg.h" +#include "image/pict.h" + #include "common/debug.h" #include "common/endian.h" #include "common/stream.h" #include "common/substream.h" #include "common/textconsole.h" - #include "graphics/surface.h" -#include "graphics/decoders/jpeg.h" -#include "graphics/decoders/pict.h" -namespace Graphics { +namespace Image { // The PICT code is based off of the QuickDraw specs: // http://developer.apple.com/legacy/mac/library/documentation/mac/QuickDraw/QuickDraw-461.html @@ -363,12 +363,12 @@ void PICTDecoder::unpackBitsRect(Common::SeekableReadStream &stream, bool withPa switch (bytesPerPixel) { case 1: // Just copy to the image - _outputSurface->create(width, height, PixelFormat::createFormatCLUT8()); + _outputSurface->create(width, height, Graphics::PixelFormat::createFormatCLUT8()); memcpy(_outputSurface->getPixels(), buffer, _outputSurface->w * _outputSurface->h); break; case 2: // We have a 16-bit surface - _outputSurface->create(width, height, PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); + _outputSurface->create(width, height, Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0)); for (uint16 y = 0; y < _outputSurface->h; y++) for (uint16 x = 0; x < _outputSurface->w; x++) WRITE_UINT16(_outputSurface->getBasePtr(x, y), READ_UINT16(buffer + (y * _outputSurface->w + x) * 2)); @@ -577,4 +577,4 @@ void PICTDecoder::decodeCompressedQuickTime(Common::SeekableReadStream &stream) stream.seek(startPos + dataSize); } -} // End of namespace Graphics +} // End of namespace Image diff --git a/graphics/decoders/pict.h b/image/pict.h index 554b149153..77b450f4a2 100644 --- a/graphics/decoders/pict.h +++ b/image/pict.h @@ -28,23 +28,24 @@ * - sci */ -#ifndef GRAPHICS_PICT_H -#define GRAPHICS_PICT_H +#ifndef IMAGE_PICT_H +#define IMAGE_PICT_H #include "common/array.h" #include "common/rect.h" #include "common/scummsys.h" -#include "graphics/decoders/image_decoder.h" -#include "graphics/pixelformat.h" +#include "image/image_decoder.h" namespace Common { class SeekableReadStream; } namespace Graphics { - struct Surface; +} + +namespace Image { #define DECLARE_OPCODE(x) void x(Common::SeekableReadStream &stream) @@ -56,7 +57,7 @@ public: // ImageDecoder API bool loadStream(Common::SeekableReadStream &stream); void destroy(); - const Surface *getSurface() const { return _outputSurface; } + const Graphics::Surface *getSurface() const { return _outputSurface; } const byte *getPalette() const { return _palette; } uint16 getPaletteColorCount() const { return _paletteColorCount; } @@ -135,6 +136,6 @@ private: #undef DECLARE_OPCODE -} // End of namespace Graphics +} // End of namespace Image #endif diff --git a/graphics/decoders/png.cpp b/image/png.cpp index 2282ea22f4..158acfa8a5 100644 --- a/graphics/decoders/png.cpp +++ b/image/png.cpp @@ -29,14 +29,14 @@ #include <png.h> #endif -#include "graphics/decoders/png.h" +#include "image/png.h" #include "graphics/pixelformat.h" #include "graphics/surface.h" #include "common/stream.h" -namespace Graphics { +namespace Image { PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0), _stream(0) { } @@ -242,4 +242,4 @@ bool PNGDecoder::loadStream(Common::SeekableReadStream &stream) { #endif } -} // End of Graphics namespace +} // End of namespace Image diff --git a/graphics/decoders/png.h b/image/png.h index d47d362d30..c4532fd03b 100644 --- a/graphics/decoders/png.h +++ b/image/png.h @@ -28,21 +28,22 @@ * - libpng */ -#ifndef GRAPHICS_PNG_H -#define GRAPHICS_PNG_H +#ifndef IMAGE_PNG_H +#define IMAGE_PNG_H #include "common/scummsys.h" #include "common/textconsole.h" -#include "graphics/decoders/image_decoder.h" +#include "image/image_decoder.h" namespace Common { class SeekableReadStream; } namespace Graphics { - struct Surface; -struct PixelFormat; +} + +namespace Image { class PNGDecoder : public ImageDecoder { public: @@ -62,6 +63,6 @@ private: Graphics::Surface *_outputSurface; }; -} // End of namespace Graphics +} // End of namespace Image -#endif // GRAPHICS_PNG_H +#endif diff --git a/graphics/decoders/tga.cpp b/image/tga.cpp index a342d0aa26..e251f64677 100644 --- a/graphics/decoders/tga.cpp +++ b/image/tga.cpp @@ -24,14 +24,14 @@ * relicensed under GPLv2+ with permission from DrMcCoy and clone2727 */ +#include "image/tga.h" + #include "common/util.h" #include "common/stream.h" #include "common/textconsole.h" #include "common/error.h" -#include "graphics/decoders/tga.h" - -namespace Graphics { +namespace Image { TGADecoder::TGADecoder() { _colorMapSize = 0; @@ -139,29 +139,29 @@ bool TGADecoder::readHeader(Common::SeekableReadStream &tga, byte &imageType, by //int interleave = (imgDesc & 0xC); if (imageType == TYPE_CMAP || imageType == TYPE_RLE_CMAP) { if (pixelDepth == 8) { - _format = PixelFormat::createFormatCLUT8(); + _format = Graphics::PixelFormat::createFormatCLUT8(); } else { warning("Unsupported index-depth: %d", pixelDepth); return false; } } else if (imageType == TYPE_TRUECOLOR || imageType == TYPE_RLE_TRUECOLOR) { if (pixelDepth == 24) { - _format = PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0); + _format = Graphics::PixelFormat(3, 8, 8, 8, 0, 16, 8, 0, 0); } else if (pixelDepth == 32) { // HACK: According to the spec, attributeBits should determine the amount // of alpha-bits, however, as the game files that use this decoder seems // to ignore that fact, we force the amount to 8 for 32bpp files for now. - _format = PixelFormat(4, 8, 8, 8, /* attributeBits */ 8, 16, 8, 0, 24); + _format = Graphics::PixelFormat(4, 8, 8, 8, /* attributeBits */ 8, 16, 8, 0, 24); } else if (pixelDepth == 16 && imageType == TYPE_TRUECOLOR) { // 16bpp TGA is ARGB1555 - _format = PixelFormat(2, 5, 5, 5, attributeBits, 10, 5, 0, 15); + _format = Graphics::PixelFormat(2, 5, 5, 5, attributeBits, 10, 5, 0, 15); } else { warning("Unsupported pixel depth: %d, %d", imageType, pixelDepth); return false; } } else if (imageType == TYPE_BW || TYPE_RLE_BW) { if (pixelDepth == 8) { - _format = PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0); + _format = Graphics::PixelFormat(4, 8, 8, 8, 0, 16, 8, 0, 0); } else { warning("Unsupported pixel depth: %d, %d", imageType, pixelDepth); return false; @@ -187,7 +187,7 @@ bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, b byte r, g, b; if (_colorMapEntryLength == 32) { byte a; - PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24); + Graphics::PixelFormat format(4, 8, 8, 8, 0, 16, 8, 0, 24); uint32 color = tga.readUint32LE(); format.colorToARGB(color, a, r, g, b); } else if (_colorMapEntryLength == 24) { @@ -196,7 +196,7 @@ bool TGADecoder::readColorMap(Common::SeekableReadStream &tga, byte imageType, b b = tga.readByte(); } else if (_colorMapEntryLength == 16) { byte a; - PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15); + Graphics::PixelFormat format(2, 5, 5, 5, 0, 10, 5, 0, 15); uint16 color = tga.readUint16LE(); format.colorToARGB(color, a, r, g, b); } else { @@ -427,4 +427,4 @@ bool TGADecoder::readDataRLE(Common::SeekableReadStream &tga, byte imageType, by return true; } -} // End of namespace Graphics +} // End of namespace Image diff --git a/graphics/decoders/tga.h b/image/tga.h index a2949fb1e8..677c17834f 100644 --- a/graphics/decoders/tga.h +++ b/image/tga.h @@ -30,17 +30,17 @@ * - zvision */ -#ifndef GRAPHICS_DECODERS_TGA_H -#define GRAPHICS_DECODERS_TGA_H +#ifndef IMAGE_TGA_H +#define IMAGE_TGA_H #include "graphics/surface.h" -#include "graphics/decoders/image_decoder.h" +#include "image/image_decoder.h" namespace Common { class SeekableReadStream; } -namespace Graphics { +namespace Image { /** TarGa image-decoder * The following variations of TGA are supported: @@ -59,7 +59,7 @@ public: TGADecoder(); virtual ~TGADecoder(); virtual void destroy(); - virtual const Surface *getSurface() const { return &_surface; } + virtual const Graphics::Surface *getSurface() const { return &_surface; } virtual const byte *getPalette() const { return _colorMap; } virtual uint16 getPaletteColorCount() const { return _colorMapLength; } virtual bool loadStream(Common::SeekableReadStream &stream); @@ -85,8 +85,8 @@ private: // Origin may be at the top, or bottom bool _originTop; - PixelFormat _format; - Surface _surface; + Graphics::PixelFormat _format; + Graphics::Surface _surface; // Loading helpers bool readHeader(Common::SeekableReadStream &tga, byte &imageType, byte &pixelDepth); bool readData(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth); @@ -95,6 +95,6 @@ private: bool readColorMap(Common::SeekableReadStream &tga, byte imageType, byte pixelDepth); }; -} // End of namespace Graphics +} // End of namespace Image -#endif // GRAPHICS_DECODERS_TGA_H +#endif diff --git a/video/codecs/jpeg.cpp b/video/codecs/jpeg.cpp index a5d29ceead..77917f37a2 100644 --- a/video/codecs/jpeg.cpp +++ b/video/codecs/jpeg.cpp @@ -23,7 +23,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "graphics/surface.h" -#include "graphics/decoders/jpeg.h" +#include "image/jpeg.h" #include "video/codecs/jpeg.h" @@ -46,7 +46,7 @@ JPEGDecoder::~JPEGDecoder() { } const Graphics::Surface *JPEGDecoder::decodeImage(Common::SeekableReadStream *stream) { - Graphics::JPEGDecoder jpeg; + Image::JPEGDecoder jpeg; if (!jpeg.loadStream(*stream)) { warning("Failed to decode JPEG frame"); diff --git a/video/codecs/mjpeg.cpp b/video/codecs/mjpeg.cpp index 443a06ee5a..16fb4f369e 100644 --- a/video/codecs/mjpeg.cpp +++ b/video/codecs/mjpeg.cpp @@ -29,7 +29,7 @@ #include "common/system.h" #include "common/textconsole.h" #include "graphics/surface.h" -#include "graphics/decoders/jpeg.h" +#include "image/jpeg.h" #include "video/codecs/mjpeg.h" @@ -197,7 +197,7 @@ const Graphics::Surface *MJPEGDecoder::decodeImage(Common::SeekableReadStream *s stream->read(data + dataOffset, stream->size() - inputSkip); Common::MemoryReadStream convertedStream(data, outputSize, DisposeAfterUse::YES); - Graphics::JPEGDecoder jpeg; + Image::JPEGDecoder jpeg; if (!jpeg.loadStream(convertedStream)) { warning("Failed to decode MJPEG frame"); |