diff options
| author | James Rowe <jroweboy@gmail.com> | 2016-11-10 00:36:07 -0700 |
|---|---|---|
| committer | James Rowe <jroweboy@gmail.com> | 2016-11-12 10:49:47 -0700 |
| commit | 48d64ccad5c8383c4dd5e43ef005ac71e0aa3bb1 (patch) | |
| tree | 5177fdef58d7cf99fded0d913072372a425cbe63 /src/common/framebuffer_layout.cpp | |
| parent | 72786d410e2b0d3797441aefbfbf73fca098b5ac (diff) | |
Round the rectangle size to prevent float to int casting issues
And other minor style changes
Diffstat (limited to 'src/common/framebuffer_layout.cpp')
| -rw-r--r-- | src/common/framebuffer_layout.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp index e8538dcfd5..46c008d9cb 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<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth; static const float BOT_SCREEN_ASPECT_RATIO = static_cast<float>(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 <class T> @@ -23,8 +21,8 @@ static MathUtil::Rectangle<T> maxRectangle(MathUtil::Rectangle<T> window_area, float screen_aspect_ratio) { float scale = std::min(static_cast<float>(window_area.GetWidth()), window_area.GetHeight() / screen_aspect_ratio); - return MathUtil::Rectangle<T>{0, 0, static_cast<T>(scale), - static_cast<T>(scale * screen_aspect_ratio)}; + return MathUtil::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), + static_cast<T>(std::round(scale * screen_aspect_ratio))}; } FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapped) { |
