diff options
| author | 2016-11-10 00:36:07 -0700 | |
|---|---|---|
| committer | 2016-11-12 10:49:47 -0700 | |
| commit | 793339b73a9bc87d6fa22742be4631565c2201db (patch) | |
| tree | 5177fdef58d7cf99fded0d913072372a425cbe63 /src/common/framebuffer_layout.cpp | |
| parent | Add default hotkey to swap primary screens. (diff) | |
| download | yuzu-793339b73a9bc87d6fa22742be4631565c2201db.tar.gz yuzu-793339b73a9bc87d6fa22742be4631565c2201db.tar.xz yuzu-793339b73a9bc87d6fa22742be4631565c2201db.zip | |
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 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 = | |||
| 14 | static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth; | 14 | static_cast<float>(VideoCore::kScreenTopHeight) / VideoCore::kScreenTopWidth; |
| 15 | static const float BOT_SCREEN_ASPECT_RATIO = | 15 | static const float BOT_SCREEN_ASPECT_RATIO = |
| 16 | static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth; | 16 | static_cast<float>(VideoCore::kScreenBottomHeight) / VideoCore::kScreenBottomWidth; |
| 17 | static const float BOT_TO_TOP_SCREEN_RATIO_DIFFERENCE = | ||
| 18 | BOT_SCREEN_ASPECT_RATIO - TOP_SCREEN_ASPECT_RATIO; | ||
| 19 | 17 | ||
| 20 | // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio | 18 | // Finds the largest size subrectangle contained in window area that is confined to the aspect ratio |
| 21 | template <class T> | 19 | template <class T> |
| @@ -23,8 +21,8 @@ static MathUtil::Rectangle<T> maxRectangle(MathUtil::Rectangle<T> window_area, | |||
| 23 | float screen_aspect_ratio) { | 21 | float screen_aspect_ratio) { |
| 24 | float scale = std::min(static_cast<float>(window_area.GetWidth()), | 22 | float scale = std::min(static_cast<float>(window_area.GetWidth()), |
| 25 | window_area.GetHeight() / screen_aspect_ratio); | 23 | window_area.GetHeight() / screen_aspect_ratio); |
| 26 | return MathUtil::Rectangle<T>{0, 0, static_cast<T>(scale), | 24 | return MathUtil::Rectangle<T>{0, 0, static_cast<T>(std::round(scale)), |
| 27 | static_cast<T>(scale * screen_aspect_ratio)}; | 25 | static_cast<T>(std::round(scale * screen_aspect_ratio))}; |
| 28 | } | 26 | } |
| 29 | 27 | ||
| 30 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapped) { | 28 | FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapped) { |