Handle compressed images in TileSetAtlasSource::_create_padded_image_texture

Check for compressed image and decompress if needed

Fixes #78755
This commit is contained in:
aaronp64 2024-04-21 21:36:12 -04:00
parent 4a0160241f
commit ff60f7b6d4

View file

@ -5591,6 +5591,11 @@ Ref<ImageTexture> TileSetAtlasSource::_create_padded_image_texture(const Ref<Tex
ret.instantiate();
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));
Ref<Image> image = Image::create_empty(size.x, size.y, false, src_image->get_format());