Beispiel #1
0
bool SkOpAngle::lengthen() {
    int newEnd = fEnd;
    if (fStart < fEnd ? ++newEnd < fSpans->count() : --newEnd >= 0) {
        fEnd = newEnd;
        setSpans();
        return true;
    }
    return false;
}
Beispiel #2
0
void SkOpAngle::set(const SkOpSegment* segment, int start, int end) {
    fSegment = segment;
    fStart = start;
    fComputedEnd = fEnd = end;
    fNext = NULL;
    fComputeSector = fComputedSector = false;
    fStop = false;
    setSpans();
    setSector();
}
Beispiel #3
0
void SkOpAngle::set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment,
        int start, int end, const SkTDArray<SkOpSpan>& spans) {
    fSegment = segment;
    fStart = start;
    fEnd = end;
    fPts = orig;
    fVerb = verb;
    fSpans = &spans;
    fReversed = false;
    fUnsortable = false;
    setSpans();
}
Beispiel #4
0
bool SkOpAngle::reverseLengthen() {
    if (fReversed) {
        return false;
    }
    int newEnd = fStart;
    if (fStart > fEnd ? ++newEnd < fSpans->count() : --newEnd >= 0) {
        fEnd = newEnd;
        fReversed = true;
        setSpans();
        return true;
    }
    return false;
}
Beispiel #5
0
// the original angle is too short to get meaningful sector information
// lengthen it until it is long enough to be meaningful or leave it unset if lengthening it
// would cause it to intersect one of the adjacent angles
bool SkOpAngle::computeSector() {
    if (fComputedSector) {
        // FIXME: logically, this should return !fUnorderable, but doing so breaks testQuadratic51
        // -- but in general, this code may not work so this may be the least of problems
        // adding the bang fixes testQuads46x in release, however
        return !fUnorderable;
    }
    SkASSERT(fSegment->verb() != SkPath::kLine_Verb && small());
    fComputedSector = true;
    int step = fStart < fEnd ? 1 : -1;
    int limit = step > 0 ? fSegment->count() : -1;
    int checkEnd = fEnd;
    do {
// advance end
        const SkOpSpan& span = fSegment->span(checkEnd);
        const SkOpSegment* other = span.fOther;
        int oCount = other->count();
        for (int oIndex = 0; oIndex < oCount; ++oIndex) {
            const SkOpSpan& oSpan = other->span(oIndex);
            if (oSpan.fOther != fSegment) {
                continue;
            }
            if (oSpan.fOtherIndex == checkEnd) {
                continue;
            }
            if (!approximately_equal(oSpan.fOtherT, span.fT)) {
                continue;
            }
            goto recomputeSector;
        }
        checkEnd += step;
    } while (checkEnd != limit);
recomputeSector:
    if (checkEnd == fEnd || checkEnd - step == fEnd) {
        fUnorderable = true;
        return false;
    }
    int saveEnd = fEnd;
    fComputedEnd = fEnd = checkEnd - step;
    setSpans();
    setSector();
    fEnd = saveEnd;
    return !fUnorderable;
}