From a95170d78900fb42b46d01a01fe39090987d00d2 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 14 May 2017 14:15:59 -0700 Subject: [PATCH] SoftGPU: Bias bottom right side of line drawing. Fixes lines in Persona 2. --- GPU/Software/Rasterizer.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 8d514fdc4c..20b63d4775 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -15,6 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include +#include + #include "base/basictypes.h" #include "profiler/profiler.h" @@ -29,8 +32,6 @@ #include "GPU/Software/SoftGpu.h" #include "GPU/Software/Rasterizer.h" -#include - #if defined(_M_SSE) #include #endif @@ -1650,11 +1651,11 @@ void DrawLine(const VertexData &v0, const VertexData &v1) } } - float x = a.x; - float y = a.y; + float x = a.x > b.x ? a.x - 1 : a.x; + float y = a.y > b.y ? a.y - 1 : a.y; float z = a.z; const int steps1 = steps == 0 ? 1 : steps; - for (int i = 0; i <= steps; i++) { + for (int i = 0; i < steps; i++) { if (x >= scissorTL.x && y >= scissorTL.y && x <= scissorBR.x && y <= scissorBR.y) { // Interpolate between the two points. Vec4 prim_color; @@ -1691,7 +1692,7 @@ void DrawLine(const VertexData &v0, const VertexData &v1) if (!clearMode) prim_color += Vec4(sec_color, 0); - ScreenCoords pprime = ScreenCoords(x, y, z); + ScreenCoords pprime = ScreenCoords((int)x, (int)y, (int)z); DrawingCoords p = TransformUnit::ScreenToDrawing(pprime); if (clearMode) {