From a33e65a552d98dd5bfd7de2702344f38211c3a46 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 17 May 2004 02:38:01 +0000 Subject: [PATCH] cleanup --- stepmania/src/BannerCache.cpp | 3 ++- stepmania/src/RageBitmapTexture.cpp | 3 ++- stepmania/src/RageSurface_Load.cpp | 2 +- stepmania/src/RageSurface_Load.h | 8 +++++--- stepmania/src/RageSurface_Load_PNG.cpp | 1 - stepmania/src/SDL_utils.cpp | 10 ++-------- stepmania/src/SDL_utils.h | 2 -- stepmania/src/Song.cpp | 3 ++- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/stepmania/src/BannerCache.cpp b/stepmania/src/BannerCache.cpp index ef7a8a3974..c6957bfee2 100644 --- a/stepmania/src/BannerCache.cpp +++ b/stepmania/src/BannerCache.cpp @@ -10,6 +10,7 @@ #include "RageDisplay.h" #include "RageUtil.h" #include "RageLog.h" +#include "RageSurface_Load.h" #include "BannerCache.h" #include "Sprite.h" #include "PrefsManager.h" @@ -303,7 +304,7 @@ void BannerCache::CacheBanner( CString BannerPath ) void BannerCache::CacheBannerInternal( CString BannerPath ) { - SDL_Surface *img = SDL_LoadImage( BannerPath ); + SDL_Surface *img = RageSurface::LoadFile( BannerPath ); if( img == NULL ) { LOG->Warn( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), SDL_GetError() ); diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 5612cc70b7..350d059a7f 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -14,6 +14,7 @@ #include "SDL_rotozoom.h" #include "SDL_utils.h" #include "SDL_dither.h" +#include "RageSurface_Load.h" static void GetResolutionFromFileName( CString sPath, int &Width, int &Height ) { @@ -70,7 +71,7 @@ void RageBitmapTexture::Create() /* Create (and return) a surface ready to be loaded to OpenGL */ /* Load the image into an SDL surface. */ - SDL_Surface *img = SDL_LoadImage( actualID.filename ); + SDL_Surface *img = RageSurface::LoadFile( actualID.filename ); /* Tolerate corrupt/unknown images. */ if( img == NULL ) diff --git a/stepmania/src/RageSurface_Load.cpp b/stepmania/src/RageSurface_Load.cpp index 6e8632367e..6a96502937 100644 --- a/stepmania/src/RageSurface_Load.cpp +++ b/stepmania/src/RageSurface_Load.cpp @@ -4,7 +4,7 @@ #include "RageUtil.h" #include "SDL_image.h" -SDL_Surface *LoadSurface( const CString &sPath ) +SDL_Surface *RageSurface::LoadFile( const CString &sPath ) { const CString ext = GetExtension( sPath ); if( ext.CompareNoCase( "png" ) ) diff --git a/stepmania/src/RageSurface_Load.h b/stepmania/src/RageSurface_Load.h index 6f3a1337a5..682097bddd 100644 --- a/stepmania/src/RageSurface_Load.h +++ b/stepmania/src/RageSurface_Load.h @@ -1,9 +1,11 @@ #ifndef RAGE_SURFACE_LOAD_H #define RAGE_SURFACE_LOAD_H -#include "SDL_utils.h" - -SDL_Surface *LoadSurface( const CString &sPath ); +struct SDL_Surface; +namespace RageSurface +{ + SDL_Surface *LoadFile( const CString &sPath ); +} #endif diff --git a/stepmania/src/RageSurface_Load_PNG.cpp b/stepmania/src/RageSurface_Load_PNG.cpp index 569b1021ea..88532bfd09 100644 --- a/stepmania/src/RageSurface_Load_PNG.cpp +++ b/stepmania/src/RageSurface_Load_PNG.cpp @@ -162,7 +162,6 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro int num_palette; png_color *palette; int ret = png_get_PLTE( png, info_ptr, &palette, &num_palette ); - /* XXX: test with a paletted image that has had its palette deleted */ ASSERT( ret == PNG_INFO_PLTE ); png_byte *trans = NULL; diff --git a/stepmania/src/SDL_utils.cpp b/stepmania/src/SDL_utils.cpp index 59e2ff0258..5a62cafda8 100644 --- a/stepmania/src/SDL_utils.cpp +++ b/stepmania/src/SDL_utils.cpp @@ -11,6 +11,7 @@ #include "SDL_utils.h" #include "SDL_endian.h" #include "SDL_image.h" +#include "SDL_rotozoom.h" // for setting icon #include "RageSurface_Load.h" #include "RageFile.h" #include "RageLog.h" @@ -491,8 +492,6 @@ Uint8 mySDL_EventState( Uint8 type, int state ) return ret; } -#include "SDL_rotozoom.h" // for setting icon - void mySDL_WM_SetIcon( CString sIconFile ) { #if !defined(DARWIN) @@ -502,7 +501,7 @@ void mySDL_WM_SetIcon( CString sIconFile ) return; } - SDL_Surface *srf = SDL_LoadImage(sIconFile); + SDL_Surface *srf = RageSurface::LoadFile(sIconFile); if( srf == NULL ) return; @@ -1093,11 +1092,6 @@ SDL_RWops *OpenRWops( const CString &sPath, bool Write ) return rw; } -SDL_Surface *SDL_LoadImage( const CString &sPath ) -{ - return LoadSurface( sPath ); -} - struct RWString { CString *buf; diff --git a/stepmania/src/SDL_utils.h b/stepmania/src/SDL_utils.h index 0c6e0c2093..0b920f6a2a 100644 --- a/stepmania/src/SDL_utils.h +++ b/stepmania/src/SDL_utils.h @@ -82,8 +82,6 @@ void mySDL_FixupPalettedAlpha( SDL_Surface *img ); void mySDL_AddColorKey( SDL_Surface *img, Uint32 color ); void ApplyHotPinkColorKey( SDL_Surface *&img ); -SDL_Surface *SDL_LoadImage( const CString &sPath ); - SDL_RWops *OpenRWops( const CString &sPath, bool Write=false ); SDL_RWops *OpenRWops( CString &sBuf ); SDL_Surface *mySDL_MakeDummySurface( int height, int width ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index e1d891069a..ed2d1b1c07 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -18,6 +18,7 @@ #include "IniFile.h" #include "NoteData.h" #include "RageSoundReader_FileReader.h" +#include "RageSurface_Load.h" #include "RageException.h" #include "SongManager.h" #include "SongCacheIndex.h" @@ -683,7 +684,7 @@ void Song::TidyUpData() continue; // skip CString sPath = m_sSongDir + arrayImages[i]; - SDL_Surface *img = SDL_LoadImage( sPath ); + SDL_Surface *img = RageSurface::LoadFile( sPath ); if( !img ) { LOG->Trace("Couldn't load '%s': %s", sPath.c_str(), SDL_GetError());