diff --git a/src/cairo-bentley-ottmann-rectangular.c b/src/cairo-bentley-ottmann-rectangular.c index 736762e0d..2cb01cb03 100644 --- a/src/cairo-bentley-ottmann-rectangular.c +++ b/src/cairo-bentley-ottmann-rectangular.c @@ -422,9 +422,6 @@ active_edges_to_traps (sweep_line_t *sweep, winding += right->dir; if (winding == 0) { - if (right->next == &sweep->tail) - break; - /* skip co-linear edges */ if (likely (right->x != right->next->x)) break; @@ -440,30 +437,31 @@ active_edges_to_traps (sweep_line_t *sweep, pos = right->next; } while (pos != &sweep->tail); } else { - edge_t *left, *right; do { - left = pos; - pos = left->next; - do { - right = pos; - pos = pos->next; + edge_t *right = pos->next; + int count = 0; - if (right->right != NULL) { + do { + /* End all subsumed traps */ + if (unlikely (right->right != NULL)) { edge_end_box (sweep, right, top, do_traps, container); } - if (pos == &sweep->tail) - break; + if (++count & 1) { + /* skip co-linear edges */ + if (likely (right->x != right->next->x)) + break; + } - /* skip co-linear edges */ - if (right->x != pos->x) - break; + right = right->next; } while (TRUE); edge_start_or_continue_box (sweep, - left, right, top, + pos, right, top, do_traps, container); + + pos = right->next; } while (pos != &sweep->tail); } @@ -717,7 +715,6 @@ _cairo_bentley_ottmann_tessellate_rectangular_traps (cairo_traps_t *traps, dump_traps (traps, "bo-rects-traps-out.txt"); - return status; }