IMAGE: Load BMPs with any v1-v5 header

This commit is contained in:
lb_ii 2021-07-03 21:56:28 +03:00 committed by Eugene Sandulenko
parent 236be25624
commit 75b8735b57
No known key found for this signature in database
GPG Key ID: 014D387312D34F08

View File

@ -78,8 +78,8 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
}
uint32 infoSize = stream.readUint32LE();
if (infoSize != 40 && infoSize != 108) {
warning("Only Windows v3 & v4 bitmaps are supported");
if (infoSize != 40 && infoSize != 52 && infoSize != 56 && infoSize != 108 && infoSize != 124) {
warning("Only Windows v1-v5 bitmaps are supported, unknown header: %d", infoSize);
return false;
}
@ -109,6 +109,8 @@ bool BitmapDecoder::loadStream(Common::SeekableReadStream &stream) {
_paletteColorCount = stream.readUint32LE();
/* uint32 colorsImportant = */ stream.readUint32LE();
stream.seek(infoSize - 40, SEEK_CUR);
if (bitsPerPixel == 4 || bitsPerPixel == 8) {
if (_paletteColorCount == 0)
_paletteColorCount = bitsPerPixel == 8 ? 256 : 16;