1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

[iOS] Sync the boot splash and the launch screen image scale modes

This commit is contained in:
Jānis Kiršteins
2025-02-10 00:29:29 +01:00
parent 0b6a717ac1
commit 0e266b0099
9 changed files with 117 additions and 25 deletions

View File

@@ -216,18 +216,7 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
Rect2 screenrect;
if (p_scale) {
if (window_size.width > window_size.height) {
//scale horizontally
screenrect.size.y = window_size.height;
screenrect.size.x = imgrect.size.x * window_size.height / imgrect.size.y;
screenrect.position.x = (window_size.width - screenrect.size.x) / 2;
} else {
//scale vertically
screenrect.size.x = window_size.width;
screenrect.size.y = imgrect.size.y * window_size.width / imgrect.size.x;
screenrect.position.y = (window_size.height - screenrect.size.y) / 2;
}
screenrect = OS::get_singleton()->calculate_boot_screen_rect(window_size, imgrect.size);
} else {
screenrect = imgrect;
screenrect.position += ((window_size - screenrect.size) / 2.0).floor();