static void _cairo_polygon_add_edge (cairo_polygon_t *polygon, const cairo_point_t *p1, const cairo_point_t *p2) { cairo_edge_t *edge; /* drop horizontal edges */ if (p1->y == p2->y) goto DONE; if (polygon->num_edges == polygon->edges_size) { if (! _cairo_polygon_grow (polygon)) return; } edge = &polygon->edges[polygon->num_edges++]; if (p1->y < p2->y) { edge->edge.p1 = *p1; edge->edge.p2 = *p2; edge->clockWise = 1; } else { edge->edge.p1 = *p2; edge->edge.p2 = *p1; edge->clockWise = 0; } DONE: _cairo_polygon_move_to (polygon, p2); }
void _cairo_polygon_add_edge (cairo_polygon_t *polygon, const cairo_point_t *p1, const cairo_point_t *p2, int dir) { cairo_edge_t *edge; /* drop horizontal edges */ if (p1->y == p2->y) return; if (polygon->num_edges == polygon->edges_size) { if (! _cairo_polygon_grow (polygon)) return; } edge = &polygon->edges[polygon->num_edges++]; if (p1->y < p2->y) { edge->edge.p1 = *p1; edge->edge.p2 = *p2; edge->dir = dir; } else { edge->edge.p1 = *p2; edge->edge.p2 = *p1; edge->dir = -dir; } }
static void _add_edge (cairo_polygon_t *polygon, const cairo_point_t *p1, const cairo_point_t *p2, int top, int bottom, int dir) { cairo_edge_t *edge; XASSERT (top < bottom); if (unlikely (polygon->num_edges == polygon->edges_size)) { if (! _cairo_polygon_grow (polygon)) return; } edge = &polygon->edges[polygon->num_edges++]; edge->line.p1 = *p1; edge->line.p2 = *p2; edge->top = top; edge->bottom = bottom; edge->dir = dir; if (top < polygon->extents.p1.y) polygon->extents.p1.y = top; if (bottom > polygon->extents.p2.y) polygon->extents.p2.y = bottom; if (p1->x < polygon->extents.p1.x || p1->x > polygon->extents.p2.x) { cairo_fixed_t x = p1->x; if (top != p1->y) x = _cairo_edge_compute_intersection_x_for_y (p1, p2, top); if (x < polygon->extents.p1.x) polygon->extents.p1.x = x; if (x > polygon->extents.p2.x) polygon->extents.p2.x = x; } if (p2->x < polygon->extents.p1.x || p2->x > polygon->extents.p2.x) { cairo_fixed_t x = p2->x; if (bottom != p2->y) x = _cairo_edge_compute_intersection_x_for_y (p1, p2, bottom); if (x < polygon->extents.p1.x) polygon->extents.p1.x = x; if (x > polygon->extents.p2.x) polygon->extents.p2.x = x; } }