diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-09-03 14:07:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 14:07:36 +0200 |
commit | 1ebfd918d4b56a53ff1223cdf1912aa89863bb8b (patch) | |
tree | cc0e974607ea0d79a5f491886e3d2a499e89a5e3 /drivers | |
parent | 6ead00733aea5eb0003e70ffbf71997b9be2c8c4 (diff) | |
parent | d5354e2e8fa445fea584f5ee394e64cdb8eb0866 (diff) |
Merge pull request #21723 from volzhs/gles2-splash-fullsize
Respect splash fullsize option on GLES2
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index 76ee80aa07..efeab48ea2 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -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 screenrect; + if (p_scale) { - screenrect = imgrect; - screenrect.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor(); + 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.position += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor(); + } RasterizerStorageGLES2::Texture *t = storage->texture_owner.get(texture); glActiveTexture(GL_TEXTURE0 + storage->config.max_texture_image_units - 1); |