diff options
author | Søren Sandmann Pedersen <ssp@l3000.localdomain> | 2010-12-20 23:31:41 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@l3000.localdomain> | 2010-12-20 23:31:41 -0500 |
commit | 5b55e4ff23bf00a08222858b3b83e487de747e8f (patch) | |
tree | cf748c6e5ef781e7e1a308b1a24fd302fbe12bfa | |
parent | 7a2c00752d5c716dfd6c9fcd66e864e62c79ec92 (diff) |
Rasterize loop
-rw-r--r-- | poly3.c | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -219,12 +219,11 @@ long_edge_update_error (long_edge_t *edge) edge->e -= edge->delta_e_big_x; edge->common.xi -= fixed_1; edge->common.xi |= (N_GRID_X - 1); - goto small; + goto begin; } } else { - small: if (edge->e > edge->delta_e_small_x) { edge->e -= edge->delta_e_small_x; @@ -407,6 +406,37 @@ static void polygon_rasterize (polygon_t *polygon, int x, int y, int width, int height) { global_t *global = create_global (polygon, x, y, width, height); + active_t *active = create_active (global); + sample_t yi = y << FIXED_BITS; + sample_t end = (y + height) << FIXED_BITS; + + while (yi < end) + { + int i, j; + + for (i = 0; i < N_GRID_Y - 1; ++i) + { + active = update_active (active, yi); + + for (j = 0; j < active->n_edges; ++j) + { + /* emit yi, edge->xi */ + /* step_small (edge); */ + } + + yi++; + } + + active = update_active (active, yi); + + for (j = 0; j < active->n_edges; ++j) + { + /* emit ((y | (N_GRID_Y - 1), edge->xi), */ + /* step_big (edge); */ + } + + yi = fixed_floor (yi + fixed_1); + } } int |