X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvideo%2Ftexture_manager.hpp;h=52074ca6e0e048deb89bc64b182a23833ddf4042;hb=39b21a2b4a45fe80b4e08e59cdc61556f9da8b20;hp=a9a1fac3cc6b7a63906be7e64fa9ea36ee930c3b;hpb=c8597ac89064c0ef1e428f9536fc46733579f7a0;p=supertux.git diff --git a/src/video/texture_manager.hpp b/src/video/texture_manager.hpp index a9a1fac3c..52074ca6e 100644 --- a/src/video/texture_manager.hpp +++ b/src/video/texture_manager.hpp @@ -17,14 +17,18 @@ #ifndef HEADER_SUPERTUX_VIDEO_TEXTURE_MANAGER_HPP #define HEADER_SUPERTUX_VIDEO_TEXTURE_MANAGER_HPP +#include + #include #include #include #include #include +#include #include "video/glutil.hpp" +#include "video/texture_ptr.hpp" class Texture; class GLTexture; @@ -36,8 +40,8 @@ public: TextureManager(); ~TextureManager(); - Texture* get(const std::string& filename); - Texture* get(const std::string& filename, const Rect& rect); + TexturePtr get(const std::string& filename); + TexturePtr get(const std::string& filename, const Rect& rect); #ifdef HAVE_OPENGL void register_texture(GLTexture* texture); @@ -49,21 +53,24 @@ public: private: friend class Texture; - void release(Texture* texture); + void reap_cache_entry(const std::string& filename); - typedef std::map ImageTextures; + typedef std::map > ImageTextures; ImageTextures image_textures; + typedef std::map Surfaces; + Surfaces surfaces; - Texture* create_image_texture(const std::string& filename, const Rect& rect); + TexturePtr create_image_texture(const std::string& filename, const Rect& rect); /** on failure a dummy texture is returned and no exception is thrown */ - Texture* create_image_texture(const std::string& filename); + TexturePtr create_image_texture(const std::string& filename); /** throw an exception on error */ - Texture* create_image_texture_raw(const std::string& filename); + TexturePtr create_image_texture_raw(const std::string& filename); + TexturePtr create_image_texture_raw(const std::string& filename, const Rect& rect); + + TexturePtr create_dummy_texture(); - Texture* create_dummy_texture(); - #ifdef HAVE_OPENGL typedef std::set Textures; Textures textures;