diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/emu_window.h | 2 | ||||
| -rw-r--r-- | src/common/framebuffer_layout.cpp | 6 | ||||
| -rw-r--r-- | src/common/framebuffer_layout.h | 3 | ||||
| -rw-r--r-- | src/common/math_util.h | 6 |
4 files changed, 10 insertions, 7 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 6fac572f5..835c4d500 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h | |||
| @@ -200,7 +200,7 @@ public: | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | /** | 202 | /** |
| 203 | * Convenience method to update the VideoCore EmuWindow | 203 | * Convenience method to update the current frame layout |
| 204 | * Read from the current settings to determine which layout to use. | 204 | * Read from the current settings to determine which layout to use. |
| 205 | */ | 205 | */ |
| 206 | void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); | 206 | void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); |
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp index d50c141bb..e8538dcfd 100644 --- a/src/common/framebuffer_layout.cpp +++ b/src/common/framebuffer_layout.cpp | |||
| @@ -51,11 +51,15 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapp | |||
| 51 | bot_screen.TranslateX((screen_window_area.GetWidth() - bot_screen.GetWidth()) / 2); | 51 | bot_screen.TranslateX((screen_window_area.GetWidth() - bot_screen.GetWidth()) / 2); |
| 52 | } else { | 52 | } else { |
| 53 | // Window is narrower than the emulation content => apply borders to the top and bottom | 53 | // Window is narrower than the emulation content => apply borders to the top and bottom |
| 54 | top_screen = top_screen.TranslateY(height / 2 - top_screen.GetHeight()); | ||
| 55 | // Recalculate the bottom screen to account for the width difference between top and bottom | 54 | // Recalculate the bottom screen to account for the width difference between top and bottom |
| 56 | screen_window_area = {0, 0, width, top_screen.GetHeight()}; | 55 | screen_window_area = {0, 0, width, top_screen.GetHeight()}; |
| 57 | bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); | 56 | bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); |
| 58 | bot_screen = bot_screen.TranslateX((top_screen.GetWidth() - bot_screen.GetWidth()) / 2); | 57 | bot_screen = bot_screen.TranslateX((top_screen.GetWidth() - bot_screen.GetWidth()) / 2); |
| 58 | if (swapped) { | ||
| 59 | bot_screen = bot_screen.TranslateY(height / 2 - bot_screen.GetHeight()); | ||
| 60 | } else { | ||
| 61 | top_screen = top_screen.TranslateY(height / 2 - top_screen.GetHeight()); | ||
| 62 | } | ||
| 59 | } | 63 | } |
| 60 | // Move the top screen to the bottom if we are swapped. | 64 | // Move the top screen to the bottom if we are swapped. |
| 61 | res.top_screen = swapped ? top_screen.TranslateY(height / 2) : top_screen; | 65 | res.top_screen = swapped ? top_screen.TranslateY(height / 2) : top_screen; |
diff --git a/src/common/framebuffer_layout.h b/src/common/framebuffer_layout.h index c69a80732..7f88c9463 100644 --- a/src/common/framebuffer_layout.h +++ b/src/common/framebuffer_layout.h | |||
| @@ -33,7 +33,8 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool is_sw | |||
| 33 | FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swapped); | 33 | FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swapped); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom screen on the right | 36 | * Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom |
| 37 | * screen on the right | ||
| 37 | * This is useful in particular because it matches well with a 1920x1080 resolution monitor | 38 | * This is useful in particular because it matches well with a 1920x1080 resolution monitor |
| 38 | * @param width Window framebuffer width in pixels | 39 | * @param width Window framebuffer width in pixels |
| 39 | * @param height Window framebuffer height in pixels | 40 | * @param height Window framebuffer height in pixels |
diff --git a/src/common/math_util.h b/src/common/math_util.h index 570ec8e56..9e630d93d 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h | |||
| @@ -45,10 +45,8 @@ struct Rectangle { | |||
| 45 | return Rectangle{left, top + y, right, bottom + y}; | 45 | return Rectangle{left, top + y, right, bottom + y}; |
| 46 | } | 46 | } |
| 47 | Rectangle<T> Scale(const float s) const { | 47 | Rectangle<T> Scale(const float s) const { |
| 48 | ASSERT(s > 0); | 48 | return Rectangle{left, top, static_cast<T>((right + left) * s), |
| 49 | return Rectangle { | 49 | static_cast<T>((top + bottom) * s)}; |
| 50 | left, top, static_cast<T>((right + left) * s), static_cast<T>((top + bottom) * s) | ||
| 51 | }; | ||
| 52 | } | 50 | } |
| 53 | }; | 51 | }; |
| 54 | 52 | ||