DIRECTOR: Stub for 1bpp bitmap decoder

This commit is contained in:
Eugene Sandulenko 2016-08-21 11:04:18 +02:00
parent fdd2c5fb60
commit 79995f6222
5 changed files with 76 additions and 14 deletions

View File

@ -40,7 +40,7 @@
#include "graphics/macgui/macwindowmanager.h"
#include "director/director.h"
#include "director/dib.h"
#include "director/images.h"
#include "director/resource.h"
#include "director/score.h"
#include "director/lingo/lingo.h"

View File

@ -20,8 +20,6 @@
*
*/
#include "director/dib.h"
#include "common/stream.h"
#include "common/substream.h"
#include "common/textconsole.h"
@ -34,6 +32,8 @@
#include "image/codecs/bmp_raw.h"
#include "common/system.h"
#include "director/images.h"
namespace Director {
DIBDecoder::DIBDecoder() {
@ -108,4 +108,43 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
return true;
}
BITDDecoder::BITDDecoder() {
_surface = 0;
_palette = 0;
_paletteColorCount = 0;
_codec = 0;
}
BITDDecoder::~BITDDecoder() {
destroy();
}
void BITDDecoder::destroy() {
_surface = 0;
delete[] _palette;
_palette = 0;
_paletteColorCount = 0;
delete _codec;
_codec = 0;
}
void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
_palette = new byte[2 * 3];
_palette[0] = _palette[1] = _palette[2] = 0;
_palette[3] = _palette[4] = _palette[5] = 0xff;
}
bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
uint32 width = 512; // Should come from the Cast
uint32 height = 342;
_surface = new Graphics::Surface();
_surface->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
return true;
}
} // End of namespace Director

View File

@ -20,8 +20,8 @@
*
*/
#ifndef DIRECTOR_DIB_H
#define DIRECTOR_DIB_H
#ifndef DIRECTOR_IMAGES_H
#define DIRECTOR_IMAGES_H
#include "common/scummsys.h"
#include "common/str.h"
@ -62,6 +62,26 @@ private:
uint8 _paletteColorCount;
};
class BITDDecoder : public Image::ImageDecoder {
public:
BITDDecoder();
virtual ~BITDDecoder();
// ImageDecoder API
void destroy();
virtual bool loadStream(Common::SeekableReadStream &stream);
virtual const Graphics::Surface *getSurface() const { return _surface; }
const byte *getPalette() const { return _palette; }
void loadPalette(Common::SeekableReadStream &stream);
uint16 getPaletteColorCount() const { return _paletteColorCount; }
private:
Image::Codec *_codec;
Graphics::Surface *_surface;
byte *_palette;
uint8 _paletteColorCount;
};
} // End of namespace Director
#endif

View File

@ -2,8 +2,8 @@ MODULE := engines/director
MODULE_OBJS = \
detection.o \
dib.o \
director.o \
images.o \
movie.o \
resource.o \
score.o \

View File

@ -20,7 +20,6 @@
*
*/
#include "director/score.h"
#include "common/stream.h"
#include "common/debug.h"
#include "common/file.h"
@ -28,12 +27,6 @@
#include "common/config-manager.h"
#include "common/unzip.h"
#include "common/system.h"
#include "director/dib.h"
#include "director/resource.h"
#include "director/lingo/lingo.h"
#include "director/sound.h"
#include "graphics/palette.h"
#include "common/events.h"
#include "engines/util.h"
@ -43,6 +36,12 @@
#include "graphics/fontman.h"
#include "graphics/fonts/bdf.h"
#include "director/score.h"
#include "director/images.h"
#include "director/resource.h"
#include "director/lingo/lingo.h"
#include "director/sound.h"
namespace Director {
static byte defaultPalette[768] = {
@ -1339,7 +1338,11 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
}
if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
img = new Image::BitmapDecoder();
if (_vm->getVersion() < 4) {
img = new BITDDecoder();
} else {
img = new Image::BitmapDecoder();
}
if (debugChannelSet(8, kDebugLoading)) {
Common::SeekableReadStream *s = _vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId);