From 0eb68f6c97a7b0bba860bc7f6cbcfffeda9ef3ce Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 26 Dec 2012 00:52:30 +0000 Subject: GRAPHICS: Add support for ILBM files containing uncompressed data. Thanks to Tomaz^ for this patch. --- graphics/iff.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/iff.cpp b/graphics/iff.cpp index 4011126bd3..4a74b63693 100644 --- a/graphics/iff.cpp +++ b/graphics/iff.cpp @@ -64,6 +64,26 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre byte *out = buffer; switch (_header.pack) { + case 0: { // non-compressed bitmap + // setup a buffer to hold enough data to build a line in the output + uint32 scanlineWidth = ((_header.width + 15) / 16) << 1; + byte *scanline = new byte[scanlineWidth * _header.depth]; + + for (uint i = 0; i < _header.height; ++i) { + byte *s = scanline; + for (uint32 j = 0; j < _header.depth; ++j) { + stream->read(s, scanlineWidth); + s += scanlineWidth; + } + + planarToChunky(out, outPitch, scanline, scanlineWidth, numPlanes, packPixels); + out += outPitch; + } + + delete[] scanline; + break; + } + case 1: { // PackBits compressed bitmap Graphics::PackBitsReadStream packStream(*stream); @@ -88,7 +108,7 @@ void ILBMDecoder::loadBitmap(uint32 mode, byte *buffer, Common::ReadStream *stre default: // implement other compression types here! - error("only RLE compressed ILBM files are supported"); + error("only uncompressed and RLE compressed ILBM files are supported"); break; } } -- cgit v1.2.3