aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfxvideo/soft.c
diff options
context:
space:
mode:
authornotaz2011-09-27 23:13:08 +0300
committernotaz2011-09-27 23:13:08 +0300
commit22ea665be74b8bc9e916f2d617a714281018f262 (patch)
tree7351e87c70652042a0bcfbaf2e03b48cd84fea9f /plugins/dfxvideo/soft.c
parent61ef5cf48ec7019f10f83017667e681ff8288509 (diff)
downloadpcsx_rearmed-22ea665be74b8bc9e916f2d617a714281018f262.tar.gz
pcsx_rearmed-22ea665be74b8bc9e916f2d617a714281018f262.tar.bz2
pcsx_rearmed-22ea665be74b8bc9e916f2d617a714281018f262.zip
dfxvideo: remove unneeded double division in line code
Diffstat (limited to 'plugins/dfxvideo/soft.c')
-rw-r--r--plugins/dfxvideo/soft.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/plugins/dfxvideo/soft.c b/plugins/dfxvideo/soft.c
index 160b0c4..c1c3bef 100644
--- a/plugins/dfxvideo/soft.c
+++ b/plugins/dfxvideo/soft.c
@@ -7092,7 +7092,7 @@ static void DrawSoftwareLineShade(int32_t rgb0, int32_t rgb1)
{
short x0, y0, x1, y1, xt, yt;
int32_t rgbt;
- double m, dy, dx;
+ int dy, dx;
if (lx0 > drawW && lx1 > drawW) return;
if (ly0 > drawH && ly1 > drawH) return;
@@ -7142,17 +7142,15 @@ static void DrawSoftwareLineShade(int32_t rgb0, int32_t rgb1)
dy = y1 - y0;
}
- m = dy / dx;
-
- if (m >= 0)
+ if ((dx >= 0 && dy >= 0) || (dx < 0 && dy < 0))
{
- if (m > 1)
+ if (abs(dy) > abs(dx))
Line_S_SE_Shade(x0, y0, x1, y1, rgb0, rgb1);
else
Line_E_SE_Shade(x0, y0, x1, y1, rgb0, rgb1);
}
else
- if (m < -1)
+ if (abs(dy) > abs(dx))
Line_N_NE_Shade(x0, y0, x1, y1, rgb0, rgb1);
else
Line_E_NE_Shade(x0, y0, x1, y1, rgb0, rgb1);
@@ -7164,7 +7162,7 @@ static void DrawSoftwareLineShade(int32_t rgb0, int32_t rgb1)
static void DrawSoftwareLineFlat(int32_t rgb)
{
short x0, y0, x1, y1, xt, yt;
- double m, dy, dx;
+ int dy, dx;
unsigned short colour = 0;
if (lx0 > drawW && lx1 > drawW) return;
@@ -7216,17 +7214,15 @@ static void DrawSoftwareLineFlat(int32_t rgb)
dy = y1 - y0;
}
- m = dy/dx;
-
- if (m >= 0)
+ if ((dx >= 0 && dy >= 0) || (dx < 0 && dy < 0))
{
- if (m > 1)
+ if (abs(dy) > abs(dx))
Line_S_SE_Flat(x0, y0, x1, y1, colour);
else
Line_E_SE_Flat(x0, y0, x1, y1, colour);
}
else
- if (m < -1)
+ if (abs(dy) > abs(dx))
Line_N_NE_Flat(x0, y0, x1, y1, colour);
else
Line_E_NE_Flat(x0, y0, x1, y1, colour);