From c32f60f7cef5efb20b81e08eabd9bcb489b60a25 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 18 May 2004 06:29:43 +0000 Subject: [PATCH] IMG_LoadTyped_RW for BMP --- stepmania/src/RageSurface_Load.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/stepmania/src/RageSurface_Load.cpp b/stepmania/src/RageSurface_Load.cpp index 3814214c27..e433427d51 100644 --- a/stepmania/src/RageSurface_Load.cpp +++ b/stepmania/src/RageSurface_Load.cpp @@ -4,7 +4,6 @@ #include "RageSurface_Load_JPEG.h" #include "RageSurface_Load_GIF.h" #include "RageUtil.h" -#include "SDL_image.h" SDL_Surface *RageSurface::LoadFile( const CString &sPath ) { @@ -18,19 +17,25 @@ SDL_Surface *RageSurface::LoadFile( const CString &sPath ) ret = RageSurface_Load_GIF( sPath, error ); else if( !ext.CompareNoCase("jpg") ) 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 ) + { + /* XXX */ + SDL_SetError( "fail" ); 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_FreeRW( rw ); mySDL_FixupPalettedAlpha( ret ); - - return ret; + } + else + { + error = ssprintf( "Unsupported file type \"%s\"", ext.c_str() ); } if( ret == NULL )