Fix some off-by-one errors in the EFB scaling stuff.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6559 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX 2010-12-11 21:07:07 +00:00
parent c7b736bb56
commit 3b6b8b718c
2 changed files with 8 additions and 8 deletions

View File

@ -262,13 +262,13 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
if (g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
xScale = (float)s_backbuffer_width / (float)s_XFB_width;
yScale = (float)s_backbuffer_height / (float)s_XFB_height;
xScale = (float)(s_backbuffer_width-1) / (float)(s_XFB_width-1);
yScale = (float)(s_backbuffer_height-1) / (float)(s_XFB_height-1);
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(s_XFB_width-1);
yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(s_XFB_height-1);
}
}
}

View File

@ -90,12 +90,12 @@ public:
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
// Use this to upscale native EFB coordinates to IDEAL internal resolution
static int EFBToScaledX(int x) { return x * GetTargetWidth() / EFB_WIDTH; }
static int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; }
static int EFBToScaledX(int x) { return x * (GetTargetWidth()-1) / (EFB_WIDTH-1); }
static int EFBToScaledY(int y) { return y * (GetTargetHeight()-1) / (EFB_HEIGHT-1); }
// Floating point versions of the above - only use them if really necessary
static float EFBToScaledXf(float x) { return x * (float)GetTargetWidth() / (float)EFB_WIDTH; }
static float EFBToScaledYf(float y) { return y * (float)GetTargetHeight() / (float)EFB_HEIGHT; }
static float EFBToScaledXf(float x) { return x * (float)(GetTargetWidth()-1) / (float)(EFB_WIDTH-1); }
static float EFBToScaledYf(float y) { return y * (float)(GetTargetHeight()-1) / (float)(EFB_HEIGHT-1); }
// Returns the offset at which the EFB will be drawn onto the backbuffer
// NOTE: Never calculate this manually (e.g. to "increase accuracy"), since you might end up getting off-by-one errors.