summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-03-04 16:42:31 +1000
committerStenzek <stenzek@gmail.com>2017-03-04 16:53:12 +1000
commit811eafda576dd38a4bbff779d078762dbb3bd8b4 (patch)
tree10175c1f2398023197b38ff7f8ccede2bec3a465 /Source/Core/VideoCommon/RenderBase.cpp
parent00a0a91513fbb52362fc7d3a7db6450d66c4c68a (diff)
VideoCommon: Store last window request width/height
This avoids the need to send a window resize event every frame.
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 784a294785..990f01d53d 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -619,10 +619,8 @@ void Renderer::UpdateDrawRectangle()
void Renderer::SetWindowSize(int width, int height)
{
- if (width < 1)
- width = 1;
- if (height < 1)
- height = 1;
+ width = std::max(width, 1);
+ height = std::max(height, 1);
// Scale the window size by the EFB scale.
CalculateTargetScale(width, height, &width, &height);
@@ -659,7 +657,13 @@ void Renderer::SetWindowSize(int width, int height)
width -= width % 4;
height -= height % 4;
- Host_RequestRenderWindowSize(width, height);
+ // Track the last values of width/height to avoid sending a window resize event every frame.
+ if (width != m_last_window_request_width || height != m_last_window_request_height)
+ {
+ m_last_window_request_width = width;
+ m_last_window_request_height = height;
+ Host_RequestRenderWindowSize(width, height);
+ }
}
void Renderer::CheckFifoRecording()