Skip to content

Commit

Permalink
tessellator bug fix: fill-degenerate-sort-order
Browse files Browse the repository at this point in the history
Fixes the regression fill-degenerate-sort-order, where
confusion arises in the event order for collinear edges.
Also fixes (or at least hides) the issues with zrusin-another
sometimes generating different trapezoids depending on the
state of the random number generator in cairo-skiplist.c.
  • Loading branch information
M Joonas Pihlaja committed Dec 6, 2006
1 parent 48b42ef commit 614117e
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions src/cairo-bentley-ottmann.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,20 @@ cairo_bo_event_compare (cairo_bo_event_t const *a,
return - cmp;
}

/* As a final discrimination, look at the opposite point. This
* leaves ambiguities only for identical edges.
*/
if (a->type == CAIRO_BO_EVENT_TYPE_START)
return _cairo_bo_point32_compare (&b->e1->bottom,
&a->e1->bottom);
else if (a->type == CAIRO_BO_EVENT_TYPE_STOP)
return _cairo_bo_point32_compare (&a->e1->top,
&b->e1->top);
/* Next look at the opposite point. This leaves ambiguities only
* for identical edges. */
if (a->type == CAIRO_BO_EVENT_TYPE_START) {
cmp = _cairo_bo_point32_compare (&b->e1->bottom,
&a->e1->bottom);
if (cmp)
return cmp;
}
else if (a->type == CAIRO_BO_EVENT_TYPE_STOP) {
cmp = _cairo_bo_point32_compare (&a->e1->top,
&b->e1->top);
if (cmp)
return cmp;
}
else { /* CAIRO_BO_EVENT_TYPE_INTERSECT */
/* For two intersection events at the identical point, we
* don't care what order they sort in, but we do care that we
Expand All @@ -416,8 +421,21 @@ cairo_bo_event_compare (cairo_bo_event_t const *a,
cmp = _cairo_bo_point32_compare (&a->e1->top, &b->e1->top);
if (cmp)
return cmp;
return _cairo_bo_point32_compare (&a->e1->bottom, &b->e1->bottom);
}
cmp = _cairo_bo_point32_compare (&a->e1->bottom, &b->e1->bottom);
if (cmp)
return cmp;
}

/* Discrimination based on the edge pointers. */
if (a->e1 < b->e1)
return -1;
if (a->e1 > b->e1)
return +1;
if (a->e2 < b->e2)
return -1;
if (a->e2 > b->e2)
return +1;
return 0;
}

static inline int
Expand Down

0 comments on commit 614117e

Please sign in to comment.