diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index 2fd7a9ecdf..1237af7c55 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -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); } } } diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 0e8111cafb..9d22073e20 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -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.