summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorFredy Huya-Kouadio <fhuya@fb.com>2022-04-25 00:03:00 -0700
committerFredy Huya-Kouadio <fhuya@fb.com>2022-04-25 00:25:17 -0700
commit3b1e62bc7ce9a0d8b48bb27661b328f7e6daabc7 (patch)
treed85b9d9bbb3768ee0dcd870b5452f77b885463b8 /platform
parentd9d871dfbf661b329269d7c70a631e3405602e63 (diff)
Fix the issue causing the screen to be black after resuming when in low processor mode.
This is done by forcing a redraw and buffers swap when resuming the app.
Diffstat (limited to 'platform')
-rw-r--r--platform/android/java_godot_lib_jni.cpp2
-rw-r--r--platform/android/os_android.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp
index ea72bc0e15..5e0a9d967b 100644
--- a/platform/android/java_godot_lib_jni.cpp
+++ b/platform/android/java_godot_lib_jni.cpp
@@ -503,6 +503,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_onRendererResumed(JNI
return;
}
+ // We force redraw to ensure we render at least once when resuming the app.
+ Main::force_redraw();
if (os_android->get_main_loop()) {
os_android->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_RESUMED);
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index ef53415f16..54124c22d0 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -187,10 +187,11 @@ bool OS_Android::main_loop_iterate(bool *r_should_swap_buffers) {
return false;
}
DisplayServerAndroid::get_singleton()->process_events();
+ uint64_t current_frames_drawn = Engine::get_singleton()->get_frames_drawn();
bool exit = Main::iteration();
if (r_should_swap_buffers) {
- *r_should_swap_buffers = !is_in_low_processor_usage_mode() || RenderingServer::get_singleton()->has_changed();
+ *r_should_swap_buffers = !is_in_low_processor_usage_mode() || RenderingServer::get_singleton()->has_changed() || current_frames_drawn != Engine::get_singleton()->get_frames_drawn();
}
return exit;