diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-09-10 07:28:02 +0200 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2021-11-16 22:11:30 +0100 |
commit | 80f8d4989eca127c7ca8c7bd63134127d6fd5edc (patch) | |
tree | 299bc0d76a3972fbd1875fec40c051bf8c07ce6c /src/core | |
parent | gl_texture_cache: Simplify scaling (diff) | |
download | yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar.gz yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar.bz2 yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar.lz yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar.xz yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.tar.zst yuzu-80f8d4989eca127c7ca8c7bd63134127d6fd5edc.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 15 | ||||
-rw-r--r-- | src/core/frontend/framebuffer_layout.h | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 0832463d6..4b58b672a 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -44,16 +44,13 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height) { return res; } -FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale) { - u32 width, height; +FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale) { + const bool is_docked = Settings::values.use_docked_mode.GetValue(); + const u32 screen_width = is_docked ? ScreenDocked::Width : ScreenUndocked::Width; + const u32 screen_height = is_docked ? ScreenDocked::Height : ScreenUndocked::Height; - if (Settings::values.use_docked_mode.GetValue()) { - width = ScreenDocked::Width * res_scale; - height = ScreenDocked::Height * res_scale; - } else { - width = ScreenUndocked::Width * res_scale; - height = ScreenUndocked::Height * res_scale; - } + const u32 width = static_cast<u32>(static_cast<f32>(screen_width) * res_scale); + const u32 height = static_cast<u32>(static_cast<f32>(screen_height) * res_scale); return DefaultFrameLayout(width, height); } diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index e2e3bbbb3..2e36c0163 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -60,7 +60,7 @@ FramebufferLayout DefaultFrameLayout(u32 width, u32 height); * Convenience method to get frame layout by resolution scale * @param res_scale resolution scale factor */ -FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale); +FramebufferLayout FrameLayoutFromResolutionScale(f32 res_scale); /** * Convenience method to determine emulation aspect ratio |