IMG_LoadTyped_RW for BMP

This commit is contained in:
Glenn Maynard
2004-05-18 06:29:43 +00:00
parent 823c8d3490
commit c32f60f7ce
+11 -6
View File
@@ -4,7 +4,6 @@
#include "RageSurface_Load_JPEG.h" #include "RageSurface_Load_JPEG.h"
#include "RageSurface_Load_GIF.h" #include "RageSurface_Load_GIF.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "SDL_image.h"
SDL_Surface *RageSurface::LoadFile( const CString &sPath ) SDL_Surface *RageSurface::LoadFile( const CString &sPath )
{ {
@@ -18,19 +17,25 @@ SDL_Surface *RageSurface::LoadFile( const CString &sPath )
ret = RageSurface_Load_GIF( sPath, error ); ret = RageSurface_Load_GIF( sPath, error );
else if( !ext.CompareNoCase("jpg") ) else if( !ext.CompareNoCase("jpg") )
ret = RageSurface_Load_JPEG( sPath, error ); ret = RageSurface_Load_JPEG( sPath, error );
else else if( !ext.CompareNoCase("bmp") )
{ {
SDL_RWops *rw = OpenRWops( sPath ); SDL_RWops *rw = OpenRWops( sPath, false );
if( rw == NULL ) if( rw == NULL )
{
/* XXX */
SDL_SetError( "fail" );
return NULL; return NULL;
}
SDL_Surface *ret = IMG_LoadTyped_RW( rw, false, (char *) GetExtension(sPath).c_str() ); ret = SDL_LoadBMP_RW( rw, false );
SDL_RWclose( rw ); SDL_RWclose( rw );
SDL_FreeRW( rw ); SDL_FreeRW( rw );
mySDL_FixupPalettedAlpha( ret ); mySDL_FixupPalettedAlpha( ret );
}
return ret; else
{
error = ssprintf( "Unsupported file type \"%s\"", ext.c_str() );
} }
if( ret == NULL ) if( ret == NULL )