summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorGravatar bunnei2017-03-21 22:57:31 -0400
committerGravatar GitHub2017-03-21 22:57:31 -0400
commitccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c (patch)
tree38120c3cf4e7af72dc8122f9f278b77aa52b663b /src/common
parentRemoved a linebreak from the README. (diff)
parentAdd custom layout settings. (diff)
downloadyuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.tar.gz
yuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.tar.xz
yuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.zip
Merge pull request #2512 from SonofUgly/custom-layout
Add custom layout settings.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/framebuffer_layout.cpp19
-rw-r--r--src/common/framebuffer_layout.h8
2 files changed, 27 insertions, 0 deletions
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp
index 46c008d9c..a2a0e7dad 100644
--- a/src/common/framebuffer_layout.cpp
+++ b/src/common/framebuffer_layout.cpp
@@ -6,6 +6,7 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/framebuffer_layout.h" 8#include "common/framebuffer_layout.h"
9#include "core/settings.h"
9#include "video_core/video_core.h" 10#include "video_core/video_core.h"
10 11
11namespace Layout { 12namespace Layout {
@@ -135,4 +136,22 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
135 res.bottom_screen = swapped ? large_screen : small_screen; 136 res.bottom_screen = swapped ? large_screen : small_screen;
136 return res; 137 return res;
137} 138}
139
140FramebufferLayout CustomFrameLayout(unsigned width, unsigned height) {
141 ASSERT(width > 0);
142 ASSERT(height > 0);
143
144 FramebufferLayout res{width, height, true, true, {}, {}};
145
146 MathUtil::Rectangle<unsigned> top_screen{
147 Settings::values.custom_top_left, Settings::values.custom_top_top,
148 Settings::values.custom_top_right, Settings::values.custom_top_bottom};
149 MathUtil::Rectangle<unsigned> bot_screen{
150 Settings::values.custom_bottom_left, Settings::values.custom_bottom_top,
151 Settings::values.custom_bottom_right, Settings::values.custom_bottom_bottom};
152
153 res.top_screen = top_screen;
154 res.bottom_screen = bot_screen;
155 return res;
156}
138} 157}
diff --git a/src/common/framebuffer_layout.h b/src/common/framebuffer_layout.h
index a125646a3..f1df5c55a 100644
--- a/src/common/framebuffer_layout.h
+++ b/src/common/framebuffer_layout.h
@@ -44,4 +44,12 @@ FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swa
44 * @return Newly created FramebufferLayout object with default screen regions initialized 44 * @return Newly created FramebufferLayout object with default screen regions initialized
45 */ 45 */
46FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped); 46FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped);
47
48/**
49 * Factory method for constructing a custom FramebufferLayout
50 * @param width Window framebuffer width in pixels
51 * @param height Window framebuffer height in pixels
52 * @return Newly created FramebufferLayout object with default screen regions initialized
53 */
54FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
47} 55}