From d9f0e5819b63f9b9a5fbe2cf231ecb6ffe2ce915 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 23 Mar 2004 22:35:30 +0000 Subject: [PATCH] save lower quality jpeg to memcards --- stepmania/src/RageDisplay.cpp | 8 +++++--- stepmania/src/RageDisplay.h | 7 ++++++- stepmania/src/StepMania.cpp | 12 +++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 749ce382d1..37e14b74cc 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -649,11 +649,13 @@ bool RageDisplay::SaveScreenshot( CString sPath, GraphicsFileFormat format ) switch( format ) { - case bmp: + case SAVE_LOSSLESS: SDL_SaveBMP_RW( surface, rw, false ); break; - case jpg: - IMG_SaveJPG_RW( surface, rw ); + case SAVE_LOSSY_LOW_QUAL: + IMG_SaveJPG_RW( surface, rw, false ); + case SAVE_LOSSY_HIGH_QUAL: + IMG_SaveJPG_RW( surface, rw, true ); break; default: ASSERT(0); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index ca186b6f03..155994f37a 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -210,7 +210,12 @@ public: void DrawCircle( const RageSpriteVertex &v, float radius ); - enum GraphicsFileFormat{ bmp, jpg }; + enum GraphicsFileFormat + { + SAVE_LOSSLESS, // bmp + SAVE_LOSSY_LOW_QUAL, // jpg + SAVE_LOSSY_HIGH_QUAL // jpg + }; bool SaveScreenshot( CString sPath, GraphicsFileFormat format ); virtual CString GetTextureDiagnostics( unsigned id ) const { return ""; } diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 1478e331f7..24253d47e5 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1131,9 +1131,19 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature, // // Save the screenshot // + /* If writing lossy to a memcard, use SAVE_LOSSY_LOW_QUAL, so we don't eat up + * lots of space with screenshots. */ + RageDisplay::GraphicsFileFormat fmt; + if( bSaveCompressed && MEMCARDMAN->PathIsMemCard(sDir) ) + fmt = RageDisplay::SAVE_LOSSY_LOW_QUAL; + else if( bSaveCompressed ) + fmt = RageDisplay::SAVE_LOSSY_HIGH_QUAL; + else + fmt = RageDisplay::SAVE_LOSSLESS; + CString sFileName = ssprintf( "screen%05d.%s",iIndex,bSaveCompressed ? "jpg" : "bmp" ); CString sPath = sDir+sFileName; - bool bResult = DISPLAY->SaveScreenshot( sPath, bSaveCompressed ? RageDisplay::jpg : RageDisplay::bmp ); + bool bResult = DISPLAY->SaveScreenshot( sPath, fmt ); if( !bResult ) { SOUND->PlayOnce( THEME->GetPathToS("Common invalid") );