Add support for VRAM-compressed custom mouse cursor images

No memory is actually saved when using this, so lossless modes are
still recommended as they look better and load faster.
This commit is contained in:
Hugo Locurcio 2023-04-21 02:15:54 +02:00
parent 6f1a52b017
commit 303bf247de
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
5 changed files with 22 additions and 2 deletions

View file

@ -426,7 +426,12 @@ void DisplayServerWeb::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
ERR_FAIL_COND(!image.is_valid());
image = image->duplicate();
image = image->duplicate(true);
if (image->is_compressed()) {
Error err = image->decompress();
ERR_FAIL_COND_MSG(err != OK, "Couldn't decompress VRAM-compressed custom mouse cursor image. Switch to a lossless compression mode in the Import dock.");
}
if (atlas_texture.is_valid()) {
image->crop_from_point(