Merge pull request #90994 from aaronp64/tileset_compressed_image

Handle compressed images in `TileSetAtlasSource::_create_padded_image_texture`
This commit is contained in:
Rémi Verschelde 2024-04-22 12:53:51 +02:00
commit 7529c0bec5
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -5591,6 +5591,11 @@ Ref<ImageTexture> TileSetAtlasSource::_create_padded_image_texture(const Ref<Tex
ret.instantiate(); ret.instantiate();
return ret; return ret;
} }
if (src_image->is_compressed()) {
src_image = src_image->duplicate();
Error err = src_image->decompress();
ERR_FAIL_COND_V_MSG(err != OK, Ref<ImageTexture>(), "Unable to decompress image.");
}
Size2 size = get_atlas_grid_size() * (texture_region_size + Vector2i(2, 2)); Size2 size = get_atlas_grid_size() * (texture_region_size + Vector2i(2, 2));
Ref<Image> image = Image::create_empty(size.x, size.y, false, src_image->get_format()); Ref<Image> image = Image::create_empty(size.x, size.y, false, src_image->get_format());