Uint8 pad1; /* dummy value, for padding */
Uint16 tcolor; /* transparent color */
Uint8 xAspect, /* pixel aspect ratio */
- yAspect;
+ yAspect;
Sint16 Lpage; /* width of the screen in pixels */
Sint16 Hpage; /* height of the screen in pixels */
} BMHD;
is_LBM = 1;
}
}
- SDL_RWseek(src, start, SEEK_SET);
+ SDL_RWseek(src, start, RW_SEEK_SET);
return( is_LBM );
}
SDL_Surface *Image;
Uint8 id[4], pbm, colormap[MAXCOLORS*3], *MiniBuf, *ptr, count, color, msk;
Uint32 size, bytesloaded, nbcolors;
- Uint32 i, j, bytesperline, nbplanes, plane, h;
+ Uint32 i, j, bytesperline, nbplanes, stencil, plane, h;
Uint32 remainingbytes;
Uint32 width;
BMHD bmhd;
if ( size & 1 ) ++size; /* padding ! */
size -= bytesloaded;
/* skip the remaining bytes of this chunk */
- if ( size ) SDL_RWseek( src, size, SEEK_CUR );
+ if ( size ) SDL_RWseek( src, size, RW_SEEK_CUR );
}
}
nbplanes = 1;
}
- if ( bmhd.mask & 1 ) ++nbplanes; /* There is a mask ( 'stencil' ) */
+ stencil = (bmhd.mask & 1); /* There is a mask ( 'stencil' ) */
/* Allocate memory for a temporary buffer ( used for
decompression/deinterleaving ) */
- if ( ( MiniBuf = (void *)malloc( bytesperline * nbplanes ) ) == NULL )
+ MiniBuf = (void *)malloc( bytesperline * (nbplanes + stencil) );
+ if ( MiniBuf == NULL )
{
error="no enough memory for temporary buffer";
goto done;
/* There is no palette in 24 bits ILBM file */
if ( nbcolors>0 && flagHAM==0 )
{
- int nbrcolorsfinal = 1 << nbplanes;
+ /* FIXME: Should this include the stencil? See comment below */
+ int nbrcolorsfinal = 1 << (nbplanes + stencil);
ptr = &colormap[0];
for ( i=0; i<nbcolors; i++ )
{
/* uncompress the datas of each planes */
- for ( plane=0; plane < nbplanes; plane++ )
+ for ( plane=0; plane < (nbplanes+stencil); plane++ )
{
ptr = MiniBuf + ( plane * bytesperline );
if ( ( count > remainingbytes ) || !SDL_RWread( src, &color, 1, 1 ) )
{
- error="error reading BODY chunk";
+ error="error reading BODY chunk";
goto done;
}
memset( ptr, color, count );
{
memset( ptr, 0, 8 );
- for ( plane=0; plane < nbplanes; plane++ )
+ for ( plane=0; plane < (nbplanes + stencil); plane++ )
{
color = *( MiniBuf + i + ( plane * bytesperline ) );
msk = 0x80;
if ( error )
{
- SDL_RWseek(src, start, SEEK_SET);
+ SDL_RWseek(src, start, RW_SEEK_SET);
if ( Image ) {
SDL_FreeSurface( Image );
Image = NULL;