diff options
author | Eugene Sandulenko | 2016-05-18 09:53:32 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 1a3d44edc9b97c97b4ff9dc80747703a952f2409 (patch) | |
tree | 3e1e189c9e5a09be4379e6cce6b89731891a2974 /engines/director/dib.cpp | |
parent | c2414ae3815e92b768f194c8e353405e6b532919 (diff) | |
download | scummvm-rg350-1a3d44edc9b97c97b4ff9dc80747703a952f2409.tar.gz scummvm-rg350-1a3d44edc9b97c97b4ff9dc80747703a952f2409.tar.bz2 scummvm-rg350-1a3d44edc9b97c97b4ff9dc80747703a952f2409.zip |
DIRECTOR: Fix image loading, moved displaying to the engine
Diffstat (limited to 'engines/director/dib.cpp')
-rw-r--r-- | engines/director/dib.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp index 30c32349a6..a8fc7548a2 100644 --- a/engines/director/dib.cpp +++ b/engines/director/dib.cpp @@ -27,13 +27,13 @@ #include "common/textconsole.h" #include "graphics/pixelformat.h" #include "graphics/surface.h" - #include "graphics/palette.h" +#include "graphics/palette.h" #include "image/codecs/codec.h" #include "common/util.h" #include "common/debug.h" #include "image/codecs/bmp_raw.h" #include "common/system.h" -#include "common/events.h" + namespace Director { DIBDecoder::DIBDecoder() { @@ -78,7 +78,7 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) { while (index < 768) { _palette[index++] = 0; } -} +} bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) { @@ -87,36 +87,37 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) { Common::hexdump(buf, stream.size()); stream.seek(0); - if (stream.readByte() != 40) - return false; - if (stream.readByte() != 0) + uint32 headerSize = stream.readUint32LE(); + if (headerSize != 40) return false; - stream.seek(4); - uint16 width = stream.readUint32LE(); - uint16 height = stream.readUint32LE(); - stream.seek(32); - _paletteColorCount = stream.readByte() + (stream.readByte() << 8); + uint32 width = stream.readUint32LE(); + uint32 height = stream.readUint32LE(); + stream.readUint16LE(); // planes + uint16 bitsPerPixel = stream.readUint16LE(); + uint32 compression = stream.readUint32LE(); + uint32 imageSize = stream.readUint32LE(); + /* uint32 pixelsPerMeterX = */ stream.readUint32LE(); + /* uint32 pixelsPerMeterY = */ stream.readUint32LE(); + _paletteColorCount = stream.readUint32LE(); + /* uint32 colorsImportant = */ stream.readUint32LE(); + _paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount; - uint16 totalsize = 14 + stream.size() + 1024; + uint16 imageRawSize = stream.size() - 40; Common::SeekableSubReadStream subStream(&stream, 40, imageRawSize); - _codec = new Image::BitmapRawDecoder(width, height, 4); + warning("w: %d h: %d bpp: %d pal: %d size: %d (size rep: %d) comp: %x", width, height, bitsPerPixel, _paletteColorCount, imageRawSize, imageSize, compression); + + _codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel); + if (!_codec) + return false; _surface = _codec->decodeFrame(subStream); //FIXME g_system->getPaletteManager()->setPalette(_palette, 0, _paletteColorCount - 1); - g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 100, 100, 24, 24); - g_system->updateScreen(); + g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, width, height); - int stop = 0; - - while (stop < 100) { - g_system->delayMillis(50); - g_system->updateScreen(); - stop++; - } return true; } |