Correctly treat cases when current size is smaller than the minimum defined by the layout

This commit is contained in:
Vitor Kiguchi 2020-01-21 13:32:51 -03:00
parent 5d0353c391
commit 718f04af6d
1 changed files with 8 additions and 8 deletions

View File

@ -152,29 +152,29 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height)
} else {
switch (Settings::values.layout_option) {
case Settings::LayoutOption::SingleScreen:
layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen);
min_width = Settings::values.swap_screen ? Core::kScreenBottomWidth : Core::kScreenTopWidth;
min_height = Core::kScreenBottomHeight;
layout = Layout::SingleFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen,
Settings::values.upright_screen);
break;
case Settings::LayoutOption::LargeScreen:
layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen);
min_width = Settings::values.swap_screen ? Core::kScreenTopWidth/4 + Core::kScreenBottomWidth : Core::kScreenTopWidth + Core::kScreenBottomWidth/4;
min_height = Core::kScreenBottomHeight;
layout = Layout::LargeFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen,
Settings::values.upright_screen);
break;
case Settings::LayoutOption::SideScreen:
layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen);
min_width = Core::kScreenTopWidth + Core::kScreenBottomWidth;
min_height = Core::kScreenBottomHeight;
layout = Layout::SideFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen,
Settings::values.upright_screen);
break;
case Settings::LayoutOption::Default:
default:
layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen);
min_width = Core::kScreenTopWidth;
min_height = Core::kScreenTopHeight + Core::kScreenBottomHeight;
layout = Layout::DefaultFrameLayout(std::max(width, min_width), std::max(height, min_height), Settings::values.swap_screen,
Settings::values.upright_screen);
break;
}
if(Settings::values.upright_screen){