mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Remove Renderer::xScale and Renderer::yScale.
This commit is contained in:
@ -229,3 +229,31 @@ void FramebufferManagerBase::ReplaceVirtualXFB()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int FramebufferManagerBase::ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width)
|
||||
{
|
||||
if (g_ActiveConfig.RealXFBEnabled())
|
||||
return width;
|
||||
|
||||
if (g_ActiveConfig.b3DVision)
|
||||
{
|
||||
// This works, yet the version in the else doesn't. No idea why.
|
||||
return width * (backbuffer_width-1) / (FramebufferManagerBase::LastXfbWidth()-1);
|
||||
}
|
||||
else
|
||||
return width * (Renderer::GetTargetRectangle().GetWidth() - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1);
|
||||
}
|
||||
|
||||
unsigned int FramebufferManagerBase::ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height)
|
||||
{
|
||||
if (g_ActiveConfig.RealXFBEnabled())
|
||||
return height;
|
||||
|
||||
if (g_ActiveConfig.b3DVision)
|
||||
{
|
||||
// This works, yet the version in the else doesn't. No idea why.
|
||||
return height * (backbuffer_height-1) / (FramebufferManagerBase::LastXfbHeight()-1);
|
||||
}
|
||||
else
|
||||
return height * (Renderer::GetTargetRectangle().GetHeight() - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1);
|
||||
}
|
||||
|
@ -55,6 +55,9 @@ public:
|
||||
static unsigned int LastXfbWidth() { return s_last_xfb_width; }
|
||||
static unsigned int LastXfbHeight() { return s_last_xfb_height; }
|
||||
|
||||
static unsigned int ScaleToVirtualXfbWidth(unsigned int width, unsigned int backbuffer_width);
|
||||
static unsigned int ScaleToVirtualXfbHeight(unsigned int height, unsigned int backbuffer_height);
|
||||
|
||||
protected:
|
||||
struct VirtualXFB
|
||||
{
|
||||
|
@ -67,10 +67,6 @@ int Renderer::s_target_height;
|
||||
int Renderer::s_backbuffer_width;
|
||||
int Renderer::s_backbuffer_height;
|
||||
|
||||
// ratio of backbuffer size and render area size
|
||||
float Renderer::xScale;
|
||||
float Renderer::yScale;
|
||||
|
||||
TargetRectangle Renderer::target_rc;
|
||||
|
||||
int Renderer::s_LastEFBScale;
|
||||
@ -165,19 +161,23 @@ void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
|
||||
}
|
||||
|
||||
// return true if target size changed
|
||||
bool Renderer::CalculateTargetSize(int multiplier)
|
||||
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier)
|
||||
{
|
||||
int newEFBWidth, newEFBHeight;
|
||||
switch (s_LastEFBScale)
|
||||
{
|
||||
case 0: // fractional
|
||||
newEFBWidth = (int)(EFB_WIDTH * xScale);
|
||||
newEFBHeight = (int)(EFB_HEIGHT * yScale);
|
||||
break;
|
||||
case 1: // integral
|
||||
newEFBWidth = EFB_WIDTH * (int)ceilf(xScale);
|
||||
newEFBHeight = EFB_HEIGHT * (int)ceilf(yScale);
|
||||
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, framebuffer_width);
|
||||
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, framebuffer_height);
|
||||
|
||||
if (s_LastEFBScale)
|
||||
{
|
||||
newEFBWidth = ((newEFBWidth-1) / EFB_WIDTH + 1) * EFB_WIDTH;
|
||||
newEFBHeight = ((newEFBHeight-1) / EFB_HEIGHT + 1) * EFB_HEIGHT;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight);
|
||||
break;
|
||||
@ -310,29 +310,6 @@ void Renderer::DrawDebugText()
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
|
||||
{
|
||||
if (g_ActiveConfig.RealXFBEnabled())
|
||||
{
|
||||
xScale = 1.0f;
|
||||
yScale = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_ActiveConfig.b3DVision)
|
||||
{
|
||||
// This works, yet the version in the else doesn't. No idea why.
|
||||
xScale = (float)(s_backbuffer_width-1) / (float)(FramebufferManagerBase::LastXfbWidth()-1);
|
||||
yScale = (float)(s_backbuffer_height-1) / (float)(FramebufferManagerBase::LastXfbHeight()-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(FramebufferManagerBase::LastXfbWidth()-1);
|
||||
yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(FramebufferManagerBase::LastXfbHeight()-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
extern bool g_aspect_wide;
|
||||
|
||||
|
@ -74,10 +74,6 @@ public:
|
||||
static int GetBackbufferWidth() { return s_backbuffer_width; }
|
||||
static int GetBackbufferHeight() { return s_backbuffer_height; }
|
||||
|
||||
// XFB scale - TODO: Remove this and add two XFBToScaled functions instead
|
||||
static float GetXFBScaleX() { return xScale; }
|
||||
static float GetXFBScaleY() { return yScale; }
|
||||
|
||||
static void SetWindowSize(int width, int height);
|
||||
|
||||
// EFB coordinate conversion functions
|
||||
@ -137,8 +133,7 @@ public:
|
||||
protected:
|
||||
|
||||
static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY);
|
||||
static bool CalculateTargetSize(int multiplier = 1);
|
||||
static void CalculateXYScale(const TargetRectangle& dst_rect);
|
||||
static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1);
|
||||
|
||||
static void CheckFifoRecording();
|
||||
static void RecordVideoMemory();
|
||||
@ -163,10 +158,6 @@ protected:
|
||||
static int s_backbuffer_width;
|
||||
static int s_backbuffer_height;
|
||||
|
||||
// ratio of backbuffer size and render area size - TODO: Remove these!
|
||||
static float xScale;
|
||||
static float yScale;
|
||||
|
||||
static TargetRectangle target_rc;
|
||||
|
||||
// can probably eliminate this static var
|
||||
|
Reference in New Issue
Block a user