diff options
author | Nicola Mettifogo | 2009-03-21 14:58:36 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-03-21 14:58:36 +0000 |
commit | 9682ae59479f713b1d870d9bb46eacf98255a97f (patch) | |
tree | ca6fdf082c26c4ff825e508fd3a836aa96519d32 | |
parent | b55602180decd888084797a7e7a8fb8778d6c7ee (diff) | |
download | scummvm-rg350-9682ae59479f713b1d870d9bb46eacf98255a97f.tar.gz scummvm-rg350-9682ae59479f713b1d870d9bb46eacf98255a97f.tar.bz2 scummvm-rg350-9682ae59479f713b1d870d9bb46eacf98255a97f.zip |
Extended the IFF parser to handle 1 and 5 bits deep images.
svn-id: r39583
-rw-r--r-- | engines/parallaction/iff.cpp | 7 | ||||
-rw-r--r-- | engines/parallaction/iff.h | 9 |
2 files changed, 11 insertions, 5 deletions
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); |