|
@@ -1027,7 +1027,7 @@ void SceneTree::_update_root_rect() {
|
|
} else if (viewport_aspect < video_mode_aspect) {
|
|
} else if (viewport_aspect < video_mode_aspect) {
|
|
// screen ratio is smaller vertically
|
|
// 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
|
|
//will stretch horizontally
|
|
viewport_size.x = desired_res.y * video_mode_aspect;
|
|
viewport_size.x = desired_res.y * video_mode_aspect;
|
|
@@ -1042,7 +1042,7 @@ void SceneTree::_update_root_rect() {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//screen ratio is smaller horizontally
|
|
//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
|
|
//will stretch horizontally
|
|
viewport_size.x = desired_res.x;
|
|
viewport_size.x = desired_res.x;
|
|
@@ -1063,12 +1063,11 @@ void SceneTree::_update_root_rect() {
|
|
Size2 margin;
|
|
Size2 margin;
|
|
Size2 offset;
|
|
Size2 offset;
|
|
//black bars and margin
|
|
//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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
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);
|
|
offset.y = Math::round(margin.y * viewport_size.x / screen_size.x);
|