projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implemented window scaling in SDLRenderer, mouse input however breaks when scaling
[supertux.git]
/
src
/
video
/
texture.hpp
diff --git
a/src/video/texture.hpp
b/src/video/texture.hpp
index
a4beb86
..
e814547
100644
(file)
--- a/
src/video/texture.hpp
+++ b/
src/video/texture.hpp
@@
-43,15
+43,20
@@
enum DrawingEffect {
*/
class Texture
{
*/
class Texture
{
-protected:
- std::string filename;
+private:
+ friend class TextureManager;
+ /* The name under which this texture is cached by the texture manager,
+ * or the empty string if not. */
+ std::string cache_filename;
public:
public:
- Texture() : filename() {}
+ Texture() :
cache_
filename() {}
virtual ~Texture()
{
virtual ~Texture()
{
- if (texture_manager)
- texture_manager->release(this);
+ if (texture_manager && cache_filename != "")
+ /* The cache entry is now useless: its weak pointer to us has been
+ * cleared. Remove the entry altogether to save memory. */
+ texture_manager->reap_cache_entry(cache_filename);
}
virtual unsigned int get_texture_width() const = 0;
}
virtual unsigned int get_texture_width() const = 0;
@@
-59,16
+64,6
@@
public:
virtual unsigned int get_image_width() const = 0;
virtual unsigned int get_image_height() const = 0;
virtual unsigned int get_image_width() const = 0;
virtual unsigned int get_image_height() const = 0;
- std::string get_filename() const
- {
- return filename;
- }
-
- void set_filename(std::string filename)
- {
- this->filename = filename;
- }
-
private:
Texture(const Texture&);
Texture& operator=(const Texture&);
private:
Texture(const Texture&);
Texture& operator=(const Texture&);