feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -31,7 +31,6 @@
|
|||
#include "image.h"
|
||||
|
||||
#include "core/config/project_settings.h"
|
||||
#include "core/error/error_list.h"
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/io/image_loader.h"
|
||||
#include "core/io/resource_loader.h"
|
||||
|
|
@ -89,11 +88,13 @@ SavePNGFunc Image::save_png_func = nullptr;
|
|||
SaveJPGFunc Image::save_jpg_func = nullptr;
|
||||
SaveEXRFunc Image::save_exr_func = nullptr;
|
||||
SaveWebPFunc Image::save_webp_func = nullptr;
|
||||
SaveDDSFunc Image::save_dds_func = nullptr;
|
||||
|
||||
SavePNGBufferFunc Image::save_png_buffer_func = nullptr;
|
||||
SaveJPGBufferFunc Image::save_jpg_buffer_func = nullptr;
|
||||
SaveEXRBufferFunc Image::save_exr_buffer_func = nullptr;
|
||||
SaveWebPBufferFunc Image::save_webp_buffer_func = nullptr;
|
||||
SaveDDSBufferFunc Image::save_dds_buffer_func = nullptr;
|
||||
|
||||
// External loader function pointers.
|
||||
|
||||
|
|
@ -105,6 +106,7 @@ ImageMemLoadFunc Image::_tga_mem_loader_func = nullptr;
|
|||
ImageMemLoadFunc Image::_bmp_mem_loader_func = nullptr;
|
||||
ScalableImageMemLoadFunc Image::_svg_scalable_mem_loader_func = nullptr;
|
||||
ImageMemLoadFunc Image::_ktx_mem_loader_func = nullptr;
|
||||
ImageMemLoadFunc Image::_dds_mem_loader_func = nullptr;
|
||||
|
||||
// External VRAM compression function pointers.
|
||||
|
||||
|
|
@ -571,7 +573,7 @@ static bool _are_formats_compatible(Image::Format p_format0, Image::Format p_for
|
|||
void Image::convert(Format p_new_format) {
|
||||
ERR_FAIL_INDEX_MSG(p_new_format, FORMAT_MAX, vformat("The Image format specified (%d) is out of range. See Image's Format enum.", p_new_format));
|
||||
|
||||
if (data.size() == 0 || p_new_format == format) {
|
||||
if (data.is_empty() || p_new_format == format) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -796,7 +798,7 @@ Image::Format Image::get_format() const {
|
|||
}
|
||||
|
||||
static double _bicubic_interp_kernel(double x) {
|
||||
x = ABS(x);
|
||||
x = Math::abs(x);
|
||||
|
||||
double bc = 0;
|
||||
|
||||
|
|
@ -1139,7 +1141,7 @@ bool Image::is_size_po2() const {
|
|||
}
|
||||
|
||||
void Image::resize_to_po2(bool p_square, Interpolation p_interpolation) {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot resize in compressed image formats.");
|
||||
|
||||
int w = next_power_of_2(width);
|
||||
int h = next_power_of_2(height);
|
||||
|
|
@ -1158,7 +1160,7 @@ void Image::resize_to_po2(bool p_square, Interpolation p_interpolation) {
|
|||
|
||||
void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
|
||||
ERR_FAIL_COND_MSG(data.is_empty(), "Cannot resize image before creating it, use set_data() first.");
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot resize in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot resize in compressed image formats.");
|
||||
|
||||
bool mipmap_aware = p_interpolation == INTERPOLATE_TRILINEAR /* || p_interpolation == INTERPOLATE_TRICUBIC */;
|
||||
|
||||
|
|
@ -1461,8 +1463,7 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) {
|
|||
}
|
||||
|
||||
void Image::crop_from_point(int p_x, int p_y, int p_width, int p_height) {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot crop in compressed or custom image formats.");
|
||||
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot crop in compressed image formats.");
|
||||
ERR_FAIL_COND_MSG(p_x < 0, "Start x position cannot be smaller than 0.");
|
||||
ERR_FAIL_COND_MSG(p_y < 0, "Start y position cannot be smaller than 0.");
|
||||
ERR_FAIL_COND_MSG(p_width <= 0, "Width of image must be greater than 0.");
|
||||
|
|
@ -1515,7 +1516,7 @@ void Image::crop(int p_width, int p_height) {
|
|||
}
|
||||
|
||||
void Image::rotate_90(ClockDirection p_direction) {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot rotate in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot rotate in compressed image formats.");
|
||||
ERR_FAIL_COND_MSG(width <= 0, vformat("The Image width specified (%d pixels) must be greater than 0 pixels.", width));
|
||||
ERR_FAIL_COND_MSG(height <= 0, vformat("The Image height specified (%d pixels) must be greater than 0 pixels.", height));
|
||||
|
||||
|
|
@ -1633,7 +1634,7 @@ void Image::rotate_90(ClockDirection p_direction) {
|
|||
}
|
||||
|
||||
void Image::rotate_180() {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot rotate in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot rotate in compressed image formats.");
|
||||
ERR_FAIL_COND_MSG(width <= 0, vformat("The Image width specified (%d pixels) must be greater than 0 pixels.", width));
|
||||
ERR_FAIL_COND_MSG(height <= 0, vformat("The Image height specified (%d pixels) must be greater than 0 pixels.", height));
|
||||
|
||||
|
|
@ -1667,7 +1668,7 @@ void Image::rotate_180() {
|
|||
}
|
||||
|
||||
void Image::flip_y() {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_y in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot flip_y in compressed image formats.");
|
||||
|
||||
bool used_mipmaps = has_mipmaps();
|
||||
if (used_mipmaps) {
|
||||
|
|
@ -1697,7 +1698,7 @@ void Image::flip_y() {
|
|||
}
|
||||
|
||||
void Image::flip_x() {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot flip_x in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot flip_x in compressed image formats.");
|
||||
|
||||
bool used_mipmaps = has_mipmaps();
|
||||
if (used_mipmaps) {
|
||||
|
|
@ -1789,10 +1790,6 @@ int64_t Image::_get_dst_image_size(int p_width, int p_height, Format p_format, i
|
|||
return size;
|
||||
}
|
||||
|
||||
bool Image::_can_modify(Format p_format) const {
|
||||
return !Image::is_format_compressed(p_format);
|
||||
}
|
||||
|
||||
template <typename Component, int CC, bool renormalize,
|
||||
void (*average_func)(Component &, const Component &, const Component &, const Component &, const Component &),
|
||||
void (*renormalize_func)(Component *)>
|
||||
|
|
@ -1926,7 +1923,7 @@ void Image::shrink_x2() {
|
|||
memcpy(new_data.ptrw(), data.ptr() + ofs, new_size);
|
||||
} else {
|
||||
// Generate a mipmap and replace the original.
|
||||
ERR_FAIL_COND(!_can_modify(format));
|
||||
ERR_FAIL_COND(is_compressed());
|
||||
|
||||
new_data.resize((width / 2) * (height / 2) * get_format_pixel_size(format));
|
||||
ERR_FAIL_COND(data.is_empty() || new_data.is_empty());
|
||||
|
|
@ -1963,7 +1960,7 @@ void Image::normalize() {
|
|||
}
|
||||
|
||||
Error Image::generate_mipmaps(bool p_renormalize) {
|
||||
ERR_FAIL_COND_V_MSG(!_can_modify(format), ERR_UNAVAILABLE, "Cannot generate mipmaps in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_V_MSG(is_compressed(), ERR_UNAVAILABLE, "Cannot generate mipmaps from compressed image formats.");
|
||||
ERR_FAIL_COND_V_MSG(format == FORMAT_RGBA4444, ERR_UNAVAILABLE, "Cannot generate mipmaps from RGBA4444 format.");
|
||||
ERR_FAIL_COND_V_MSG(width == 0 || height == 0, ERR_UNCONFIGURED, "Cannot generate mipmaps with width or height equal to 0.");
|
||||
|
||||
|
|
@ -2180,7 +2177,7 @@ void Image::clear_mipmaps() {
|
|||
}
|
||||
|
||||
bool Image::is_empty() const {
|
||||
return (data.size() == 0);
|
||||
return (data.is_empty());
|
||||
}
|
||||
|
||||
Vector<uint8_t> Image::get_data() const {
|
||||
|
|
@ -2297,7 +2294,7 @@ void Image::initialize_data(const char **p_xpm) {
|
|||
switch (status) {
|
||||
case READING_HEADER: {
|
||||
String line_str = line_ptr;
|
||||
line_str.replace("\t", " ");
|
||||
line_str.replace_char('\t', ' ');
|
||||
|
||||
size_width = line_str.get_slicec(' ', 0).to_int();
|
||||
size_height = line_str.get_slicec(' ', 1).to_int();
|
||||
|
|
@ -2441,47 +2438,75 @@ void Image::initialize_data(const char **p_xpm) {
|
|||
}
|
||||
|
||||
bool Image::is_invisible() const {
|
||||
if (format == FORMAT_L8 || format == FORMAT_RGB8 || format == FORMAT_RG8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t len = data.size();
|
||||
int w, h;
|
||||
int64_t len;
|
||||
_get_mipmap_offset_and_size(1, len, w, h);
|
||||
|
||||
if (len == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int w, h;
|
||||
_get_mipmap_offset_and_size(1, len, w, h);
|
||||
|
||||
const uint8_t *r = data.ptr();
|
||||
const unsigned char *data_ptr = r;
|
||||
|
||||
bool detected = false;
|
||||
|
||||
switch (format) {
|
||||
case FORMAT_LA8: {
|
||||
for (int i = 0; i < (len >> 1); i++) {
|
||||
DETECT_NON_ALPHA(data_ptr[(i << 1) + 1]);
|
||||
}
|
||||
const int pixel_count = len / 2;
|
||||
const uint16_t *pixeldata = reinterpret_cast<const uint16_t *>(data.ptr());
|
||||
|
||||
for (int i = 0; i < pixel_count; i++) {
|
||||
if ((pixeldata[i] & 0xFF00) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case FORMAT_RGBA8: {
|
||||
for (int i = 0; i < (len >> 2); i++) {
|
||||
DETECT_NON_ALPHA(data_ptr[(i << 2) + 3])
|
||||
const int pixel_count = len / 4;
|
||||
const uint32_t *pixeldata = reinterpret_cast<const uint32_t *>(data.ptr());
|
||||
|
||||
for (int i = 0; i < pixel_count; i++) {
|
||||
if ((pixeldata[i] & 0xFF000000) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} break;
|
||||
case FORMAT_RGBA4444: {
|
||||
const int pixel_count = len / 2;
|
||||
const uint16_t *pixeldata = reinterpret_cast<const uint16_t *>(data.ptr());
|
||||
|
||||
case FORMAT_DXT3:
|
||||
case FORMAT_DXT5: {
|
||||
detected = true;
|
||||
for (int i = 0; i < pixel_count; i++) {
|
||||
if ((pixeldata[i] & 0x000F) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case FORMAT_RGBAH: {
|
||||
// The alpha mask accounts for the sign bit.
|
||||
const int pixel_count = len / 4;
|
||||
const uint16_t *pixeldata = reinterpret_cast<const uint16_t *>(data.ptr());
|
||||
|
||||
for (int i = 0; i < pixel_count; i += 4) {
|
||||
if ((pixeldata[i + 3] & 0x7FFF) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case FORMAT_RGBAF: {
|
||||
// The alpha mask accounts for the sign bit.
|
||||
const int pixel_count = len / 4;
|
||||
const uint32_t *pixeldata = reinterpret_cast<const uint32_t *>(data.ptr());
|
||||
|
||||
for (int i = 0; i < pixel_count; i += 4) {
|
||||
if ((pixeldata[i + 3] & 0x7FFFFFFF) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
default: {
|
||||
// Formats that are compressed or don't support alpha channels are presumed to be visible.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !detected;
|
||||
// Every pixel has been checked, the image is invisible.
|
||||
return true;
|
||||
}
|
||||
|
||||
Image::AlphaMode Image::detect_alpha() const {
|
||||
|
|
@ -2603,6 +2628,21 @@ Vector<uint8_t> Image::save_exr_to_buffer(bool p_grayscale) const {
|
|||
return save_exr_buffer_func(Ref<Image>((Image *)this), p_grayscale);
|
||||
}
|
||||
|
||||
Error Image::save_dds(const String &p_path) const {
|
||||
if (save_dds_func == nullptr) {
|
||||
return ERR_UNAVAILABLE;
|
||||
}
|
||||
|
||||
return save_dds_func(p_path, Ref<Image>((Image *)this));
|
||||
}
|
||||
|
||||
Vector<uint8_t> Image::save_dds_to_buffer() const {
|
||||
if (save_dds_buffer_func == nullptr) {
|
||||
return Vector<uint8_t>();
|
||||
}
|
||||
return save_dds_buffer_func(Ref<Image>((Image *)this));
|
||||
}
|
||||
|
||||
Error Image::save_webp(const String &p_path, const bool p_lossy, const float p_quality) const {
|
||||
if (save_webp_func == nullptr) {
|
||||
return ERR_UNAVAILABLE;
|
||||
|
|
@ -2682,6 +2722,19 @@ Error Image::decompress() {
|
|||
return OK;
|
||||
}
|
||||
|
||||
bool Image::can_decompress(const String &p_format_tag) {
|
||||
if (p_format_tag == "astc") {
|
||||
return _image_decompress_astc != nullptr;
|
||||
} else if (p_format_tag == "bptc") {
|
||||
return _image_decompress_bptc != nullptr;
|
||||
} else if (p_format_tag == "etc2") {
|
||||
return _image_decompress_etc2 != nullptr;
|
||||
} else if (p_format_tag == "s3tc") {
|
||||
return _image_decompress_bc != nullptr;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Error Image::compress(CompressMode p_mode, CompressSource p_source, ASTCFormat p_astc_format) {
|
||||
ERR_FAIL_INDEX_V_MSG(p_mode, COMPRESS_MAX, ERR_INVALID_PARAMETER, "Invalid compress mode.");
|
||||
ERR_FAIL_INDEX_V_MSG(p_source, COMPRESS_SOURCE_MAX, ERR_INVALID_PARAMETER, "Invalid compress source.");
|
||||
|
|
@ -2863,7 +2916,7 @@ void Image::blit_rect(const Ref<Image> &p_src, const Rect2i &p_src_rect, const P
|
|||
ERR_FAIL_COND(dsize == 0);
|
||||
ERR_FAIL_COND(srcdsize == 0);
|
||||
ERR_FAIL_COND(format != p_src->format);
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot blit_rect in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot blit_rect in compressed image formats.");
|
||||
|
||||
Rect2i src_rect;
|
||||
Rect2i dest_rect;
|
||||
|
|
@ -3043,10 +3096,10 @@ void Image::_repeat_pixel_over_subsequent_memory(uint8_t *p_pixel, int p_pixel_s
|
|||
}
|
||||
|
||||
void Image::fill(const Color &p_color) {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill in compressed image formats.");
|
||||
|
||||
uint8_t *dst_data_ptr = data.ptrw();
|
||||
|
||||
|
|
@ -3059,10 +3112,10 @@ void Image::fill(const Color &p_color) {
|
|||
}
|
||||
|
||||
void Image::fill_rect(const Rect2i &p_rect, const Color &p_color) {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot fill rect in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot fill rect in compressed image formats.");
|
||||
|
||||
Rect2i r = Rect2i(0, 0, width, height).intersection(p_rect.abs());
|
||||
if (!r.has_area()) {
|
||||
|
|
@ -3278,7 +3331,7 @@ void Image::_set_color_at_ofs(uint8_t *ptr, uint32_t ofs, const Color &p_color)
|
|||
uint16_t rgba = 0;
|
||||
|
||||
rgba = uint16_t(CLAMP(p_color.r * 31.0, 0, 31));
|
||||
rgba |= uint16_t(CLAMP(p_color.g * 63.0, 0, 33)) << 5;
|
||||
rgba |= uint16_t(CLAMP(p_color.g * 63.0, 0, 63)) << 5;
|
||||
rgba |= uint16_t(CLAMP(p_color.b * 31.0, 0, 31)) << 11;
|
||||
|
||||
((uint16_t *)ptr)[ofs] = rgba;
|
||||
|
|
@ -3366,7 +3419,7 @@ int64_t Image::get_data_size() const {
|
|||
}
|
||||
|
||||
void Image::adjust_bcs(float p_brightness, float p_contrast, float p_saturation) {
|
||||
ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot adjust_bcs in compressed or custom image formats.");
|
||||
ERR_FAIL_COND_MSG(is_compressed(), "Cannot adjust_bcs in compressed image formats.");
|
||||
|
||||
uint8_t *w = data.ptrw();
|
||||
uint32_t pixel_size = get_format_pixel_size(format);
|
||||
|
|
@ -3524,6 +3577,9 @@ void Image::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("save_jpg_to_buffer", "quality"), &Image::save_jpg_to_buffer, DEFVAL(0.75));
|
||||
ClassDB::bind_method(D_METHOD("save_exr", "path", "grayscale"), &Image::save_exr, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("save_exr_to_buffer", "grayscale"), &Image::save_exr_to_buffer, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("save_dds", "path"), &Image::save_dds);
|
||||
ClassDB::bind_method(D_METHOD("save_dds_to_buffer"), &Image::save_dds_to_buffer);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("save_webp", "path", "lossy", "quality"), &Image::save_webp, DEFVAL(false), DEFVAL(0.75f));
|
||||
ClassDB::bind_method(D_METHOD("save_webp_to_buffer", "lossy", "quality"), &Image::save_webp_to_buffer, DEFVAL(false), DEFVAL(0.75f));
|
||||
|
||||
|
|
@ -3577,6 +3633,7 @@ void Image::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("load_tga_from_buffer", "buffer"), &Image::load_tga_from_buffer);
|
||||
ClassDB::bind_method(D_METHOD("load_bmp_from_buffer", "buffer"), &Image::load_bmp_from_buffer);
|
||||
ClassDB::bind_method(D_METHOD("load_ktx_from_buffer", "buffer"), &Image::load_ktx_from_buffer);
|
||||
ClassDB::bind_method(D_METHOD("load_dds_from_buffer", "buffer"), &Image::load_dds_from_buffer);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("load_svg_from_buffer", "buffer", "scale"), &Image::load_svg_from_buffer, DEFVAL(1.0));
|
||||
ClassDB::bind_method(D_METHOD("load_svg_from_string", "svg_str", "scale"), &Image::load_svg_from_string, DEFVAL(1.0));
|
||||
|
|
@ -3677,7 +3734,7 @@ void Image::normal_map_to_xy() {
|
|||
}
|
||||
|
||||
Ref<Image> Image::rgbe_to_srgb() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return Ref<Image>();
|
||||
}
|
||||
|
||||
|
|
@ -3724,7 +3781,7 @@ Ref<Image> Image::get_image_from_mipmap(int p_mipmap) const {
|
|||
}
|
||||
|
||||
void Image::bump_map_to_normal_map(float bump_scale) {
|
||||
ERR_FAIL_COND(!_can_modify(format));
|
||||
ERR_FAIL_COND(is_compressed());
|
||||
clear_mipmaps();
|
||||
convert(Image::FORMAT_RF);
|
||||
|
||||
|
|
@ -3799,7 +3856,7 @@ bool Image::detect_signed(bool p_include_mips) const {
|
|||
}
|
||||
|
||||
void Image::srgb_to_linear() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3830,7 +3887,7 @@ void Image::srgb_to_linear() {
|
|||
}
|
||||
|
||||
void Image::linear_to_srgb() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3861,7 +3918,7 @@ void Image::linear_to_srgb() {
|
|||
}
|
||||
|
||||
void Image::premultiply_alpha() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -3883,7 +3940,7 @@ void Image::premultiply_alpha() {
|
|||
}
|
||||
|
||||
void Image::fix_alpha_edges() {
|
||||
if (data.size() == 0) {
|
||||
if (data.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -4072,6 +4129,14 @@ Error Image::load_bmp_from_buffer(const Vector<uint8_t> &p_array) {
|
|||
return _load_from_buffer(p_array, _bmp_mem_loader_func);
|
||||
}
|
||||
|
||||
Error Image::load_dds_from_buffer(const Vector<uint8_t> &p_array) {
|
||||
ERR_FAIL_NULL_V_MSG(
|
||||
_dds_mem_loader_func,
|
||||
ERR_UNAVAILABLE,
|
||||
"The DDS module isn't enabled. Recompile the Godot editor or export template binary with the `module_dds_enabled=yes` SCons option.");
|
||||
return _load_from_buffer(p_array, _dds_mem_loader_func);
|
||||
}
|
||||
|
||||
Error Image::load_svg_from_buffer(const Vector<uint8_t> &p_array, float scale) {
|
||||
ERR_FAIL_NULL_V_MSG(
|
||||
_svg_scalable_mem_loader_func,
|
||||
|
|
@ -4266,10 +4331,10 @@ Dictionary Image::compute_image_metrics(const Ref<Image> p_compared_image, bool
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Dictionary result;
|
||||
result["max"] = INFINITY;
|
||||
result["mean"] = INFINITY;
|
||||
result["mean_squared"] = INFINITY;
|
||||
result["root_mean_squared"] = INFINITY;
|
||||
result["max"] = Math::INF;
|
||||
result["mean"] = Math::INF;
|
||||
result["mean_squared"] = Math::INF;
|
||||
result["root_mean_squared"] = Math::INF;
|
||||
result["peak_snr"] = 0.0f;
|
||||
|
||||
ERR_FAIL_COND_V(p_compared_image.is_null(), result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue