Skip to content

Commit

Permalink
Merge pull request #90994 from aaronp64/tileset_compressed_image
Browse files Browse the repository at this point in the history
Handle compressed images in `TileSetAtlasSource::_create_padded_image_texture`
  • Loading branch information
akien-mga committed Apr 22, 2024
2 parents 2b42352 + ff60f7b commit 7529c0b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scene/resources/2d/tile_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 7529c0b

Please sign in to comment.