diff options
author | Matthew Hoops | 2013-01-26 11:33:30 -0500 |
---|---|---|
committer | Matthew Hoops | 2013-01-26 11:56:13 -0500 |
commit | 6ae97cdfbe88fa34363aabc46847b0c9a32eefe5 (patch) | |
tree | 5be40623132efdfa56c190c533cadf658d715b1f /graphics | |
parent | 798b440256c12ba878f16fa3215b4812c46a90a5 (diff) | |
download | scummvm-rg350-6ae97cdfbe88fa34363aabc46847b0c9a32eefe5.tar.gz scummvm-rg350-6ae97cdfbe88fa34363aabc46847b0c9a32eefe5.tar.bz2 scummvm-rg350-6ae97cdfbe88fa34363aabc46847b0c9a32eefe5.zip |
GRAPHICS: Modify the JFIF version warning
v1.02 images should only differ with the thumbnail from v1.01, and should be handled correctly by our decoder.
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/decoders/jpeg.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/graphics/decoders/jpeg.cpp b/graphics/decoders/jpeg.cpp index 08bc1f7a3d..5e926e60a0 100644 --- a/graphics/decoders/jpeg.cpp +++ b/graphics/decoders/jpeg.cpp @@ -215,28 +215,34 @@ bool JPEGDecoder::loadStream(Common::SeekableReadStream &stream) { bool JPEGDecoder::readJFIF() { uint16 length = _stream->readUint16BE(); uint32 tag = _stream->readUint32BE(); + if (tag != MKTAG('J', 'F', 'I', 'F')) { warning("JPEGDecoder::readJFIF() tag mismatch"); return false; } + if (_stream->readByte() != 0) { // NULL warning("JPEGDecoder::readJFIF() NULL mismatch"); return false; } + byte majorVersion = _stream->readByte(); byte minorVersion = _stream->readByte(); - if (majorVersion != 1 || minorVersion != 1) - warning("JPEGDecoder::readJFIF() Non-v1.1 JPEGs may not be handled correctly"); + if (majorVersion != 1 || minorVersion > 2) + warning("JPEGDecoder::readJFIF(): v%d.%02d JPEGs may not be handled correctly", majorVersion, minorVersion); + /* byte densityUnits = */_stream->readByte(); /* uint16 xDensity = */_stream->readUint16BE(); /* uint16 yDensity = */_stream->readUint16BE(); byte thumbW = _stream->readByte(); byte thumbH = _stream->readByte(); + _stream->seek(thumbW * thumbH * 3, SEEK_CUR); // Ignore thumbnail if (length != (thumbW * thumbH * 3) + 16) { warning("JPEGDecoder::readJFIF() length mismatch"); return false; } + return true; } |