Fix Andorid disabling splash screen Show Image

This commit is contained in:
scgm0 2023-11-07 00:22:22 +08:00
parent 5ee983188d
commit 7771936df5
1 changed files with 22 additions and 15 deletions

View File

@ -1542,8 +1542,17 @@ void EditorExportPlatformAndroid::_process_launcher_icons(const String &p_file_n
String EditorExportPlatformAndroid::load_splash_refs(Ref<Image> &splash_image, Ref<Image> &splash_bg_color_image) { String EditorExportPlatformAndroid::load_splash_refs(Ref<Image> &splash_image, Ref<Image> &splash_bg_color_image) {
bool scale_splash = GLOBAL_GET("application/boot_splash/fullsize"); bool scale_splash = GLOBAL_GET("application/boot_splash/fullsize");
bool apply_filter = GLOBAL_GET("application/boot_splash/use_filter"); bool apply_filter = GLOBAL_GET("application/boot_splash/use_filter");
bool show_splash_image = GLOBAL_GET("application/boot_splash/show_image");
String project_splash_path = GLOBAL_GET("application/boot_splash/image"); String project_splash_path = GLOBAL_GET("application/boot_splash/image");
// Setup the splash bg color.
bool bg_color_valid = false;
Color bg_color = ProjectSettings::get_singleton()->get("application/boot_splash/bg_color", &bg_color_valid);
if (!bg_color_valid) {
bg_color = boot_splash_bg_color;
}
if (show_splash_image) {
if (!project_splash_path.is_empty()) { if (!project_splash_path.is_empty()) {
splash_image.instantiate(); splash_image.instantiate();
print_verbose("Loading splash image: " + project_splash_path); print_verbose("Loading splash image: " + project_splash_path);
@ -1555,6 +1564,11 @@ String EditorExportPlatformAndroid::load_splash_refs(Ref<Image> &splash_image, R
splash_image.unref(); splash_image.unref();
} }
} }
} else {
splash_image.instantiate();
splash_image->initialize_data(1, 1, false, Image::FORMAT_RGBA8);
splash_image->set_pixel(0, 0, bg_color);
}
if (splash_image.is_null()) { if (splash_image.is_null()) {
// Use the default // Use the default
@ -1577,13 +1591,6 @@ String EditorExportPlatformAndroid::load_splash_refs(Ref<Image> &splash_image, R
splash_image->resize(width, height); splash_image->resize(width, height);
} }
// Setup the splash bg color
bool bg_color_valid;
Color bg_color = ProjectSettings::get_singleton()->get("application/boot_splash/bg_color", &bg_color_valid);
if (!bg_color_valid) {
bg_color = boot_splash_bg_color;
}
print_verbose("Creating splash background color image."); print_verbose("Creating splash background color image.");
splash_bg_color_image.instantiate(); splash_bg_color_image.instantiate();
splash_bg_color_image->initialize_data(splash_image->get_width(), splash_image->get_height(), false, splash_image->get_format()); splash_bg_color_image->initialize_data(splash_image->get_width(), splash_image->get_height(), false, splash_image->get_format());