X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Fsdl_surface_ptr.hpp;h=ac1c126a254c7710fdb39f68d3cacb92a2c40b21;hb=HEAD;hp=2fffc95fd2ff19524e9e79d2ca9659990c880d45;hpb=c8597ac89064c0ef1e428f9536fc46733579f7a0;p=supertux.git diff --git a/src/video/sdl_surface_ptr.hpp b/src/video/sdl_surface_ptr.hpp index 2fffc95fd..ac1c126a2 100644 --- a/src/video/sdl_surface_ptr.hpp +++ b/src/video/sdl_surface_ptr.hpp @@ -1,5 +1,5 @@ // SuperTux -// Copyright (C) 2009 Ingo Ruhnke +// Copyright (C) 2009 Ingo Ruhnke // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,13 +27,28 @@ private: SDL_Surface* m_surface; public: + SDLSurfacePtr() : + m_surface(0) + {} + SDLSurfacePtr(SDL_Surface* surface) : m_surface(surface) {} - ~SDLSurfacePtr() + ~SDLSurfacePtr() + { + SDL_FreeSurface(m_surface); + } + + SDL_Surface* operator->() + { + return m_surface; + } + + void reset(SDL_Surface* surface) { SDL_FreeSurface(m_surface); + m_surface = surface; } SDL_Surface* get()