Merge pull request #102668 from jkirsteins/janiskirsteins/ios-aspect-fill-splash

[iOS] Sync the boot splash and the launch screen image scale modes
This commit is contained in:
Thaddeus Crews 2025-02-12 12:56:26 -06:00
commit 78f1918bd4
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
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();