diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-08-11 15:55:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 15:55:22 +0200 |
commit | 23f6d3fa69935c90c6cdcee342ae99d226e9b4ab (patch) | |
tree | 020f9c3bd654d4ac76f61d50d59ad33217b3917d /scene/main | |
parent | ff2cb35b90f5661d1bb5fb00fa657a9539449be0 (diff) | |
parent | b2ca50054504e5a8db6a6940af2da99b49c95486 (diff) |
Merge pull request #10198 from jjay/f/stretch_aspect_expand
Add "expand" option for stretch aspect, no more black bars
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/scene_tree.cpp | 9 | ||||
-rw-r--r-- | scene/main/scene_tree.h | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index af7dac7ec9..067bcbff3e 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1181,7 +1181,7 @@ void SceneTree::_update_root_rect() { } else if (viewport_aspect < video_mode_aspect) { // screen ratio is smaller vertically - if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT) { + if (stretch_aspect == STRETCH_ASPECT_KEEP_HEIGHT || stretch_aspect == STRETCH_ASPECT_EXPAND) { //will stretch horizontally viewport_size.x = desired_res.y * video_mode_aspect; @@ -1196,7 +1196,7 @@ void SceneTree::_update_root_rect() { } } else { //screen ratio is smaller horizontally - if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH) { + if (stretch_aspect == STRETCH_ASPECT_KEEP_WIDTH || stretch_aspect == STRETCH_ASPECT_EXPAND) { //will stretch horizontally viewport_size.x = desired_res.x; @@ -1217,12 +1217,11 @@ void SceneTree::_update_root_rect() { Size2 margin; Size2 offset; //black bars and margin - if (screen_size.x < video_mode.x) { + if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.x < video_mode.x) { margin.x = Math::round((video_mode.x - screen_size.x) / 2.0); VisualServer::get_singleton()->black_bars_set_margins(margin.x, 0, margin.x, 0); offset.x = Math::round(margin.x * viewport_size.y / screen_size.y); - } else if (screen_size.y < video_mode.y) { - + } else if (stretch_aspect != STRETCH_ASPECT_EXPAND && screen_size.y < video_mode.y) { margin.y = Math::round((video_mode.y - screen_size.y) / 2.0); VisualServer::get_singleton()->black_bars_set_margins(0, margin.y, 0, margin.y); offset.y = Math::round(margin.y * viewport_size.x / screen_size.x); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index 90d42ef01b..3543ebee90 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -90,6 +90,7 @@ public: STRETCH_ASPECT_KEEP, STRETCH_ASPECT_KEEP_WIDTH, STRETCH_ASPECT_KEEP_HEIGHT, + STRETCH_ASPECT_EXPAND, }; private: |