[Scummvm-git-logs] scummvm master -> cfdbe40a5b163f7106e5bf06f3d23bb24ad6ff4f
wjp
wjp at usecode.org
Fri Aug 26 22:27:10 CEST 2016
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cfdbe40a5b DIRECTOR: Clean up BITDDecoder compression check
Commit: cfdbe40a5b163f7106e5bf06f3d23bb24ad6ff4f
https://github.com/scummvm/scummvm/commit/cfdbe40a5b163f7106e5bf06f3d23bb24ad6ff4f
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-08-26T22:26:32+02:00
Commit Message:
DIRECTOR: Clean up BITDDecoder compression check
Changed paths:
engines/director/frame.cpp
engines/director/images.cpp
engines/director/images.h
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 0ede871..bca54ef 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 af35224..cd8223a 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 4c2bfc8..54e8245 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
More information about the Scummvm-git-logs
mailing list