summaryrefslogtreecommitdiff
path: root/lib/texture.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/texture.cc')
-rw-r--r--lib/texture.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/texture.cc b/lib/texture.cc
index d7cfa7c..a8036bc 100644
--- a/lib/texture.cc
+++ b/lib/texture.cc
@@ -11,10 +11,8 @@
#define DEBUG 1
-#ifdef TRACE_TEXTURES
mogltk::texture * mogltk::texture::header = 0;
mogltk::texture * mogltk::texture::footer = 0;
-#endif
mogltk::texture * mogltk::texture::active = 0;
@@ -41,7 +39,6 @@ mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : wi
SDL_FillRect(surface, 0, 0);
-#ifdef TRACE_TEXTURES
next = 0;
prev = footer;
footer = this;
@@ -51,7 +48,6 @@ mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : wi
if (prev) {
prev->next = this;
}
-#endif
}
mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
@@ -107,7 +103,6 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
SDL_FreeSurface(temp);
-#ifdef TRACE_TEXTURES
next = 0;
prev = footer;
footer = this;
@@ -117,7 +112,6 @@ mogltk::texture::texture(Handle * h, bool plane) throw (GeneralException) :
if (prev) {
prev->next = this;
}
-#endif
}
mogltk::texture::~texture() {
@@ -129,7 +123,6 @@ mogltk::texture::~texture() {
glDeleteTextures(1, &tex);
}
-#ifdef TRACE_TEXTURES
if (prev) {
prev->next = next;
}
@@ -145,7 +138,6 @@ mogltk::texture::~texture() {
if (this == header) {
header = next;
}
-#endif
}
Uint32 * mogltk::texture::GetPixels() {
@@ -215,7 +207,6 @@ void mogltk::texture::Bind(bool expand) {
active = this;
-#ifdef TRACE_TEXTURES
if (header == this)
return;
@@ -231,9 +222,10 @@ void mogltk::texture::Bind(bool expand) {
footer = prev;
}
+ next = header;
+ prev = 0;
header->prev = this;
header = this;
-#endif
}
GLuint mogltk::texture::GetWidth() {
@@ -256,6 +248,17 @@ void mogltk::texture::Taint(void) {
tainted = true;
}
+void mogltk::texture::Taintall(void) {
+ if (header)
+ header->recTaint();
+}
+
+void mogltk::texture::recTaint(void) {
+ Taint();
+ if (next)
+ next->recTaint();
+}
+
#ifdef WORDS_BIGENDIAN
#define NTEX_SIGNATURE 0x4e544558
#else