Skip to content

Commit 9909e44

Browse files
authored
This avoids an edgecase where presumably some floating point rounding error results in predicting a `to_tile_coords` that isn't actually stepped on, causing the loop to loop forever.
1 parent 6ce65b2 commit 9909e44

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

renderer/src/tiler.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,16 @@ fn process_line_segment(line_segment: LineSegment2F,
287287
match next_step_direction {
288288
None => break,
289289
Some(StepDirection::X) => {
290+
if tile_coords.x() == to_tile_coords.x() {
291+
break;
292+
}
290293
t_max += vec2f(t_delta.x(), 0.0);
291294
tile_coords += vec2i(step.x(), 0);
292295
}
293296
Some(StepDirection::Y) => {
297+
if tile_coords.y() == to_tile_coords.y() {
298+
break;
299+
}
294300
t_max += vec2f(0.0, t_delta.y());
295301
tile_coords += vec2i(0, step.y());
296302
}

0 commit comments

Comments
 (0)