summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@l3000.localdomain>2010-12-06 21:37:34 -0500
committerSøren Sandmann Pedersen <ssp@l3000.localdomain>2010-12-20 10:48:51 -0500
commit7ae923df85bf5090d037f001bd456c6e87dea971 (patch)
treec384c1cb05c2ea3e9a8aed121f579f379506c1dc
parent7af990c50728123b969a13ccbacc7f2c829d412d (diff)
Move next_sample_y() out of loop
-rw-r--r--dda.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dda.c b/dda.c
index e6fe822..033be52 100644
--- a/dda.c
+++ b/dda.c
@@ -86,6 +86,7 @@ dda (test_data_t *testdata)
double dy = (y1 - y0);
int yi = next_sample_y (y0);
int xi = next_sample_x (x0);
+ int bottom = next_sample_y (y1);
double e = (sample_to_pos (xi) - x0) * dy - (sample_to_pos (yi) - y0) * dx;
double delta_e_big_x, delta_e_big_y;
double delta_e_small_x, delta_e_small_y;
@@ -95,7 +96,7 @@ dda (test_data_t *testdata)
delta_e_big_y = BIG_STEP_Y * dx;
delta_e_small_y = SMALL_STEP_Y * dx;
- while (yi < next_sample_y (y1))
+ while (yi < bottom)
{
if (dx >= 0)
{
@@ -166,9 +167,7 @@ main ()
{
int i;
for (i = 0; i < sizeof testdata / sizeof testdata[0]; ++i)
- {
dda (&(testdata[i]));
- }
return 0;
}