Deheapify active edges

This commit is contained in:
Patrick Walton 2018-12-20 21:04:48 -08:00
parent 4d692759a9
commit 4360bf6f13
1 changed files with 4 additions and 5 deletions

View File

@ -1024,7 +1024,7 @@ impl<'o, 'p> Tiler<'o, 'p> {
let mut strip_tiles = Vec::with_capacity(tiles_across); let mut strip_tiles = Vec::with_capacity(tiles_across);
let mut used_strip_tiles = FixedBitSet::with_capacity(tiles_across); let mut used_strip_tiles = FixedBitSet::with_capacity(tiles_across);
let mut new_active_edges = SortedVector::new(); let mut old_active_edges = vec![];
// Generate strips. // Generate strips.
while strip_origin.y < bounds.max_y() { while strip_origin.y < bounds.max_y() {
@ -1056,8 +1056,8 @@ impl<'o, 'p> Tiler<'o, 'p> {
// Process old active edges. // Process old active edges.
let (mut strip_tile_index, mut current_left) = (0, strip_bounds.origin.x); let (mut strip_tile_index, mut current_left) = (0, strip_bounds.origin.x);
let mut winding = 0; let mut winding = 0;
debug_assert!(new_active_edges.is_empty()); mem::swap(&mut old_active_edges, &mut self.active_edges.array);
while let Some(mut active_edge) = self.active_edges.pop() { for mut active_edge in old_active_edges.drain(..) {
// Move over to the correct tile, filling in as we go. // Move over to the correct tile, filling in as we go.
// FIXME(pcwalton): Do subtile fills!! // FIXME(pcwalton): Do subtile fills!!
let mut tile_left = strip_bounds.origin.x + (strip_tile_index as f32) * TILE_WIDTH; let mut tile_left = strip_bounds.origin.x + (strip_tile_index as f32) * TILE_WIDTH;
@ -1101,10 +1101,9 @@ impl<'o, 'p> Tiler<'o, 'p> {
&mut used_strip_tiles); &mut used_strip_tiles);
if !active_edge.segment.is_none() { if !active_edge.segment.is_none() {
new_active_edges.push(active_edge); self.active_edges.push(active_edge);
} }
} }
mem::swap(&mut self.active_edges, &mut new_active_edges);
/* /*
// Sort point queue. // Sort point queue.