summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorMarkus Wick <degasus@users.noreply.github.com>2018-05-13 08:55:59 +0200
committerGitHub <noreply@github.com>2018-05-13 08:55:59 +0200
commitc267262a668de32bc2c41b40cca787e4c76f19c7 (patch)
tree78684dfb8958d09576fc4105582fa7a2d486fbee /Source/Core/VideoCommon/RenderBase.cpp
parent66c1b909c2697e3f3b3f306904e40204a443c7b2 (diff)
parentfd5aaa096c18609e4c22e583611907e9712978c7 (diff)
Merge pull request #6786 from stenzek/crop-negative-y
RenderBase: Ensure the draw size does not exceed the window size
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 33e449b56c..97ca4c1696 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -534,6 +534,10 @@ void Renderer::UpdateDrawRectangle()
crop_width = win_width;
}
+ // Clamp the draw width/height to the screen size, to ensure we don't render off-screen.
+ draw_width = std::min(draw_width, win_width);
+ draw_height = std::min(draw_height, win_height);
+
// ensure divisibility by 4 to make it compatible with all the video encoders
draw_width = std::ceil(draw_width) - static_cast<int>(std::ceil(draw_width)) % 4;
draw_height = std::ceil(draw_height) - static_cast<int>(std::ceil(draw_height)) % 4;