| 667 | } |
| 668 | |
| 669 | void DisplayServerAndroid::reset_window() { |
| 670 | #if defined(RD_ENABLED) |
| 671 | if (rendering_context) { |
| 672 | if (rendering_device) { |
| 673 | rendering_device->screen_free(MAIN_WINDOW_ID); |
| 674 | } |
| 675 | |
| 676 | VSyncMode last_vsync_mode = rendering_context->window_get_vsync_mode(MAIN_WINDOW_ID); |
| 677 | rendering_context->window_destroy(MAIN_WINDOW_ID); |
| 678 | |
| 679 | union { |
| 680 | #ifdef VULKAN_ENABLED |
| 681 | RenderingContextDriverVulkanAndroid::WindowPlatformData vulkan; |
| 682 | #endif |
| 683 | } wpd; |
| 684 | #ifdef VULKAN_ENABLED |
| 685 | if (rendering_driver == "vulkan") { |
| 686 | ANativeWindow *native_window = OS_Android::get_singleton()->get_native_window(); |
| 687 | ERR_FAIL_NULL(native_window); |
| 688 | wpd.vulkan.window = native_window; |
| 689 | } |
| 690 | #endif |
| 691 | |
| 692 | if (rendering_context->window_create(MAIN_WINDOW_ID, &wpd) != OK) { |
| 693 | ERR_PRINT(vformat("Failed to reset %s window.", rendering_driver)); |
| 694 | memdelete(rendering_context); |
| 695 | rendering_context = nullptr; |
| 696 | return; |
| 697 | } |
| 698 | |
| 699 | Size2i display_size = OS_Android::get_singleton()->get_display_size(); |
| 700 | rendering_context->window_set_size(MAIN_WINDOW_ID, display_size.width, display_size.height); |
| 701 | rendering_context->window_set_vsync_mode(MAIN_WINDOW_ID, last_vsync_mode); |
| 702 | |
| 703 | if (rendering_device) { |
| 704 | rendering_device->screen_create(MAIN_WINDOW_ID); |
| 705 | } |
| 706 | } |
| 707 | #endif |
| 708 | } |
| 709 | |
| 710 | void DisplayServerAndroid::notify_surface_changed(int p_width, int p_height) { |
| 711 | if (rect_changed_callback.is_valid()) { |
no test coverage detected