From 94fcffdf1ff5a92e4488864914b8591f00057e18 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 14 Jul 2008 23:38:30 +0000 Subject: [PATCH] automatic build --- panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx | 12 ++++-------- panda/src/tinydisplay/tinyTextureContext.I | 3 +-- panda/src/tinydisplay/tinyTextureContext.cxx | 12 ++++++------ panda/src/tinydisplay/tinyTextureContext.h | 5 ++--- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx index 1efece8b44..394e3dd2ab 100644 --- a/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx +++ b/panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx @@ -1054,7 +1054,7 @@ framebuffer_copy_to_texture(Texture *tex, int z, const DisplayRegion *dr, nassertv(tc != (TextureContext *)NULL); TinyTextureContext *gtc = DCAST(TinyTextureContext, tc); - GLTexture *gltex = gtc->_gltex; + GLTexture *gltex = >c->_gltex; if (!setup_gltex(gltex, tex->get_x_size(), tex->get_y_size(), 1)) { return; } @@ -1251,7 +1251,6 @@ prepare_texture(Texture *tex) { } TinyTextureContext *gtc = new TinyTextureContext(_prepared_objects, tex); - gtc->_gltex = (GLTexture *)gl_zalloc(sizeof(GLTexture)); return gtc; } @@ -1268,11 +1267,9 @@ void TinyGraphicsStateGuardian:: release_texture(TextureContext *tc) { TinyTextureContext *gtc = DCAST(TinyTextureContext, tc); - GLTexture *gltex = gtc->_gltex; - gtc->_gltex = NULL; - _texturing_state = 0; // just in case + GLTexture *gltex = >c->_gltex; for (int i = 0; i < gltex->num_levels; ++i) { gl_free(gltex->levels[i].pixmap); } @@ -1281,7 +1278,6 @@ release_texture(TextureContext *tc) { gltex->levels = NULL; } - gl_free(gltex); gtc->dequeue_lru(); delete gtc; @@ -1720,7 +1716,7 @@ apply_texture(TextureContext *tc) { gtc->set_active(true); - GLTexture *gltex = gtc->_gltex; + GLTexture *gltex = >c->_gltex; if (gtc->was_image_modified() || gltex->num_levels == 0) { // If the texture image was modified, reload the texture. @@ -1767,7 +1763,7 @@ upload_texture(TinyTextureContext *gtc) { #ifdef DO_PSTATS _data_transferred_pcollector.add_level(tex->get_ram_image_size()); #endif - GLTexture *gltex = gtc->_gltex; + GLTexture *gltex = >c->_gltex; int num_levels = 1; if (tex->uses_mipmaps()) { diff --git a/panda/src/tinydisplay/tinyTextureContext.I b/panda/src/tinydisplay/tinyTextureContext.I index ada54847bd..296ffcb414 100644 --- a/panda/src/tinydisplay/tinyTextureContext.I +++ b/panda/src/tinydisplay/tinyTextureContext.I @@ -22,7 +22,6 @@ INLINE TinyTextureContext:: TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex) : TextureContext(pgo, tex), SimpleLruPage(0) { - _gltex = NULL; } //////////////////////////////////////////////////////////////////// @@ -32,7 +31,7 @@ TinyTextureContext(PreparedGraphicsObjects *pgo, Texture *tex) : //////////////////////////////////////////////////////////////////// INLINE TinyTextureContext:: ~TinyTextureContext() { - nassertv(_gltex == NULL); + nassertv(_gltex.levels == NULL); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tinydisplay/tinyTextureContext.cxx b/panda/src/tinydisplay/tinyTextureContext.cxx index decd335263..c2e74d4245 100644 --- a/panda/src/tinydisplay/tinyTextureContext.cxx +++ b/panda/src/tinydisplay/tinyTextureContext.cxx @@ -36,14 +36,14 @@ void TinyTextureContext:: evict_lru() { dequeue_lru(); - for (int i = 0; i < _gltex->num_levels; ++i) { - gl_free(_gltex->levels[i].pixmap); + for (int i = 0; i < _gltex.num_levels; ++i) { + gl_free(_gltex.levels[i].pixmap); } - if (_gltex->levels != NULL) { - gl_free(_gltex->levels); - _gltex->levels = NULL; + if (_gltex.levels != NULL) { + gl_free(_gltex.levels); + _gltex.levels = NULL; } - _gltex->num_levels = 0; + _gltex.num_levels = 0; set_resident(false); } diff --git a/panda/src/tinydisplay/tinyTextureContext.h b/panda/src/tinydisplay/tinyTextureContext.h index f658f84054..9516939951 100644 --- a/panda/src/tinydisplay/tinyTextureContext.h +++ b/panda/src/tinydisplay/tinyTextureContext.h @@ -19,8 +19,7 @@ #include "textureContext.h" #include "deletedChain.h" #include "simpleLru.h" - -struct GLTexture; +#include "zgl.h" //////////////////////////////////////////////////////////////////// // Class : TinyTextureContext @@ -36,7 +35,7 @@ public: INLINE void update_data_size_bytes(size_t new_data_size_bytes); virtual void evict_lru(); - GLTexture *_gltex; + GLTexture _gltex; public: static TypeHandle get_class_type() {