Extended the IFF parser to handle 1 and 5 bits deep images.

svn-id: r39583
This commit is contained in:
Nicola Mettifogo 2009-03-21 14:58:36 +00:00
parent b55602180d
commit 9682ae5947
2 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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);