Respect splash fullsize option on GLES2

This commit is contained in:
volzhs 2018-09-03 19:48:12 +09:00
parent 737c90963f
commit d5354e2e8f

View file

@ -321,9 +321,25 @@ void RasterizerGLES2::set_boot_image(const Ref<Image> &p_image, const Color &p_c
Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height()); Rect2 imgrect(0, 0, p_image->get_width(), p_image->get_height());
Rect2 screenrect; Rect2 screenrect;
if (p_scale) {
if (window_w > window_h) {
//scale horizontally
screenrect.size.y = window_h;
screenrect.size.x = imgrect.size.x * window_h / imgrect.size.y;
screenrect.position.x = (window_w - screenrect.size.x) / 2;
} else {
//scale vertically
screenrect.size.x = window_w;
screenrect.size.y = imgrect.size.y * window_w / imgrect.size.x;
screenrect.position.y = (window_h - screenrect.size.y) / 2;
}
} else {
screenrect = imgrect; screenrect = imgrect;
screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor(); screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor();
}
RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture); RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture);
glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1);