diff options
Diffstat (limited to 'src/core/frontend/framebuffer_layout.cpp')
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index d8821f8fd..1b4f0255e 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -27,22 +27,9 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { | |||
| 27 | // so just calculate them both even if the other isn't showing. | 27 | // so just calculate them both even if the other isn't showing. |
| 28 | FramebufferLayout res{width, height}; | 28 | FramebufferLayout res{width, height}; |
| 29 | 29 | ||
| 30 | const auto window_aspect_ratio = static_cast<float>(height) / width; | 30 | const float window_aspect_ratio = static_cast<float>(height) / width; |
| 31 | float emulation_aspect_ratio; | 31 | float emulation_aspect_ratio = EmulationAspectRatio( |
| 32 | 32 | static_cast<Aspect>(Settings::values.aspect_ratio), window_aspect_ratio); | |
| 33 | switch (static_cast<Aspect>(Settings::values.aspect_ratio)) { | ||
| 34 | case Aspect::AspectDefault: | ||
| 35 | emulation_aspect_ratio = static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 36 | break; | ||
| 37 | case Aspect::Aspect21by9: | ||
| 38 | emulation_aspect_ratio = 9.f / 21; | ||
| 39 | break; | ||
| 40 | case Aspect::AspectStretch: | ||
| 41 | emulation_aspect_ratio = window_aspect_ratio; | ||
| 42 | break; | ||
| 43 | default: | ||
| 44 | emulation_aspect_ratio = static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 45 | } | ||
| 46 | 33 | ||
| 47 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; | 34 | const Common::Rectangle<u32> screen_window_area{0, 0, width, height}; |
| 48 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); | 35 | Common::Rectangle<u32> screen = MaxRectangle(screen_window_area, emulation_aspect_ratio); |
| @@ -71,4 +58,17 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale) { | |||
| 71 | return DefaultFrameLayout(width, height); | 58 | return DefaultFrameLayout(width, height); |
| 72 | } | 59 | } |
| 73 | 60 | ||
| 61 | float EmulationAspectRatio(Aspect aspect, float window_aspect_ratio) { | ||
| 62 | switch (aspect) { | ||
| 63 | case Aspect::Default: | ||
| 64 | return static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 65 | case Aspect::Aspect21by9: | ||
| 66 | return 9.0f / 21.0f; | ||
| 67 | case Aspect::StretchToWindow: | ||
| 68 | return window_aspect_ratio; | ||
| 69 | default: | ||
| 70 | return static_cast<float>(ScreenUndocked::Height) / ScreenUndocked::Width; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | } // namespace Layout | 74 | } // namespace Layout |