aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/frame.cpp12
-rw-r--r--engines/director/images.cpp9
-rw-r--r--engines/director/images.h3
3 files changed, 7 insertions, 17 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 0ede871da8..bca54efc02 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -545,17 +545,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
debugC(2, kDebugImages, "id: %d, w: %d, h: %d, flags: %x, some: %x, unk1: %d, unk2: %d",
imgId, w, h, bc->flags, bc->someFlaggyThing, bc->unk1, bc->unk2);
-
- int w1 = w;
- if (w % 16)
- w1 += 16 - w % 16;
-
- if (pic->size() * 8 == w1 * h) {
- debugC(3, kDebugImages, "Disabling compression for %d: %d x %d", imgId, w1, h);
- img = new BITDDecoder(w, h, false);
- } else {
- img = new BITDDecoder(w, h, true);
- }
+ img = new BITDDecoder(w, h);
} else {
img = new Image::BitmapDecoder();
}
diff --git a/engines/director/images.cpp b/engines/director/images.cpp
index af35224067..cd8223ae8e 100644
--- a/engines/director/images.cpp
+++ b/engines/director/images.cpp
@@ -104,9 +104,10 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
* BITD
****************************/
-BITDDecoder::BITDDecoder(int w, int h, bool comp) {
+BITDDecoder::BITDDecoder(int w, int h) {
_surface = new Graphics::Surface();
+ // We make the surface pitch a multiple of 16.
int pitch = w;
if (w % 16)
pitch += 16 - (w % 16);
@@ -121,8 +122,6 @@ BITDDecoder::BITDDecoder(int w, int h, bool comp) {
_palette[255 * 3 + 0] = _palette[255 * 3 + 1] = _palette[255 * 3 + 2] = 0xff;
_paletteColorCount = 2;
-
- _comp = comp;
}
BITDDecoder::~BITDDecoder() {
@@ -144,7 +143,9 @@ void BITDDecoder::loadPalette(Common::SeekableReadStream &stream) {
bool BITDDecoder::loadStream(Common::SeekableReadStream &stream) {
int x = 0, y = 0;
- if (!_comp) {
+ // If the stream has exactly the required number of bits for this image,
+ // we assume it is uncompressed.
+ if (stream.size() * 8 == _surface->pitch * _surface->h) {
debugC(3, kDebugImages, "Skipping compression");
for (y = 0; y < _surface->h; y++) {
for (x = 0; x < _surface->pitch; ) {
diff --git a/engines/director/images.h b/engines/director/images.h
index 4c2bfc85d3..54e824588f 100644
--- a/engines/director/images.h
+++ b/engines/director/images.h
@@ -64,7 +64,7 @@ private:
class BITDDecoder : public Image::ImageDecoder {
public:
- BITDDecoder(int w, int h, bool comp);
+ BITDDecoder(int w, int h);
virtual ~BITDDecoder();
// ImageDecoder API
@@ -79,7 +79,6 @@ private:
Graphics::Surface *_surface;
byte *_palette;
uint8 _paletteColorCount;
- bool _comp;
};
} // End of namespace Director