VideoCommon: Store last window request width/height

This avoids the need to send a window resize event every frame.
This commit is contained in:
Stenzek 2017-03-04 16:42:31 +10:00
parent 00a0a91513
commit 811eafda57
2 changed files with 13 additions and 5 deletions

View File

@ -619,10 +619,8 @@ void Renderer::UpdateDrawRectangle()
void Renderer::SetWindowSize(int width, int height) void Renderer::SetWindowSize(int width, int height)
{ {
if (width < 1) width = std::max(width, 1);
width = 1; height = std::max(height, 1);
if (height < 1)
height = 1;
// Scale the window size by the EFB scale. // Scale the window size by the EFB scale.
CalculateTargetScale(width, height, &width, &height); CalculateTargetScale(width, height, &width, &height);
@ -659,8 +657,14 @@ void Renderer::SetWindowSize(int width, int height)
width -= width % 4; width -= width % 4;
height -= height % 4; height -= height % 4;
// 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); Host_RequestRenderWindowSize(width, height);
} }
}
void Renderer::CheckFifoRecording() void Renderer::CheckFifoRecording()
{ {

View File

@ -192,6 +192,10 @@ private:
unsigned int m_efb_scale_denominatorX = 1; unsigned int m_efb_scale_denominatorX = 1;
unsigned int m_efb_scale_denominatorY = 1; unsigned int m_efb_scale_denominatorY = 1;
// These will be set on the first call to SetWindowSize.
int m_last_window_request_width = 0;
int m_last_window_request_height = 0;
// frame dumping // frame dumping
std::thread m_frame_dump_thread; std::thread m_frame_dump_thread;
Common::Event m_frame_dump_start; Common::Event m_frame_dump_start;