mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-26 03:20:05 +00:00
[Screen layout] Set small screen at 1x resolution
The large screen scales to fit the window and the small screen remains at its native resolution on "Large Frame Layout".
This commit is contained in:
parent
d3b7f57b2b
commit
91f14a36c7
@ -100,39 +100,31 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
|
|||||||
ASSERT(height > 0);
|
ASSERT(height > 0);
|
||||||
|
|
||||||
FramebufferLayout res{width, height, true, true, {}, {}};
|
FramebufferLayout res{width, height, true, true, {}, {}};
|
||||||
// Split the window into two parts. Give 4x width to the main screen and 1x width to the small
|
int viewport_height = static_cast<int>(std::round((width - VideoCore::kScreenBottomWidth) *
|
||||||
// To do that, find the total emulation box and maximize that based on window size
|
TOP_SCREEN_ASPECT_RATIO));
|
||||||
float window_aspect_ratio = static_cast<float>(height) / width;
|
|
||||||
float emulation_aspect_ratio =
|
|
||||||
swapped
|
|
||||||
? VideoCore::kScreenBottomHeight * 4 /
|
|
||||||
(VideoCore::kScreenBottomWidth * 4.0f + VideoCore::kScreenTopWidth)
|
|
||||||
: VideoCore::kScreenTopHeight * 4 /
|
|
||||||
(VideoCore::kScreenTopWidth * 4.0f + VideoCore::kScreenBottomWidth);
|
|
||||||
float large_screen_aspect_ratio = swapped ? BOT_SCREEN_ASPECT_RATIO : TOP_SCREEN_ASPECT_RATIO;
|
|
||||||
float small_screen_aspect_ratio = swapped ? TOP_SCREEN_ASPECT_RATIO : BOT_SCREEN_ASPECT_RATIO;
|
|
||||||
|
|
||||||
MathUtil::Rectangle<unsigned> screen_window_area{0, 0, width, height};
|
if (height > viewport_height) {
|
||||||
MathUtil::Rectangle<unsigned> total_rect =
|
// Apply borders to the top and bottom.
|
||||||
maxRectangle(screen_window_area, emulation_aspect_ratio);
|
unsigned top_screen_bottom = viewport_height + (height - viewport_height) / 2;
|
||||||
MathUtil::Rectangle<unsigned> large_screen =
|
res.top_screen = {0, (height - viewport_height) / 2,
|
||||||
maxRectangle(total_rect, large_screen_aspect_ratio);
|
width - VideoCore::kScreenBottomWidth, top_screen_bottom};
|
||||||
MathUtil::Rectangle<unsigned> fourth_size_rect = total_rect.Scale(.25f);
|
res.bottom_screen = {width - VideoCore::kScreenBottomWidth,
|
||||||
MathUtil::Rectangle<unsigned> small_screen =
|
top_screen_bottom - VideoCore::kScreenBottomHeight,
|
||||||
maxRectangle(fourth_size_rect, small_screen_aspect_ratio);
|
width, top_screen_bottom};
|
||||||
|
|
||||||
if (window_aspect_ratio < emulation_aspect_ratio) {
|
|
||||||
large_screen =
|
|
||||||
large_screen.TranslateX((screen_window_area.GetWidth() - total_rect.GetWidth()) / 2);
|
|
||||||
} else {
|
} else {
|
||||||
large_screen = large_screen.TranslateY((height - total_rect.GetHeight()) / 2);
|
// Apply borders to the left and right sides of the window.
|
||||||
|
int viewport_width = static_cast<int>(std::round((height / TOP_SCREEN_ASPECT_RATIO) +
|
||||||
|
VideoCore::kScreenBottomWidth));
|
||||||
|
unsigned top_screen_right = (height / TOP_SCREEN_ASPECT_RATIO) + (width - viewport_width) / 2;
|
||||||
|
res.top_screen = {(width - viewport_width) / 2, 0, top_screen_right, height};
|
||||||
|
res.bottom_screen = {top_screen_right, height - VideoCore::kScreenBottomHeight,
|
||||||
|
top_screen_right + VideoCore::kScreenBottomWidth, height};
|
||||||
|
}
|
||||||
|
if (swapped) {
|
||||||
|
MathUtil::Rectangle<unsigned> temp = res.top_screen;
|
||||||
|
res.top_screen = res.bottom_screen;
|
||||||
|
res.bottom_screen = temp;
|
||||||
}
|
}
|
||||||
// Shift the small screen to the bottom right corner
|
|
||||||
small_screen =
|
|
||||||
small_screen.TranslateX(large_screen.right)
|
|
||||||
.TranslateY(large_screen.GetHeight() + large_screen.top - small_screen.GetHeight());
|
|
||||||
res.top_screen = swapped ? small_screen : large_screen;
|
|
||||||
res.bottom_screen = swapped ? large_screen : small_screen;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user