mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 07:45:07 +00:00
LibGfx: Disallow RLE8 compression for 16bpp BMPs
Also, disallow similar silly combinations. Technically, we support *more* than the definition seems to require. For future reference: https://archive.org/details/mac_Graphics_File_Formats_Second_Edition_1996/page/n607/mode/2up Book page 580 (pdf page 608)
This commit is contained in:
parent
e3e2eecc33
commit
bd6d365166
1 changed files with 21 additions and 1 deletions
|
@ -401,8 +401,28 @@ static bool check_for_invalid_bitmask_combinations(BMPLoadingContext& context)
|
|||
return false;
|
||||
break;
|
||||
case DIBType::Info:
|
||||
if ((compression == Compression::BITFIELDS || compression == Compression::ALPHABITFIELDS) && bpp != 16 && bpp != 32)
|
||||
switch (compression) {
|
||||
case Compression::BITFIELDS:
|
||||
case Compression::ALPHABITFIELDS:
|
||||
if (bpp != 16 && bpp != 32)
|
||||
return false;
|
||||
break;
|
||||
case Compression::RGB:
|
||||
break;
|
||||
case Compression::RLE8:
|
||||
if (bpp > 8)
|
||||
return false;
|
||||
break;
|
||||
case Compression::RLE4:
|
||||
// TODO: This is a guess
|
||||
if (bpp > 4)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
// Other compressions are not officially supported.
|
||||
// Technically, we could even drop ALPHABITFIELDS.
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DIBType::OSV2Short:
|
||||
case DIBType::OSV2:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue