polygon: Extend intersection edges to cover entire range

By simply swapping the continuation edges, we end up with a set of edges
that are defined over a shorter range than their extents. Whilst this is
numerically stable at our normal precision we start to encounter issues
when using a coarser grid during rasterisation as the derivative of the
edge becomes unstable.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44722
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-02-09 19:40:26 +00:00
parent a349a312dc
commit 658fa75a5c

View file

@ -1179,8 +1179,17 @@ edges_start_or_continue (cairo_bo_edge_t *left,
if (left->deferred.other != NULL) {
if (right != NULL && edges_colinear (left->deferred.other, right)) {
/* continuation on right, so just swap edges */
assert (left->deferred.other->deferred.other == NULL);
cairo_bo_edge_t *old = left->deferred.other;
/* continuation on right, extend right to cover both */
assert (old->deferred.other == NULL);
assert (old->edge.dir == right->edge.dir);
assert (old->edge.line.p2.y > old->edge.line.p1.y);
if (old->edge.line.p1.y < right->edge.line.p1.y)
right->edge.line.p1 = old->edge.line.p1;
if (old->edge.line.p2.y > right->edge.line.p2.y)
right->edge.line.p2 = old->edge.line.p2;
left->deferred.other = right;
return;
}