Better Support for Picture-in-Picture Custom Layouts (Based on #6127) (#6247)

This commit is contained in:
SomeDudeOnDiscord 2023-02-14 16:06:11 -05:00 committed by GitHub
parent ab8d1c7d8b
commit a8e4e11cd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 180 additions and 132 deletions

View file

@ -178,7 +178,7 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height,
layout_option.GetValue(), Settings::values.upright_screen.GetValue());
if (Settings::values.custom_layout.GetValue() == true) {
layout = Layout::CustomFrameLayout(width, height);
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue());
} else {
width = std::max(width, min_size.first);
height = std::max(height, min_size.second);

View file

@ -349,7 +349,7 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
return SingleFrameLayout(width, height, is_secondary, upright);
}
FramebufferLayout CustomFrameLayout(u32 width, u32 height) {
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped) {
ASSERT(width > 0);
ASSERT(height > 0);
@ -364,8 +364,13 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height) {
Settings::values.custom_bottom_right.GetValue(),
Settings::values.custom_bottom_bottom.GetValue()};
res.top_screen = top_screen;
res.bottom_screen = bot_screen;
if (is_swapped) {
res.top_screen = bot_screen;
res.bottom_screen = top_screen;
} else {
res.top_screen = top_screen;
res.bottom_screen = bot_screen;
}
return res;
}
@ -375,7 +380,8 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar
layout = CustomFrameLayout(std::max(Settings::values.custom_top_right.GetValue(),
Settings::values.custom_bottom_right.GetValue()),
std::max(Settings::values.custom_top_bottom.GetValue(),
Settings::values.custom_bottom_bottom.GetValue()));
Settings::values.custom_bottom_bottom.GetValue()),
Settings::values.swap_screen.GetValue());
} else {
int width, height;
switch (Settings::values.layout_option.GetValue()) {

View file

@ -114,7 +114,7 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
* @param height Window framebuffer height in pixels
* @return Newly created FramebufferLayout object with default screen regions initialized
*/
FramebufferLayout CustomFrameLayout(u32 width, u32 height);
FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped);
/**
* Convenience method to get frame layout by resolution scale