From 793339b73a9bc87d6fa22742be4631565c2201db Mon Sep 17 00:00:00 2001 From: James Rowe Date: Thu, 10 Nov 2016 00:36:07 -0700 Subject: Round the rectangle size to prevent float to int casting issues And other minor style changes --- src/common/framebuffer_layout.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/common/framebuffer_layout.cpp') diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp index e8538dcfd..46c008d9c 100644 --- a/src/common/framebuffer_layout.cpp +++ b/src/common/framebuffer_layout.cpp @@ -14,8 +14,6 @@ static const float TOP_SCREEN_ASPECT_RATIO = static_cast(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth; static const float BOT_SCREEN_ASPECT_RATIO = static_cast(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth; -static const float BOT_TO_TOP_SCREEN_RATIO_DIFFERENCE = - BOT_SCREEN_ASPECT_RATIO - TOP_SCREEN_ASPECT_RATIO; // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio template @@ -23,8 +21,8 @@ static MathUtil::Rectangle maxRectangle(MathUtil::Rectangle window_area, float screen_aspect_ratio) { float scale = std::min(static_cast(window_area.GetWidth()), window_area.GetHeight() / screen_aspect_ratio); - return MathUtil::Rectangle{0, 0, static_cast(scale), - static_cast(scale * screen_aspect_ratio)}; + return MathUtil::Rectangle{0, 0, static_cast(std::round(scale)), + static_cast(std::round(scale * screen_aspect_ratio))}; } FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapped) { -- cgit v1.2.3