Skip to content

Commit

Permalink
framebuffer_layout.cpp mini refactor (#7300)
Browse files Browse the repository at this point in the history
* framebuffer_layout.cpp: simplify FrameLayoutFromResolutionScale

- upright_screen seems to only be swapped width and height calculation, so it is replaced with std::swap
- Get rid of call to GetCardboardSettings, The FrameLayoutFromResolutionScale function is used for Screenshots and Video Dumping where we dont need 3D effects

* framebuffer_layout.cpp: Combine SideFrameLayout and MobileLandscapeFrameLayout into variants of LargeFrameLayout

* framebuffer_layout.{cpp,h}: rename maxRectangle to MaxRectangle, plus

minor documentation update

* clang-format
  • Loading branch information
SachinVin authored Jan 2, 2024
1 parent 7dd9174 commit 9b147d3
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 268 deletions.
17 changes: 10 additions & 7 deletions src/core/frontend/emu_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
TouchPressed(framebuffer_x, framebuffer_y);
}

void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
bool is_portrait_mode) {
void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_portrait_mode) {
Layout::FramebufferLayout layout;

// If in portrait mode, only the MobilePortrait option really makes sense
Expand All @@ -200,16 +199,19 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
layout =
Layout::LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue(),
Settings::values.large_screen_proportion.GetValue());
Settings::values.large_screen_proportion.GetValue(),
Layout::VerticalAlignment::Bottom);
break;
case Settings::LayoutOption::HybridScreen:
layout =
Layout::HybridScreenLayout(width, height, Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue());
break;
case Settings::LayoutOption::SideScreen:
layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue());
layout =
Layout::LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
Settings::values.upright_screen.GetValue(), 1.0f,
Layout::VerticalAlignment::Bottom);
break;
#ifndef ANDROID
case Settings::LayoutOption::SeparateWindows:
Expand All @@ -222,8 +224,9 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
Settings::values.swap_screen.GetValue());
break;
case Settings::LayoutOption::MobileLandscape:
layout = Layout::MobileLandscapeFrameLayout(
width, height, Settings::values.swap_screen.GetValue(), 2.25f, false);
layout =
Layout::LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
false, 2.25f, Layout::VerticalAlignment::Top);
break;
case Settings::LayoutOption::Default:
default:
Expand Down
Loading

0 comments on commit 9b147d3

Please sign in to comment.