From 9682ae59479f713b1d870d9bb46eacf98255a97f Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sat, 21 Mar 2009 14:58:36 +0000 Subject: Extended the IFF parser to handle 1 and 5 bits deep images. svn-id: r39583 --- engines/parallaction/iff.cpp | 7 +++++-- engines/parallaction/iff.h | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/iff.cpp b/engines/parallaction/iff.cpp index 6812fc567e..c48b12f888 100644 --- a/engines/parallaction/iff.cpp +++ b/engines/parallaction/iff.cpp @@ -161,10 +161,10 @@ byte *ILBMDecoder::getPalette() { byte *ILBMDecoder::getBitmap(uint32 numPlanes, bool packPlanes) { assert(_bodySize != (uint32)-1); - assert(numPlanes == 2 || numPlanes == 4 || numPlanes == 8); + assert(numPlanes == 1 || numPlanes == 2 || numPlanes == 4 || numPlanes == 5 || numPlanes == 8); numPlanes = MIN(numPlanes, (uint32)_header.depth); - if (numPlanes == 8) { + if (numPlanes > 4) { packPlanes = false; } @@ -246,6 +246,9 @@ void ILBMDecoder::planarToChunky(byte *out, uint32 width, byte *in, uint32 plane if (!packPlanes) { out[x] = pix; } else + if (nPlanes == 1) { + out[x/8] |= (pix << (x & 7)); + } else if (nPlanes == 2) { out[x/4] |= (pix << ((x & 3) << 1)); } else diff --git a/engines/parallaction/iff.h b/engines/parallaction/iff.h index 23b8fbe1d7..6edd28a17f 100644 --- a/engines/parallaction/iff.h +++ b/engines/parallaction/iff.h @@ -64,14 +64,17 @@ private: class ILBMDecoder { Common::SeekableReadStream *_in; - IFFParser _parser; + bool _disposeStream; + + void planarToChunky(byte *out, uint32 width, byte *in, uint32 planeWidth, uint32 nPlanes, bool packPlanes); + +protected: + IFFParser _parser; Graphics::BMHD _header; bool _hasHeader; uint32 _bodySize; uint32 _paletteSize; - bool _disposeStream; - void planarToChunky(byte *out, uint32 width, byte *in, uint32 planeWidth, uint32 nPlanes, bool packPlanes); public: ILBMDecoder(Common::SeekableReadStream *input, bool disposeStream = false); -- cgit v1.2.3