Exemplo n.º 1
0
void AddSelfIntersectTs(SkOpContour* test) {
    SkIntersectionHelper wt;
    wt.init(test);
    do {
        if (wt.segmentType() != SkIntersectionHelper::kCubic_Segment) {
            continue;
        }
        SkIntersections ts;
        int pts = ts.cubic(wt.pts());
        debugShowCubicIntersection(pts, wt, ts);
        if (!pts) {
            continue;
        }
        SkASSERT(pts == 1);
        SkASSERT(ts[0][0] >= 0 && ts[0][0] <= 1);
        SkASSERT(ts[1][0] >= 0 && ts[1][0] <= 1);
        SkPoint point = ts.pt(0).asSkPoint();
        int testTAt = wt.addSelfT(wt, point, ts[0][0]);
        int nextTAt = wt.addT(wt, point, ts[1][0]);
        wt.addOtherT(testTAt, ts[1][0], nextTAt);
        wt.addOtherT(nextTAt, ts[0][0], testTAt);
    } while (wt.advance());
}