fix get_uncompressed_ram_image() with implicit reload

This commit is contained in:
David Rose 2009-01-15 01:11:13 +00:00
parent 0dc844602f
commit 9b9528097e
2 changed files with 15 additions and 6 deletions

View File

@ -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) {

View File

@ -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());
}