simplify OpenRWops

This commit is contained in:
Glenn Maynard
2004-05-18 19:25:53 +00:00
parent abcbddcaa3
commit 2f8e09ce7d
3 changed files with 9 additions and 11 deletions
+6 -6
View File
@@ -633,25 +633,25 @@ bool RageDisplay::SaveScreenshot( CString sPath, GraphicsFileFormat format )
CString buf;
buf.reserve( 1024*1024 );
SDL_RWops *rw = OpenRWops( buf );
SDL_RWops rw;
OpenRWops( &rw, &buf );
switch( format )
{
case SAVE_LOSSLESS:
SDL_SaveBMP_RW( surface, rw, false );
SDL_SaveBMP_RW( surface, &rw, false );
break;
case SAVE_LOSSY_LOW_QUAL:
IMG_SaveJPG_RW( surface, rw, false );
IMG_SaveJPG_RW( surface, &rw, false );
case SAVE_LOSSY_HIGH_QUAL:
IMG_SaveJPG_RW( surface, rw, true );
IMG_SaveJPG_RW( surface, &rw, true );
break;
default:
ASSERT(0);
return false;
}
SDL_RWclose( rw );
SDL_FreeRW( rw );
SDL_RWclose( &rw );
SDL_FreeSurface( surface );
surface = NULL;
+2 -4
View File
@@ -1086,15 +1086,13 @@ int RWString_Close(struct SDL_RWops *context)
return 0;
}
SDL_RWops *OpenRWops( CString &sBuf )
void OpenRWops( SDL_RWops *rw, CString *sBuf )
{
SDL_RWops *rw = SDL_AllocRW();
rw->hidden.unknown.data1 = new RWString( &sBuf );
rw->hidden.unknown.data1 = new RWString( sBuf );
rw->seek = RWString_Seek;
rw->read = RWString_Read;
rw->write = RWString_Write;
rw->close = RWString_Close;
return rw;
}
SDL_Surface *mySDL_MakeDummySurface( int height, int width )
+1 -1
View File
@@ -86,7 +86,7 @@ void ApplyHotPinkColorKey( SDL_Surface *&img );
class RageFile;
void OpenRWops( SDL_RWops *rw, RageFile *f );
SDL_RWops *OpenRWops( CString &sBuf );
void OpenRWops( SDL_RWops *rw, CString *sBuf );
SDL_Surface *mySDL_MakeDummySurface( int height, int width );
CString mySDL_GetError();