minor clean-ups, comments

This commit is contained in:
Brian
2007-12-10 16:18:24 -07:00
parent 0a79c65073
commit 5d41a71392

View File

@@ -47,11 +47,11 @@
* Triangle edge info * Triangle edge info
*/ */
struct edge { struct edge {
float dx; /**< X(v1) - X(v0), used only during setup */ float dx; /**< X(v1) - X(v0), used only during setup */
float dy; /**< Y(v1) - Y(v0), used only during setup */ float dy; /**< Y(v1) - Y(v0), used only during setup */
float dxdy; /**< dx/dy */ float dxdy; /**< dx/dy */
float sx, sy; /**< first sample point coord */ float sx, sy; /**< first sample point coord */
int lines; /**< number of lines on this edge */ int lines; /**< number of lines on this edge */
}; };
@@ -178,10 +178,9 @@ static INLINE int block( int x )
* this is pretty nasty... may need to rework flush_spans again to * this is pretty nasty... may need to rework flush_spans again to
* fix it, if possible. * fix it, if possible.
*/ */
static unsigned calculate_mask( struct setup_stage *setup, static unsigned calculate_mask( struct setup_stage *setup, int x )
int x )
{ {
unsigned mask = 0; unsigned mask = 0x0;
if (x >= setup->span.left[0] && x < setup->span.right[0]) if (x >= setup->span.left[0] && x < setup->span.right[0])
mask |= MASK_TOP_LEFT; mask |= MASK_TOP_LEFT;
@@ -208,17 +207,20 @@ static void flush_spans( struct setup_stage *setup )
int x; int x;
switch (setup->span.y_flags) { switch (setup->span.y_flags) {
case 3: case 0x3:
/* both odd and even lines written (both quad rows) */
minleft = MIN2(setup->span.left[0], setup->span.left[1]); minleft = MIN2(setup->span.left[0], setup->span.left[1]);
maxright = MAX2(setup->span.right[0], setup->span.right[1]); maxright = MAX2(setup->span.right[0], setup->span.right[1]);
break; break;
case 1: case 0x1:
/* only even line written (quad top row) */
minleft = setup->span.left[0]; minleft = setup->span.left[0];
maxright = setup->span.right[0]; maxright = setup->span.right[0];
break; break;
case 2: case 0x2:
/* only odd line written (quad bottom row) */
minleft = setup->span.left[1]; minleft = setup->span.left[1];
maxright = setup->span.right[1]; maxright = setup->span.right[1];
break; break;
@@ -227,12 +229,12 @@ static void flush_spans( struct setup_stage *setup )
return; return;
} }
/* XXX this loop could be moved into the above switch cases and
for (x = block(minleft); x <= block(maxright); ) * calculate_mask() could be simplified a bit...
{ */
for (x = block(minleft); x <= block(maxright); x += 2) {
emit_quad( setup, x, setup->span.y, emit_quad( setup, x, setup->span.y,
calculate_mask( setup, x ) ); calculate_mask( setup, x ) );
x += 2;
} }
setup->span.y = 0; setup->span.y = 0;
@@ -593,7 +595,8 @@ static void subtriangle( struct setup_stage *setup,
setup->span.y = block(_y); setup->span.y = block(_y);
} }
setup->span.left[_y&1] = left;setup->span.right[_y&1] = right; setup->span.left[_y&1] = left;
setup->span.right[_y&1] = right;
setup->span.y_flags |= 1<<(_y&1); setup->span.y_flags |= 1<<(_y&1);
} }
} }