diff options
author | Matthew Hoops | 2011-09-25 20:17:33 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-09-25 20:17:33 -0400 |
commit | 161b4c9f2ba245249c16401bb0b0099e01b2273f (patch) | |
tree | eb1b7b1f89f662cbaa51f7969d337302526c6328 | |
parent | 09051449851fea84f094c3a21809c2bc6313e209 (diff) | |
download | scummvm-rg350-161b4c9f2ba245249c16401bb0b0099e01b2273f.tar.gz scummvm-rg350-161b4c9f2ba245249c16401bb0b0099e01b2273f.tar.bz2 scummvm-rg350-161b4c9f2ba245249c16401bb0b0099e01b2273f.zip |
GRAPHICS: Properly parse the CompressQuickTime header
-rw-r--r-- | graphics/pict.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/graphics/pict.cpp b/graphics/pict.cpp index f768ecdf3e..718214cb22 100644 --- a/graphics/pict.cpp +++ b/graphics/pict.cpp @@ -453,13 +453,36 @@ void PictDecoder::outputPixelBuffer(byte *&out, byte value, byte bitsPerPixel) { // Compressed QuickTime details can be found here: // http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/B-Chapter/2TheImageCompression.html // http://developer.apple.com/legacy/mac/library/#documentation/QuickTime/Rm/CompressDecompress/ImageComprMgr/F-Chapter/6WorkingwiththeImage.html -// I'm just ignoring that because Myst ME uses none of that extra stuff. The offset is always the same. void PictDecoder::decodeCompressedQuickTime(Common::SeekableReadStream *stream) { + // First, read all the fields from the opcode uint32 dataSize = stream->readUint32BE(); uint32 startPos = stream->pos(); - Common::SeekableReadStream *jpegStream = new Common::SeekableSubReadStream(stream, stream->pos() + 156, stream->pos() + dataSize); + /* uint16 version = */ stream->readUint16BE(); + + uint32 matrix[3][3]; + for (uint32 i = 0; i < 3; i++) + for (uint32 j = 0; j < 3; j++) + matrix[i][j] = stream->readUint32BE(); + + uint32 matteSize = stream->readUint32BE(); + stream->skip(8); // matte rect + /* uint16 transferMode = */ stream->readUint16BE(); + stream->skip(8); // src rect + /* uint32 accuracy = */ stream->readUint32BE(); + uint32 maskSize = stream->readUint32BE(); + + stream->skip(matteSize + maskSize); + + // Now we've reached the image descriptor, so read the relevant data from that + uint32 idStart = stream->pos(); + uint32 idSize = stream->readUint32BE(); + stream->skip(40); + uint32 jpegSize = stream->readUint32BE(); + stream->skip(idSize - (stream->pos() - idStart)); + + Common::SeekableReadStream *jpegStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + jpegSize); if (!_jpeg->read(jpegStream)) error("PictDecoder::decodeCompressedQuickTime(): Could not decode JPEG data"); |