1533 {
1534 TESS_LOG(
"\ntessellating simple polygons\n");
1536 Poly* polys =
nullptr;
1538 if (!v->isConnected()) {
1539 continue;
1540 }
1541#if TRIANGULATOR_LOGGING
1542 TESS_LOG(
"\nvertex %g: (%g,%g), alpha %d\n", v->fID, v->fPoint.fX, v->fPoint.fY, v->fAlpha);
1543#endif
1544 Edge* leftEnclosingEdge;
1545 Edge* rightEnclosingEdge;
1549 if (v->fFirstEdgeAbove) {
1550 leftPoly = v->fFirstEdgeAbove->fLeftPoly;
1551 rightPoly = v->fLastEdgeAbove->fRightPoly;
1552 } else {
1553 leftPoly = leftEnclosingEdge ? leftEnclosingEdge->fRightPoly : nullptr;
1554 rightPoly = rightEnclosingEdge ? rightEnclosingEdge->fLeftPoly : nullptr;
1555 }
1556#if TRIANGULATOR_LOGGING
1558 for (
Edge*
e = v->fFirstEdgeAbove;
e;
e =
e->fNextEdgeAbove) {
1559 TESS_LOG(
"%g -> %g, lpoly %d, rpoly %d\n",
1560 e->fTop->fID,
e->fBottom->fID,
1561 e->fLeftPoly ?
e->fLeftPoly->fID : -1,
1562 e->fRightPoly ?
e->fRightPoly->fID : -1);
1563 }
1565 for (
Edge*
e = v->fFirstEdgeBelow;
e;
e =
e->fNextEdgeBelow) {
1566 TESS_LOG(
"%g -> %g, lpoly %d, rpoly %d\n",
1567 e->fTop->fID,
e->fBottom->fID,
1568 e->fLeftPoly ?
e->fLeftPoly->fID : -1,
1569 e->fRightPoly ?
e->fRightPoly->fID : -1);
1570 }
1571#endif
1572 if (v->fFirstEdgeAbove) {
1573 if (leftPoly) {
1575 }
1576 if (rightPoly) {
1578 }
1579 for (
Edge*
e = v->fFirstEdgeAbove;
e != v->fLastEdgeAbove;
e =
e->fNextEdgeAbove) {
1580 Edge* rightEdge =
e->fNextEdgeAbove;
1582 if (
e->fRightPoly) {
1584 }
1585 if (rightEdge->fLeftPoly && rightEdge->fLeftPoly !=
e->fRightPoly) {
1587 }
1588 }
1589 activeEdges.
remove(v->fLastEdgeAbove);
1590 if (!v->fFirstEdgeBelow) {
1591 if (leftPoly && rightPoly && leftPoly != rightPoly) {
1595 }
1596 }
1597 }
1598 if (v->fFirstEdgeBelow) {
1599 if (!v->fFirstEdgeAbove) {
1600 if (leftPoly && rightPoly) {
1601 if (leftPoly == rightPoly) {
1605 leftEnclosingEdge->fRightPoly = leftPoly;
1606 } else {
1609 rightEnclosingEdge->fLeftPoly = rightPoly;
1610 }
1611 }
1615 }
1616 }
1617 Edge* leftEdge = v->fFirstEdgeBelow;
1618 leftEdge->fLeftPoly = leftPoly;
1619 activeEdges.
insert(leftEdge, leftEnclosingEdge);
1620 for (
Edge* rightEdge = leftEdge->fNextEdgeBelow; rightEdge;
1621 rightEdge = rightEdge->fNextEdgeBelow) {
1622 activeEdges.
insert(rightEdge, leftEdge);
1623 int winding = leftEdge->fLeftPoly ? leftEdge->fLeftPoly->fWinding : 0;
1624 winding += leftEdge->fWinding;
1625 if (winding != 0) {
1627 leftEdge->fRightPoly = rightEdge->fLeftPoly = poly;
1628 }
1629 leftEdge = rightEdge;
1630 }
1631 v->fLastEdgeBelow->fRightPoly = rightPoly;
1632 }
1633#if TRIANGULATOR_LOGGING
1635 for (
Edge*
e = activeEdges.
fHead;
e !=
nullptr;
e =
e->fRight) {
1636 TESS_LOG(
"%g -> %g, lpoly %d, rpoly %d\n",
1637 e->fTop->fID,
e->fBottom->fID,
1638 e->fLeftPoly ?
e->fLeftPoly->fID : -1,
1639 e->fRightPoly ?
e->fRightPoly->fID : -1);
1640 }
1641#endif
1642 }
1643 return { polys, true };
1644}
Poly * makePoly(Poly **head, Vertex *v, int winding) const
static SkString join(const CommandLineFlags::StringArray &)
Vertex * lastVertex() const
Poly * addEdge(Edge *e, Side side, GrTriangulator *)