Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

make `p_len` a requirement when using `Image(const uint8_t *p_mem_png_jpg, int p_len)`

nikitalitaabc6db46219d
diff --git a/core/io/image.h b/core/io/image.h
index cca4c71afe4..a040677bc35 100644
--- a/core/io/image.h
+++ b/core/io/image.h
@@ -412,7 +412,7 @@ public:
Image() = default; // Create an empty image.
Image(int p_width, int p_height, bool p_use_mipmaps, Format p_format); // Create an empty image of a specific size and format.
Image(int p_width, int p_height, bool p_mipmaps, Format p_format, const Vector<uint8_t> &p_data); // Import an image of a specific size and format from a byte vector.
- Image(const uint8_t *p_mem_png_jpg, int p_len = -1); // Import either a png or jpg from a pointer.
+ Image(const uint8_t *p_mem_png_jpg, int p_len); // Import either a png or jpg from a pointer.
Image(const char **p_xpm); // Import an XPM image.
AlphaMode detect_alpha() const;
diff --git a/main/main.cpp b/main/main.cpp
index e754e37083e..3d075705c85 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -4016,7 +4016,7 @@ void Main::setup_boot_logo() {
#if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH)
Ref<Image> splash = (editor || project_manager) ? memnew(Image(boot_splash_editor_png)) : memnew(Image(boot_splash_png));
#else
- Ref<Image> splash = memnew(Image(boot_splash_png));
+ Ref<Image> splash = memnew(Image(boot_splash_png, sizeof(boot_splash_png)));
#endif
MAIN_PRINT("Main: ClearColor");
@@ -4028,7 +4028,7 @@ void Main::setup_boot_logo() {
#if defined(TOOLS_ENABLED) && defined(MACOS_ENABLED)
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_ICON) && OS::get_singleton()->get_bundle_icon_path().is_empty()) {
- Ref<Image> icon = memnew(Image(app_icon_png));
+ Ref<Image> icon = memnew(Image(app_icon_png, sizeof(app_icon_png)));
DisplayServer::get_singleton()->set_icon(icon);
}
#endif
@@ -4873,7 +4873,7 @@ int Main::start() {
}
if (DisplayServer::get_singleton()->has_feature(DisplayServerEnums::FEATURE_ICON) && !has_icon && OS::get_singleton()->get_bundle_icon_path().is_empty()) {
- Ref<Image> icon = memnew(Image(app_icon_png));
+ Ref<Image> icon = memnew(Image(app_icon_png, sizeof(app_icon_png)));
DisplayServer::get_singleton()->set_icon(icon);
}
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index 0777b029913..077aeed4e86 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -185,7 +185,7 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor
}
if (err != OK || splash.is_null() || splash->is_empty()) {
- splash.instantiate(boot_splash_png);
+ splash.instantiate(boot_splash_png, sizeof(boot_splash_png));
}
// Using same image for both @2x and @3x
diff --git a/platform/web/export/export_plugin.h b/platform/web/export/export_plugin.h
index 047bd1815c2..11782c6d0be 100644
--- a/platform/web/export/export_plugin.h
+++ b/platform/web/export/export_plugin.h
@@ -95,7 +95,7 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
splash = _load_icon_or_splash_image(splash_path, &err);
}
if (splash_path.is_empty() || err != OK || splash.is_null() || splash->is_empty()) {
- return Ref<Image>(memnew(Image(boot_splash_png)));
+ return Ref<Image>(memnew(Image(boot_splash_png, sizeof(boot_splash_png))));
}
return splash;
}
diff --git a/servers/rendering/renderer_rd/effects/smaa.cpp b/servers/rendering/renderer_rd/effects/smaa.cpp
index e06a3856831..e016b09de3a 100644
--- a/servers/rendering/renderer_rd/effects/smaa.cpp
+++ b/servers/rendering/renderer_rd/effects/smaa.cpp
@@ -110,7 +110,7 @@ SMAA::SMAA() {
tf.height = SEARCHTEX_HEIGHT;
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
- smaa.search_tex = RD::get_singleton()->texture_create(tf, RD::TextureView(), Vector<Vector<unsigned char>>{ Image(search_tex_png).get_data() });
+ smaa.search_tex = RD::get_singleton()->texture_create(tf, RD::TextureView(), Vector<Vector<unsigned char>>{ Image(search_tex_png, sizeof(search_tex_png)).get_data() });
}
{
@@ -121,7 +121,7 @@ SMAA::SMAA() {
tf.height = AREATEX_HEIGHT;
tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT;
- smaa.area_tex = RD::get_singleton()->texture_create(tf, RD::TextureView(), Vector<Vector<unsigned char>>{ Image(area_tex_png).get_data() });
+ smaa.area_tex = RD::get_singleton()->texture_create(tf, RD::TextureView(), Vector<Vector<unsigned char>>{ Image(area_tex_png, sizeof(area_tex_png)).get_data() });
}
{