GRAPHICS: Use the DirectBits size instead of the overall PICT dimensions

Fixes some Myst ME images
This commit is contained in:
Matthew Hoops 2011-02-20 00:43:18 -05:00
parent f8df58f957
commit 098581b3b5
2 changed files with 7 additions and 4 deletions

View File

@ -95,10 +95,10 @@ Surface *PictDecoder::decodeImage(Common::SeekableReadStream *stream, byte *pale
} else if (opcode == 0x001E) { // DefHilite
// Ignore, Contains no Data
} else if (opcode == 0x0098) { // PackBitsRect
decodeDirectBitsRect(stream, _imageRect.width(), _imageRect.height(), true);
decodeDirectBitsRect(stream, true);
_isPaletted = true;
} else if (opcode == 0x009A) { // DirectBitsRect
decodeDirectBitsRect(stream, _imageRect.width(), _imageRect.height(), false);
decodeDirectBitsRect(stream, false);
} else if (opcode == 0x00A1) { // LongComment
stream->readUint16BE();
uint16 dataSize = stream->readUint16BE();
@ -162,7 +162,7 @@ struct DirectBitsRectData {
uint16 mode;
};
void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, uint16 width, uint16 height, bool hasPalette) {
void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, bool hasPalette) {
static const PixelFormat directBitsFormat16 = PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0);
// Clear the palette
@ -196,6 +196,9 @@ void PictDecoder::decodeDirectBitsRect(Common::SeekableReadStream *stream, uint1
directBitsData.dstRect.right = stream->readUint16BE();
directBitsData.mode = stream->readUint16BE();
uint16 width = directBitsData.srcRect.width();
uint16 height = directBitsData.srcRect.height();
byte bytesPerPixel = 0;
if (directBitsData.pixMap.pixelSize <= 8)

View File

@ -74,7 +74,7 @@ private:
bool _isPaletted;
Graphics::Surface *_outputSurface;
void decodeDirectBitsRect(Common::SeekableReadStream *stream, uint16 width, uint16 height, bool hasPalette);
void decodeDirectBitsRect(Common::SeekableReadStream *stream, bool hasPalette);
void decodeDirectBitsLine(byte *out, uint32 length, Common::SeekableReadStream *data, byte bitsPerPixel, byte bytesPerPixel);
void decodeCompressedQuickTime(Common::SeekableReadStream *stream);
void outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel);