From 9b9528097e46c7efb99dab441b8ace0866b619e1 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 15 Jan 2009 01:11:13 +0000 Subject: [PATCH] fix get_uncompressed_ram_image() with implicit reload --- panda/src/gobj/texture.I | 12 ++++++------ panda/src/gobj/texture.cxx | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/panda/src/gobj/texture.I b/panda/src/gobj/texture.I index 80912c17a3..ab10e1db46 100644 --- a/panda/src/gobj/texture.I +++ b/panda/src/gobj/texture.I @@ -1201,12 +1201,12 @@ clear_ram_image() { // memory dumped when the texture is prepared for // rendering. // -// This will be true for most textures, which can reload -// their images if needed by rereading the input file. -// However, textures that were generated dynamically and -// cannot be easily reloaded will want to set this flag -// to true, so that the texture will always keep its -// image copy around. +// This will be false for most textures, which can +// reload their images if needed by rereading the input +// file. However, textures that were generated +// dynamically and cannot be easily reloaded will want +// to set this flag to true, so that the texture will +// always keep its image copy around. //////////////////////////////////////////////////////////////////// INLINE void Texture:: set_keep_ram_image(bool keep_ram_image) { diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index bf2d404f28..1060f66ee0 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3874,6 +3874,15 @@ do_get_uncompressed_ram_image() { do_unlock_and_reload_ram_image(false); } + if (!_ram_images.empty() && _ram_image_compression != CM_off) { + // Great, now we have an image. + if (do_uncompress_ram_image()) { + gobj_cat.info() + << "Uncompressed " << get_name() << "\n"; + return _ram_images[0]._image; + } + } + if (_ram_images.empty() || _ram_image_compression != CM_off) { return CPTA_uchar(get_class_type()); }