Bug 664930 - Handle the case where an edge lies at the left most coordinate and initialize the rest of the data; r=bjacob

This commit is contained in:
Jeff Muizelaar 2011-08-12 15:18:06 -04:00
parent 3ee8cbe0d0
commit c279653bd0

View File

@ -269,10 +269,17 @@ sweep_line_init (sweep_line_t *sweep_line,
sweep_line->head.right = NULL;
sweep_line->head.dir = 0;
sweep_line->head.next = &sweep_line->tail;
/* we need to initialize prev so that we can check
* if this edge is the left most and make sure
* we always insert to the right of it, even if
* our x coordinate matches */
sweep_line->head.prev = NULL;
sweep_line->tail.x = INT32_MAX;
sweep_line->tail.right = NULL;
sweep_line->tail.dir = 0;
sweep_line->tail.prev = &sweep_line->head;
sweep_line->tail.next = NULL;
sweep_line->insert_left = &sweep_line->tail;
sweep_line->insert_right = &sweep_line->tail;
@ -545,11 +552,19 @@ insert_edge (edge_t *edge, edge_t *pos)
} while (TRUE);
}
}
pos->prev->next = edge;
edge->prev = pos->prev;
edge->next = pos;
pos->prev = edge;
if (pos->prev) {
pos->prev->next = edge;
edge->prev = pos->prev;
edge->next = pos;
pos->prev = edge;
} else {
/* we have edge that shares an x coordinate with the left most sentinal.
* instead of inserting before pos and ruining our sentinal we insert after pos. */
pos->next->prev = edge;
edge->next = pos->next;
edge->prev = pos;
pos->next = edge;
}
}
static inline cairo_bool_t