lbm: use correct variable to check color planes.
authorRyan C. Gordon
Wed, 24 Jan 2018 01:44:36 -0500
changeset 55516772bbb1b09
parent 554 3e1ebbbaba54
child 556 97f7f01e0665
lbm: use correct variable to check color planes.
IMG_lbm.c
     1.1 --- a/IMG_lbm.c	Wed Jan 24 01:43:46 2018 -0500
     1.2 +++ b/IMG_lbm.c	Wed Jan 24 01:44:36 2018 -0500
     1.3 @@ -245,7 +245,7 @@
     1.4          goto done;
     1.5      }
     1.6  
     1.7 -    if ( ( Image = SDL_CreateRGBSurface( SDL_SWSURFACE, width, bmhd.h, (bmhd.planes==24 || flagHAM==1)?24:8, 0, 0, 0, 0 ) ) == NULL )
     1.8 +    if ( ( Image = SDL_CreateRGBSurface( SDL_SWSURFACE, width, bmhd.h, (nbplanes==24 || flagHAM==1)?24:8, 0, 0, 0, 0 ) ) == NULL )
     1.9         goto done;
    1.10  
    1.11      if ( bmhd.mask & 2 )               /* There is a transparent color */
    1.12 @@ -272,7 +272,7 @@
    1.13          /* The 32 last colors are the same but divided by 2 */
    1.14          /* Some Amiga pictures save 64 colors with 32 last wrong colors, */
    1.15          /* they shouldn't !, and here we overwrite these 32 bad colors. */
    1.16 -        if ( (nbcolors==32 || flagEHB ) && (1<<bmhd.planes)==64 )
    1.17 +        if ( (nbcolors==32 || flagEHB ) && (1<<nbplanes)==64 )
    1.18          {
    1.19              nbcolors = 64;
    1.20              ptr = &colormap[0];
    1.21 @@ -286,8 +286,8 @@
    1.22  
    1.23          /* If nbcolors < 2^nbplanes, repeat the colormap */
    1.24          /* This happens when pictures have a stencil mask */
    1.25 -        if ( nbrcolorsfinal > (1<<bmhd.planes) ) {
    1.26 -            nbrcolorsfinal = (1<<bmhd.planes);
    1.27 +        if ( nbrcolorsfinal > (1<<nbplanes) ) {
    1.28 +            nbrcolorsfinal = (1<<nbplanes);
    1.29          }
    1.30          for ( i=nbcolors; i < (Uint32)nbrcolorsfinal; i++ )
    1.31          {