From: Tim Goya Date: Fri, 17 Aug 2007 00:21:35 +0000 (+0000) Subject: SDL: remove pointless refcount acrobatics on video surface when taking screenshot X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=1a7d91fb1b3bc3520f04976fed1029bba1542ac6;p=supertux.git SDL: remove pointless refcount acrobatics on video surface when taking screenshot SVN-Revision: 5142 --- diff --git a/src/video/sdl_renderer.cpp b/src/video/sdl_renderer.cpp index f4bae6377..25fa832e5 100644 --- a/src/video/sdl_renderer.cpp +++ b/src/video/sdl_renderer.cpp @@ -271,9 +271,7 @@ namespace SDL { // [Christoph] TODO: Yes, this method also takes care of the actual disk I/O. Split it? - SDL_Surface *shot_surf; - shot_surf = SDL_GetVideoSurface(); - shot_surf->refcount++; + SDL_Surface *screen = SDL_GetVideoSurface(); // save screenshot static const std::string writeDir = PHYSFS_getWriteDir(); @@ -289,14 +287,12 @@ namespace SDL std::string fileName = oss.str(); fullFilename = writeDir + dirSep + fileName; if (!PHYSFS_exists(fileName.c_str())) { - SDL_SaveBMP(shot_surf, fullFilename.c_str()); + SDL_SaveBMP(screen, fullFilename.c_str()); log_debug << "Wrote screenshot to \"" << fullFilename << "\"" << std::endl; - SDL_FreeSurface(shot_surf); return; } } log_warning << "Did not save screenshot, because all files up to \"" << fullFilename << "\" already existed" << std::endl; - SDL_FreeSurface(shot_surf); } void