From e6f4072495b61ad37adfe0d02505c21672f6cdae Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 21 Dec 2018 14:35:19 -0800 Subject: [PATCH] Fixes --- utils/tile-svg/src/main.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/utils/tile-svg/src/main.rs b/utils/tile-svg/src/main.rs index 9f1b0f7d..8ce21cf4 100644 --- a/utils/tile-svg/src/main.rs +++ b/utils/tile-svg/src/main.rs @@ -982,9 +982,11 @@ impl<'o, 'p> Tiler<'o, 'p> { self.active_edges.clear(); - let mut strip_origin = - Point2D::new(f32::floor(bounds.origin.x / TILE_WIDTH) * TILE_WIDTH, - f32::floor(bounds.origin.y / TILE_HEIGHT) * TILE_HEIGHT); + let outline_tile_origin = Point2D::new(f32::floor(bounds.origin.x / TILE_WIDTH) as i16, + f32::floor(bounds.origin.y / TILE_HEIGHT) as i16); + + let mut strip_origin = Point2D::new(outline_tile_origin.x as f32 * TILE_WIDTH, + outline_tile_origin.y as f32 * TILE_HEIGHT); let strip_right_extent = f32::ceil(bounds.max_x() / TILE_WIDTH) * TILE_WIDTH; let tiles_across = ((strip_right_extent - strip_origin.x) / TILE_WIDTH) as usize; @@ -1006,7 +1008,7 @@ impl<'o, 'p> Tiler<'o, 'p> { strip_extent.y - strip_origin.y)); // Generate strip. - self.generate_strip(&strip_bounds, tile_index_y, tiles_across); + self.generate_strip(&strip_bounds, tile_index_y, tiles_across, &outline_tile_origin); strip_origin.y = strip_extent.y; tile_index_y += 1; @@ -1017,7 +1019,8 @@ impl<'o, 'p> Tiler<'o, 'p> { fn generate_strip(&mut self, strip_bounds: &Rect, tile_index_y: i16, - tiles_across: usize) { + tiles_across: usize, + outline_tile_origin: &Point2D) { // We can skip a bunch of steps if we're above the viewport. let above_view_box = tile_index_y < 0; @@ -1028,8 +1031,9 @@ impl<'o, 'p> Tiler<'o, 'p> { // Allocate tiles. for tile_index_x in 0..tiles_across { - self.strip_tiles - .push(MaskTilePrimitive::new(tile_index_x as i16, tile_index_y, self.fill_color)); + let tile_x = outline_tile_origin.x + tile_index_x as i16; + let tile_y = outline_tile_origin.y + tile_index_y; + self.strip_tiles.push(MaskTilePrimitive::new(tile_x, tile_y, self.fill_color)); } // Process old active edges.