Update framebuffer_layout.cpp

This commit is contained in:
TTFH 2016-11-27 16:12:18 -03:00 committed by GitHub
parent 91f14a36c7
commit 8d65ce5a15

View File

@ -100,25 +100,26 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
ASSERT(height > 0);
FramebufferLayout res{width, height, true, true, {}, {}};
int viewport_height = static_cast<int>(std::round((width - VideoCore::kScreenBottomWidth) *
TOP_SCREEN_ASPECT_RATIO));
int viewport_height = static_cast<int>(
std::round((width - VideoCore::kScreenBottomWidth) * TOP_SCREEN_ASPECT_RATIO));
if (height > viewport_height) {
// Apply borders to the top and bottom.
unsigned top_screen_bottom = viewport_height + (height - viewport_height) / 2;
res.top_screen = {0, (height - viewport_height) / 2,
width - VideoCore::kScreenBottomWidth, top_screen_bottom};
res.top_screen = {0, (height - viewport_height) / 2, width - VideoCore::kScreenBottomWidth,
top_screen_bottom};
res.bottom_screen = {width - VideoCore::kScreenBottomWidth,
top_screen_bottom - VideoCore::kScreenBottomHeight,
width, top_screen_bottom};
top_screen_bottom - VideoCore::kScreenBottomHeight, width,
top_screen_bottom};
} else {
// 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;
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};
top_screen_right + VideoCore::kScreenBottomWidth, height};
}
if (swapped) {
MathUtil::Rectangle<unsigned> temp = res.top_screen;