From 66e106e48a1a08ad238906a5f873861fc66463fe Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 12 Dec 2003 10:05:58 +0000 Subject: [PATCH] fix OGL screenshots (d3d still broken) --- stepmania/src/RageDisplay_OGL.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index e2deb3904b..573a3e8fb0 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -724,11 +724,25 @@ void RageDisplay_OGL::SaveScreenshot( CString sPath ) (char *)temp->pixels + pitch * y, (char *)image->pixels + pitch * (height-1-y), 3*width ); - - SDL_SaveBMP( temp, sPath ); - SDL_FreeSurface( image ); + + CString buf; + buf.reserve( 1024*1024 ); + + SDL_RWops *rw = OpenRWops( buf ); + SDL_SaveBMP_RW( temp, rw, false ); + SDL_FreeRW( rw ); + SDL_FreeSurface( temp ); + + RageFile out; + if( !out.Open( sPath, RageFile::WRITE ) ) + { + LOG->Trace("Couldn't write %s: %s", sPath.c_str(), out.GetError().c_str() ); + return; + } + + out.Write( buf ); } RageDisplay::VideoModeParams RageDisplay_OGL::GetVideoModeParams() const { return wind->GetVideoModeParams(); }