diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/frontend/framebuffer_layout.cpp | 15 | ||||
| -rw-r--r-- | src/core/frontend/framebuffer_layout.h | 7 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 8f07aedc9..f8662d193 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| 8 | #include "core/frontend/framebuffer_layout.h" | 8 | #include "core/frontend/framebuffer_layout.h" |
| 9 | #include "core/settings.h" | ||
| 9 | 10 | ||
| 10 | namespace Layout { | 11 | namespace Layout { |
| 11 | 12 | ||
| @@ -42,4 +43,18 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height) { | |||
| 42 | return res; | 43 | return res; |
| 43 | } | 44 | } |
| 44 | 45 | ||
| 46 | FramebufferLayout FrameLayoutFromResolutionScale(u16 res_scale) { | ||
| 47 | int width, height; | ||
| 48 | |||
| 49 | if (Settings::values.use_docked_mode) { | ||
| 50 | width = ScreenDocked::WidthDocked * res_scale; | ||
| 51 | height = ScreenDocked::HeightDocked * res_scale; | ||
| 52 | } else { | ||
| 53 | width = ScreenUndocked::Width * res_scale; | ||
| 54 | height = ScreenUndocked::Height * res_scale; | ||
| 55 | } | ||
| 56 | |||
| 57 | return DefaultFrameLayout(width, height); | ||
| 58 | } | ||
| 59 | |||
| 45 | } // namespace Layout | 60 | } // namespace Layout |
diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index f3fddfa94..e06647794 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | namespace Layout { | 9 | namespace Layout { |
| 10 | 10 | ||
| 11 | enum ScreenUndocked : unsigned { Width = 1280, Height = 720 }; | 11 | enum ScreenUndocked : unsigned { Width = 1280, Height = 720 }; |
| 12 | enum ScreenDocked : unsigned { WidthDocked = 1920, HeightDocked = 1080 }; | ||
| 12 | 13 | ||
| 13 | /// Describes the layout of the window framebuffer | 14 | /// Describes the layout of the window framebuffer |
| 14 | struct FramebufferLayout { | 15 | struct FramebufferLayout { |
| @@ -34,4 +35,10 @@ struct FramebufferLayout { | |||
| 34 | */ | 35 | */ |
| 35 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height); | 36 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height); |
| 36 | 37 | ||
| 38 | /** | ||
| 39 | * Convenience method to get frame layout by resolution scale | ||
| 40 | * @param res_scale resolution scale factor | ||
| 41 | */ | ||
| 42 | FramebufferLayout FrameLayoutFromResolutionScale(u16 res_scale); | ||
| 43 | |||
| 37 | } // namespace Layout | 44 | } // namespace Layout |