fix warnings

This commit is contained in:
Glenn Maynard
2004-05-17 01:56:12 +00:00
parent 4e556629ba
commit 46724ba3a9
+11 -6
View File
@@ -134,6 +134,8 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
case PNG_COLOR_TYPE_RGB_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA:
type = RGBA; type = RGBA;
break; break;
default:
FAIL_M(ssprintf( "%i", color_type) );
} }
if( color_type == PNG_COLOR_TYPE_GRAY ) if( color_type == PNG_COLOR_TYPE_GRAY )
@@ -193,13 +195,16 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
break; break;
case RGBX: case RGBX:
case RGBA: case RGBA:
int r = SDL_SwapBE32( 0xFF000000 ); surf = SDL_CreateRGBSurfaceSane( SDL_SWSURFACE, width, height, 32,
int g = SDL_SwapBE32( 0x00FF0000 ); SDL_SwapBE32( 0xFF000000 ),
int b = SDL_SwapBE32( 0x0000FF00 ); SDL_SwapBE32( 0x00FF0000 ),
int a = SDL_SwapBE32( type == RGBA? 0x000000FF:0x00000000 ); SDL_SwapBE32( 0x0000FF00 ),
ASSERT( surf ); SDL_SwapBE32( type == RGBA? 0x000000FF:0x00000000 ) );
surf = SDL_CreateRGBSurfaceSane( SDL_SWSURFACE, width, height, 32, r, g, b, a ); break;
default:
FAIL_M(ssprintf( "%i", type) );
} }
ASSERT( surf );
/* alloca to prevent memleaks if libpng longjmps us */ /* alloca to prevent memleaks if libpng longjmps us */
png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height ); png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height );