Skip to content

Commit

Permalink
Fixed bug 4461 - IMG_Load() refuses to load valid ILBM image files
Browse files Browse the repository at this point in the history
Holger Schemel

Summary: IMG_Load() only loads ILBM image files with 1, 4, 8 or 24 bit planes.

How to reproduce the problem: Trying to load a valid ILBM image file with 2, 3, 5 or 6 bit planes fails with error message "unsupported number of color planes".

Expected behaviour: IMG_Load() loads all valid ILBM image files with various number of bitplanes.

Observed behaviour: IMG_Load() only loads a small subset of valid ILBM files.

SDL2_image 2.0.3 and 2.0.4 cannot load ILBM images with a "usual" (and totally valid) number of bitplanes as used on the Amiga anymore, that is, ILBM files with up to 5 bitplanes (32 colors) or 6 bitplanes (64 colors; EHB mode).

The following commit introduced the problem: http://hg.libsdl.org/SDL_image/rev/97f7f01e0665

The commit message says ?lbm: Fail to load images with unsupported/bogus color depth?, and the patch (apparently arbitrarily) limits loading ILBM files to those with either 1, 4, 8 or 24 bitplanes, which prevents typical ILBM files from the Amiga from being loaded.

The attached minimal test program and test ILBM files (newly created on an Amiga with Deluxe Paint IV today) shows the problem. Just extract and type "make". (The test program only loads the ILBM files, but does not display them.)

This bug can easily be fixed by simply reverting the above commit.
  • Loading branch information
slouken committed Jun 10, 2019
1 parent 2b906c8 commit b0dcaf4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions IMG_lbm.c
Expand Up @@ -238,12 +238,6 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
nbplanes = 1;
}

if ((nbplanes != 1) && (nbplanes != 4) && (nbplanes != 8) && (nbplanes != 24))
{
error="unsupported number of color planes";
goto done;
}

stencil = (bmhd.mask & 1); /* There is a mask ( 'stencil' ) */

/* Allocate memory for a temporary buffer ( used for
Expand Down

0 comments on commit b0dcaf4

Please sign in to comment.