VideoCommon: Fix crash at startup with virtual XFB enabled

This commit is contained in:
Stenzek 2017-03-09 23:39:48 +10:00
parent 883bec873f
commit 4012166085
4 changed files with 12 additions and 14 deletions

View file

@ -248,20 +248,18 @@ void FramebufferManagerBase::ReplaceVirtualXFB()
}
}
int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x)
int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, const TargetRectangle& target_rectangle)
{
if (g_ActiveConfig.RealXFBEnabled())
return x;
return x * static_cast<int>(g_renderer->GetTargetRectangle().GetWidth()) /
static_cast<int>(FramebufferManagerBase::LastXfbWidth());
return x * target_rectangle.GetWidth() / s_last_xfb_width;
}
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y)
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, const TargetRectangle& target_rectangle)
{
if (g_ActiveConfig.RealXFBEnabled())
return y;
return y * static_cast<int>(g_renderer->GetTargetRectangle().GetHeight()) /
static_cast<int>(FramebufferManagerBase::LastXfbHeight());
return y * target_rectangle.GetHeight() / s_last_xfb_height;
}