summaryrefslogtreecommitdiff
path: root/core/io/image.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-30 12:13:32 +0200
committerGitHub <noreply@github.com>2022-03-30 12:13:32 +0200
commit60f8df380df7ddc5dde4de4384b488e8a342ce79 (patch)
tree1330f02fff7c40f8e1448c7f262211f1068e90b7 /core/io/image.cpp
parent398d502cc78a7b2086ea864581a6c0ec0e2a4cb2 (diff)
parent45f74ceb853a2986acbdb44f7b36b409b4e0cea5 (diff)
Merge pull request #59478 from reduz/add-portable-compressed-texture
Diffstat (limited to 'core/io/image.cpp')
-rw-r--r--core/io/image.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/io/image.cpp b/core/io/image.cpp
index 67e6724e71..fad9942017 100644
--- a/core/io/image.cpp
+++ b/core/io/image.cpp
@@ -2726,6 +2726,7 @@ Vector<uint8_t> (*Image::png_packer)(const Ref<Image> &) = nullptr;
Ref<Image> (*Image::png_unpacker)(const Vector<uint8_t> &) = nullptr;
Vector<uint8_t> (*Image::basis_universal_packer)(const Ref<Image> &, Image::UsedChannels) = nullptr;
Ref<Image> (*Image::basis_universal_unpacker)(const Vector<uint8_t> &) = nullptr;
+Ref<Image> (*Image::basis_universal_unpacker_ptr)(const uint8_t *, int) = nullptr;
void Image::_set_data(const Dictionary &p_data) {
ERR_FAIL_COND(!p_data.has("width"));
@@ -3008,7 +3009,7 @@ void Image::adjust_bcs(float p_brightness, float p_contrast, float p_saturation)
}
}
-Image::UsedChannels Image::detect_used_channels(CompressSource p_source) {
+Image::UsedChannels Image::detect_used_channels(CompressSource p_source) const {
ERR_FAIL_COND_V(data.size() == 0, USED_CHANNELS_RGBA);
ERR_FAIL_COND_V(is_compressed(), USED_CHANNELS_RGBA);
bool r = false, g = false, b = false, a = false, c = false;
@@ -3613,6 +3614,10 @@ Image::Image(const uint8_t *p_mem_png_jpg, int p_len) {
if (is_empty() && _jpg_mem_loader_func) {
copy_internals_from(_jpg_mem_loader_func(p_mem_png_jpg, p_len));
}
+
+ if (is_empty() && _webp_mem_loader_func) {
+ copy_internals_from(_webp_mem_loader_func(p_mem_png_jpg, p_len));
+ }
}
Ref<Resource> Image::duplicate(bool p_subresources) const {