Skip to content

Commit

Permalink
lbm: use correct variable to check color planes.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 24, 2018
1 parent 09ac957 commit 571c0d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions IMG_lbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
goto done;
}

if ( ( Image = SDL_CreateRGBSurface( SDL_SWSURFACE, width, bmhd.h, (bmhd.planes==24 || flagHAM==1)?24:8, 0, 0, 0, 0 ) ) == NULL )
if ( ( Image = SDL_CreateRGBSurface( SDL_SWSURFACE, width, bmhd.h, (nbplanes==24 || flagHAM==1)?24:8, 0, 0, 0, 0 ) ) == NULL )
goto done;

if ( bmhd.mask & 2 ) /* There is a transparent color */
Expand All @@ -272,7 +272,7 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
/* The 32 last colors are the same but divided by 2 */
/* Some Amiga pictures save 64 colors with 32 last wrong colors, */
/* they shouldn't !, and here we overwrite these 32 bad colors. */
if ( (nbcolors==32 || flagEHB ) && (1<<bmhd.planes)==64 )
if ( (nbcolors==32 || flagEHB ) && (1<<nbplanes)==64 )
{
nbcolors = 64;
ptr = &colormap[0];
Expand All @@ -286,8 +286,8 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )

/* If nbcolors < 2^nbplanes, repeat the colormap */
/* This happens when pictures have a stencil mask */
if ( nbrcolorsfinal > (1<<bmhd.planes) ) {
nbrcolorsfinal = (1<<bmhd.planes);
if ( nbrcolorsfinal > (1<<nbplanes) ) {
nbrcolorsfinal = (1<<nbplanes);
}
for ( i=nbcolors; i < (Uint32)nbrcolorsfinal; i++ )
{
Expand Down

0 comments on commit 571c0d7

Please sign in to comment.