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,22 +100,23 @@ 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, {}, {}};
int viewport_height = static_cast<int>(std::round((width - VideoCore::kScreenBottomWidth) * int viewport_height = static_cast<int>(
TOP_SCREEN_ASPECT_RATIO)); std::round((width - VideoCore::kScreenBottomWidth) * TOP_SCREEN_ASPECT_RATIO));
if (height > viewport_height) { if (height > viewport_height) {
// Apply borders to the top and bottom. // Apply borders to the top and bottom.
unsigned top_screen_bottom = viewport_height + (height - viewport_height) / 2; unsigned top_screen_bottom = viewport_height + (height - viewport_height) / 2;
res.top_screen = {0, (height - viewport_height) / 2, res.top_screen = {0, (height - viewport_height) / 2, width - VideoCore::kScreenBottomWidth,
width - VideoCore::kScreenBottomWidth, top_screen_bottom}; top_screen_bottom};
res.bottom_screen = {width - VideoCore::kScreenBottomWidth, res.bottom_screen = {width - VideoCore::kScreenBottomWidth,
top_screen_bottom - VideoCore::kScreenBottomHeight, top_screen_bottom - VideoCore::kScreenBottomHeight, width,
width, top_screen_bottom}; top_screen_bottom};
} else { } else {
// Apply borders to the left and right sides of the window. // Apply borders to the left and right sides of the window.
int viewport_width = static_cast<int>(std::round((height / TOP_SCREEN_ASPECT_RATIO) + int viewport_width = static_cast<int>(
VideoCore::kScreenBottomWidth)); std::round((height / TOP_SCREEN_ASPECT_RATIO) + VideoCore::kScreenBottomWidth));
unsigned top_screen_right = (height / TOP_SCREEN_ASPECT_RATIO) + (width - viewport_width) / 2; 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.top_screen = {(width - viewport_width) / 2, 0, top_screen_right, height};
res.bottom_screen = {top_screen_right, height - VideoCore::kScreenBottomHeight, res.bottom_screen = {top_screen_right, height - VideoCore::kScreenBottomHeight,
top_screen_right + VideoCore::kScreenBottomWidth, height}; top_screen_right + VideoCore::kScreenBottomWidth, height};