remove dead code
Use code coverage and a new '-c' flag to find and remove unneeded code. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2397593002 patch from issue 2397593002 at patchset 1 (http://crrev.com/2397593002#ps1) Change-Id: I741a82de9191146c10457d4c0b9cb9605dff2069 Reviewed-on: https://skia-review.googlesource.com/2983 Reviewed-by: Cary Clark <caryclark@google.com>
This commit is contained in:
parent
85a45d93ed
commit
e47ae2998c
@ -635,17 +635,6 @@ void SkOpAngle::insert(SkOpAngle* angle) {
|
|||||||
}
|
}
|
||||||
last = next;
|
last = next;
|
||||||
next = next->fNext;
|
next = next->fNext;
|
||||||
if (last == this) {
|
|
||||||
if (next->fUnorderable) {
|
|
||||||
fUnorderable = true;
|
|
||||||
} else {
|
|
||||||
globalState()->setAngleCoincidence();
|
|
||||||
this->fNext = angle;
|
|
||||||
angle->fNext = next;
|
|
||||||
angle->fCheckCoincidence = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,26 +125,6 @@ bool SkCoincidentSpans::contains(const SkOpPtT* s, const SkOpPtT* e) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the number of segment span's contained by this, or -1 if inconsistent
|
|
||||||
int SkCoincidentSpans::spanCount() const {
|
|
||||||
// most commonly, concidence are one span long; check for that first
|
|
||||||
const SkOpSpanBase* start = coinPtTStart()->span();
|
|
||||||
const SkOpSpanBase* end = coinPtTEnd()->span();
|
|
||||||
int coinIntervals = 0;
|
|
||||||
while (start != end) {
|
|
||||||
coinIntervals++;
|
|
||||||
start = start->upCast()->next();
|
|
||||||
}
|
|
||||||
const SkOpSpanBase* oppStart = (flipped() ? oppPtTEnd() : oppPtTStart())->span();
|
|
||||||
const SkOpSpanBase* oppEnd = (flipped() ? oppPtTStart() : oppPtTEnd())->span();
|
|
||||||
int oppIntervals = 0;
|
|
||||||
while (oppStart != oppEnd) {
|
|
||||||
oppIntervals++;
|
|
||||||
oppStart = oppStart->upCast()->next();
|
|
||||||
}
|
|
||||||
return coinIntervals == oppIntervals ? coinIntervals : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// A coincident span is unordered if the pairs of points in the main and opposite curves'
|
// A coincident span is unordered if the pairs of points in the main and opposite curves'
|
||||||
// t values do not ascend or descend. For instance, if a tightly arced quadratic is
|
// t values do not ascend or descend. For instance, if a tightly arced quadratic is
|
||||||
// coincident with another curve, it may intersect it out of order.
|
// coincident with another curve, it may intersect it out of order.
|
||||||
@ -179,33 +159,6 @@ bool SkCoincidentSpans::ordered() const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if the point is on a coincident edge, and if it is the start of that edge
|
|
||||||
bool SkOpCoincidence::edge(const SkOpPtT* test, bool* start) const {
|
|
||||||
SkCoincidentSpans* coinRec = fHead;
|
|
||||||
if (!coinRec) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
if (coinRec->coinPtTStart() == test) {
|
|
||||||
*start = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (coinRec->coinPtTEnd() == test) {
|
|
||||||
*start = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (coinRec->oppPtTStart() == test) {
|
|
||||||
*start = !coinRec->flipped();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (coinRec->coinPtTEnd() == test) {
|
|
||||||
*start = coinRec->flipped();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} while ((coinRec = coinRec->next()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if there is an existing pair that overlaps the addition, extend it
|
// if there is an existing pair that overlaps the addition, extend it
|
||||||
bool SkOpCoincidence::extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
bool SkOpCoincidence::extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
||||||
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) {
|
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) {
|
||||||
@ -533,47 +486,6 @@ bool SkOpCoincidence::addExpanded(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks to see if coincidence has already been found
|
|
||||||
bool SkOpCoincidence::alreadyAdded(const SkCoincidentSpans* check, const SkCoincidentSpans* outer,
|
|
||||||
const SkOpPtT* over1s, const SkOpPtT* over1e) const {
|
|
||||||
do {
|
|
||||||
if (check->oppPtTStart() == outer->coinPtTStart() && check->coinPtTStart() == over1s
|
|
||||||
&& check->oppPtTEnd() == outer->coinPtTEnd() && check->coinPtTEnd() == over1e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (check->coinPtTStart() == outer->coinPtTStart() && check->oppPtTStart() == over1s
|
|
||||||
&& check->coinPtTEnd() == outer->coinPtTEnd() && check->oppPtTEnd() == over1e) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (check->startEquals(outer->oppPtTStart()->span(), over1s->span())) {
|
|
||||||
SkDEBUGCODE(check->debugStartCheck(outer->oppPtTEnd()->span(), over1e->span(),
|
|
||||||
fGlobalState));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (check->startEquals(over1s->span(), outer->coinPtTStart()->span())) {
|
|
||||||
SkDEBUGCODE(check->debugStartCheck(over1e->span(), outer->oppPtTEnd()->span(),
|
|
||||||
fGlobalState));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} while ((check = check->next()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Please keep this in sync with debugAddIfMissing() */
|
|
||||||
bool SkOpCoincidence::addIfMissing(const SkCoincidentSpans* outer, SkOpPtT* over1s,
|
|
||||||
SkOpPtT* over1e) {
|
|
||||||
SkASSERT(fTop);
|
|
||||||
if (this->alreadyAdded(fTop, outer, over1s, over1e)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fHead && this->alreadyAdded(fHead, outer, over1s, over1e)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this->add(outer->coinPtTStart(), outer->coinPtTEnd(), over1s, over1e);
|
|
||||||
this->debugValidate();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// given a t span, map the same range on the coincident span
|
// given a t span, map the same range on the coincident span
|
||||||
/*
|
/*
|
||||||
the curves may not scale linearly, so interpolation may only happen within known points
|
the curves may not scale linearly, so interpolation may only happen within known points
|
||||||
@ -928,55 +840,20 @@ bool SkOpCoincidence::addMissing(bool* added DEBUG_COIN_DECLARE_PARAMS()) {
|
|||||||
bool SkOpCoincidence::addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg1o,
|
bool SkOpCoincidence::addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg1o,
|
||||||
const SkOpSegment* seg2, const SkOpSegment* seg2o,
|
const SkOpSegment* seg2, const SkOpSegment* seg2o,
|
||||||
const SkOpPtT* overS, const SkOpPtT* overE) {
|
const SkOpPtT* overS, const SkOpPtT* overE) {
|
||||||
const SkOpPtT* s1, * e1, * s2, * e2;
|
const SkOpPtT* s1 = overS->find(seg1);
|
||||||
if (!(s1 = overS->find(seg1))) {
|
const SkOpPtT* e1 = overE->find(seg1);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(e1 = overE->find(seg1))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (s1 == e1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (approximately_equal_half(s1->fT, e1->fT)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!s1->starter(e1)->span()->upCast()->windValue()) {
|
if (!s1->starter(e1)->span()->upCast()->windValue()) {
|
||||||
if (!(s1 = overS->find(seg1o))) {
|
s1 = overS->find(seg1o);
|
||||||
return true;
|
e1 = overE->find(seg1o);
|
||||||
}
|
|
||||||
if (!(e1 = overE->find(seg1o))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (s1 == e1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!s1->starter(e1)->span()->upCast()->windValue()) {
|
if (!s1->starter(e1)->span()->upCast()->windValue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(s2 = overS->find(seg2))) {
|
const SkOpPtT* s2 = overS->find(seg2);
|
||||||
return true;
|
const SkOpPtT* e2 = overE->find(seg2);
|
||||||
}
|
|
||||||
if (!(e2 = overE->find(seg2))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (s2 == e2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (approximately_equal_half(s2->fT, e2->fT)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!s2->starter(e2)->span()->upCast()->windValue()) {
|
if (!s2->starter(e2)->span()->upCast()->windValue()) {
|
||||||
if (!(s2 = overS->find(seg2o))) {
|
s2 = overS->find(seg2o);
|
||||||
return true;
|
e2 = overE->find(seg2o);
|
||||||
}
|
|
||||||
if (!(e2 = overE->find(seg2o))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (s2 == e2) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!s2->starter(e2)->span()->upCast()->windValue()) {
|
if (!s2->starter(e2)->span()->upCast()->windValue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -992,59 +869,6 @@ bool SkOpCoincidence::addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* look for pairs of coincidence with no common segments
|
|
||||||
if there's no existing coincidence found that matches up the segments, and
|
|
||||||
if the pt-t list for one contains the other, create coincident pairs for what's left */
|
|
||||||
bool SkOpCoincidence::addUncommon() {
|
|
||||||
SkCoincidentSpans* outer = fHead;
|
|
||||||
if (!outer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
bool added = false;
|
|
||||||
fTop = outer;
|
|
||||||
fHead = nullptr;
|
|
||||||
do {
|
|
||||||
// addifmissing can modify the list that this is walking
|
|
||||||
// save head so that walker can iterate over old data unperturbed
|
|
||||||
// addifmissing adds to head freely then add saved head in the end
|
|
||||||
const SkOpSegment* outerCoin = outer->coinPtTStart()->segment();
|
|
||||||
const SkOpSegment* outerOpp = outer->oppPtTStart()->segment();
|
|
||||||
if (outerCoin->done() || outerOpp->done()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
SkCoincidentSpans* inner = outer;
|
|
||||||
while ((inner = inner->next())) {
|
|
||||||
this->debugValidate();
|
|
||||||
const SkOpSegment* innerCoin = inner->coinPtTStart()->segment();
|
|
||||||
const SkOpSegment* innerOpp = inner->oppPtTStart()->segment();
|
|
||||||
if (innerCoin->done() || innerOpp->done()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// check to see if outer span overlaps the inner span
|
|
||||||
// look for inner segment in pt-t list
|
|
||||||
// if present, and if t values are in coincident range
|
|
||||||
// add two pairs of new coincidence
|
|
||||||
const SkOpPtT* testS = outer->coinPtTStart()->contains(innerCoin);
|
|
||||||
const SkOpPtT* testE = outer->coinPtTEnd()->contains(innerCoin);
|
|
||||||
if (testS && testS->fT >= inner->coinPtTStart()->fT
|
|
||||||
&& testE && testE->fT <= inner->coinPtTEnd()->fT
|
|
||||||
&& this->testForCoincidence(outer, testS, testE)) {
|
|
||||||
added |= this->addIfMissing(outer, testS, testE);
|
|
||||||
} else {
|
|
||||||
testS = inner->coinPtTStart()->contains(outerCoin);
|
|
||||||
testE = inner->coinPtTEnd()->contains(outerCoin);
|
|
||||||
if (testS && testS->fT >= outer->coinPtTStart()->fT
|
|
||||||
&& testE && testE->fT <= outer->coinPtTEnd()->fT
|
|
||||||
&& this->testForCoincidence(inner, testS, testE)) {
|
|
||||||
added |= this->addIfMissing(inner, testS, testE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while ((outer = outer->next()));
|
|
||||||
this->restoreHead();
|
|
||||||
return added;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkOpCoincidence::contains(const SkOpSegment* seg, const SkOpSegment* opp, double oppT) const {
|
bool SkOpCoincidence::contains(const SkOpSegment* seg, const SkOpSegment* opp, double oppT) const {
|
||||||
if (this->contains(fHead, seg, opp, oppT)) {
|
if (this->contains(fHead, seg, opp, oppT)) {
|
||||||
return true;
|
return true;
|
||||||
@ -1128,11 +952,11 @@ void SkOpCoincidence::correctEnds(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// walk span sets in parallel, moving winding from one to the other
|
// walk span sets in parallel, moving winding from one to the other
|
||||||
bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
void SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
||||||
DEBUG_SET_PHASE();
|
DEBUG_SET_PHASE();
|
||||||
SkCoincidentSpans* coin = fHead;
|
SkCoincidentSpans* coin = fHead;
|
||||||
if (!coin) {
|
if (!coin) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
SkOpSpan* start = coin->coinPtTStartWritable()->span()->upCast();
|
SkOpSpan* start = coin->coinPtTStartWritable()->span()->upCast();
|
||||||
@ -1240,9 +1064,6 @@ bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
if (next == end) {
|
if (next == end) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!next->upCastable()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
start = next->upCast();
|
start = next->upCast();
|
||||||
// if the opposite ran out too soon, just reuse the last span
|
// if the opposite ran out too soon, just reuse the last span
|
||||||
if (!oNext || !oNext->upCastable()) {
|
if (!oNext || !oNext->upCastable()) {
|
||||||
@ -1251,7 +1072,6 @@ bool SkOpCoincidence::apply(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
oStart = oNext->upCast();
|
oStart = oNext->upCast();
|
||||||
} while (true);
|
} while (true);
|
||||||
} while ((coin = coin->next()));
|
} while ((coin = coin->next()));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please keep this in sync with debugRelease()
|
// Please keep this in sync with debugRelease()
|
||||||
@ -1356,7 +1176,7 @@ bool SkOpCoincidence::expand(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
return expanded;
|
return expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps DEBUG_COIN_DECLARE_PARAMS()) const {
|
void SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps DEBUG_COIN_DECLARE_PARAMS()) const {
|
||||||
DEBUG_SET_PHASE();
|
DEBUG_SET_PHASE();
|
||||||
overlaps->fHead = overlaps->fTop = nullptr;
|
overlaps->fHead = overlaps->fTop = nullptr;
|
||||||
SkCoincidentSpans* outer = fHead;
|
SkCoincidentSpans* outer = fHead;
|
||||||
@ -1381,15 +1201,12 @@ bool SkOpCoincidence::findOverlaps(SkOpCoincidence* overlaps DEBUG_COIN_DECLARE
|
|||||||
|| (outerOpp == innerOpp && SkOpPtT::Overlaps(outer->oppPtTStart(),
|
|| (outerOpp == innerOpp && SkOpPtT::Overlaps(outer->oppPtTStart(),
|
||||||
outer->oppPtTEnd(), inner->oppPtTStart(), inner->oppPtTEnd(),
|
outer->oppPtTEnd(), inner->oppPtTStart(), inner->oppPtTEnd(),
|
||||||
&overlapS, &overlapE))) {
|
&overlapS, &overlapE))) {
|
||||||
if (!overlaps->addOverlap(outerCoin, outerOpp, innerCoin, innerOpp,
|
SkAssertResult(overlaps->addOverlap(outerCoin, outerOpp, innerCoin, innerOpp,
|
||||||
overlapS, overlapE)) {
|
overlapS, overlapE));
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
outer = outer->next();
|
outer = outer->next();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkOpCoincidence::fixUp(SkOpPtT* deleted, const SkOpPtT* kept) {
|
void SkOpCoincidence::fixUp(SkOpPtT* deleted, const SkOpPtT* kept) {
|
||||||
@ -1438,20 +1255,19 @@ void SkOpCoincidence::fixUp(SkCoincidentSpans* coin, SkOpPtT* deleted, const SkO
|
|||||||
|
|
||||||
// Please keep this in sync with debugMark()
|
// Please keep this in sync with debugMark()
|
||||||
/* this sets up the coincidence links in the segments when the coincidence crosses multiple spans */
|
/* this sets up the coincidence links in the segments when the coincidence crosses multiple spans */
|
||||||
bool SkOpCoincidence::mark(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
void SkOpCoincidence::mark(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
||||||
DEBUG_SET_PHASE();
|
DEBUG_SET_PHASE();
|
||||||
SkCoincidentSpans* coin = fHead;
|
SkCoincidentSpans* coin = fHead;
|
||||||
if (!coin) {
|
if (!coin) {
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
FAIL_IF(!coin->coinPtTStartWritable()->span()->upCastable());
|
|
||||||
SkOpSpan* start = coin->coinPtTStartWritable()->span()->upCast();
|
SkOpSpan* start = coin->coinPtTStartWritable()->span()->upCast();
|
||||||
SkASSERT(!start->deleted());
|
SkASSERT(!start->deleted());
|
||||||
SkOpSpanBase* end = coin->coinPtTEndWritable()->span();
|
SkOpSpanBase* end = coin->coinPtTEndWritable()->span();
|
||||||
SkASSERT(!end->deleted());
|
SkASSERT(!end->deleted());
|
||||||
SkOpSpanBase* oStart = coin->oppPtTStartWritable()->span();
|
SkOpSpanBase* oStart = coin->oppPtTStartWritable()->span();
|
||||||
FAIL_IF(oStart->deleted());
|
SkASSERT(!oStart->deleted());
|
||||||
SkOpSpanBase* oEnd = coin->oppPtTEndWritable()->span();
|
SkOpSpanBase* oEnd = coin->oppPtTEndWritable()->span();
|
||||||
SkASSERT(!oEnd->deleted());
|
SkASSERT(!oEnd->deleted());
|
||||||
bool flipped = coin->flipped();
|
bool flipped = coin->flipped();
|
||||||
@ -1468,19 +1284,12 @@ bool SkOpCoincidence::mark(DEBUG_COIN_DECLARE_ONLY_PARAMS()) {
|
|||||||
SkOpSpanBase* oNext = oStart;
|
SkOpSpanBase* oNext = oStart;
|
||||||
bool ordered = coin->ordered();
|
bool ordered = coin->ordered();
|
||||||
while ((next = next->upCast()->next()) != end) {
|
while ((next = next->upCast()->next()) != end) {
|
||||||
FAIL_IF(!next->upCastable());
|
SkAssertResult(next->upCast()->insertCoincidence(oSegment, flipped, ordered));
|
||||||
if (!next->upCast()->insertCoincidence(oSegment, flipped, ordered)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while ((oNext = oNext->upCast()->next()) != oEnd) {
|
while ((oNext = oNext->upCast()->next()) != oEnd) {
|
||||||
FAIL_IF(!oNext->upCastable());
|
SkAssertResult(oNext->upCast()->insertCoincidence(segment, flipped, ordered));
|
||||||
if (!oNext->upCast()->insertCoincidence(segment, flipped, ordered)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} while ((coin = coin->next()));
|
} while ((coin = coin->next()));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please keep in sync with debugMarkCollapsed()
|
// Please keep in sync with debugMarkCollapsed()
|
||||||
@ -1552,9 +1361,3 @@ void SkOpCoincidence::release(const SkOpSegment* deleted) {
|
|||||||
}
|
}
|
||||||
} while ((coin = coin->next()));
|
} while ((coin = coin->next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkOpCoincidence::testForCoincidence(const SkCoincidentSpans* outer, const SkOpPtT* testS,
|
|
||||||
const SkOpPtT* testE) const {
|
|
||||||
return testS->segment()->testForCoincidence(testS, testE, testS->span(),
|
|
||||||
testE->span(), outer->coinPtTStart()->segment());
|
|
||||||
}
|
|
||||||
|
@ -74,7 +74,6 @@ public:
|
|||||||
SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTStart); }
|
SkOpPtT* oppPtTStartWritable() const { return const_cast<SkOpPtT*>(fOppPtTStart); }
|
||||||
SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd); }
|
SkOpPtT* oppPtTEndWritable() const { return const_cast<SkOpPtT*>(fOppPtTEnd); }
|
||||||
bool ordered() const;
|
bool ordered() const;
|
||||||
int spanCount() const;
|
|
||||||
|
|
||||||
void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
void set(SkCoincidentSpans* next, const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
||||||
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd);
|
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd);
|
||||||
@ -123,10 +122,6 @@ public:
|
|||||||
|
|
||||||
void setNext(SkCoincidentSpans* next) { fNext = next; }
|
void setNext(SkCoincidentSpans* next) { fNext = next; }
|
||||||
|
|
||||||
bool startEquals(const SkOpSpanBase* outer, const SkOpSpanBase* over) const {
|
|
||||||
return fCoinPtTStart->span() == over && fOppPtTStart->span() == outer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkCoincidentSpans* fNext;
|
SkCoincidentSpans* fNext;
|
||||||
const SkOpPtT* fCoinPtTStart;
|
const SkOpPtT* fCoinPtTStart;
|
||||||
@ -155,8 +150,7 @@ public:
|
|||||||
bool addEndMovedSpans(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
bool addEndMovedSpans(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
bool addExpanded(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
bool addExpanded(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
bool addMissing(bool* added DEBUG_COIN_DECLARE_PARAMS());
|
bool addMissing(bool* added DEBUG_COIN_DECLARE_PARAMS());
|
||||||
bool addUncommon();
|
void apply(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
bool apply(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
|
||||||
bool contains(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
bool contains(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd,
|
||||||
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) const;
|
const SkOpPtT* oppPtTStart, const SkOpPtT* oppPtTEnd) const;
|
||||||
void correctEnds(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
void correctEnds(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
@ -203,7 +197,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG_COIN
|
#if DEBUG_COIN
|
||||||
void debugRemoveCollapsed(SkPathOpsDebug::GlitchLog* ) const;
|
|
||||||
void debugRelease(SkPathOpsDebug::GlitchLog* , const SkCoincidentSpans* ,
|
void debugRelease(SkPathOpsDebug::GlitchLog* , const SkCoincidentSpans* ,
|
||||||
const SkCoincidentSpans* ) const;
|
const SkCoincidentSpans* ) const;
|
||||||
void debugRelease(SkPathOpsDebug::GlitchLog* , const SkOpSegment* ) const;
|
void debugRelease(SkPathOpsDebug::GlitchLog* , const SkOpSegment* ) const;
|
||||||
@ -216,11 +209,10 @@ public:
|
|||||||
|
|
||||||
void debugValidate() const;
|
void debugValidate() const;
|
||||||
void dump() const;
|
void dump() const;
|
||||||
bool edge(const SkOpPtT* , bool* start) const;
|
|
||||||
bool expand(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
bool expand(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTStart,
|
bool extend(const SkOpPtT* coinPtTStart, const SkOpPtT* coinPtTEnd, const SkOpPtT* oppPtTStart,
|
||||||
const SkOpPtT* oppPtTEnd);
|
const SkOpPtT* oppPtTEnd);
|
||||||
bool findOverlaps(SkOpCoincidence* DEBUG_COIN_DECLARE_PARAMS()) const;
|
void findOverlaps(SkOpCoincidence* DEBUG_COIN_DECLARE_PARAMS()) const;
|
||||||
void fixUp(SkOpPtT* deleted, const SkOpPtT* kept);
|
void fixUp(SkOpPtT* deleted, const SkOpPtT* kept);
|
||||||
|
|
||||||
SkOpGlobalState* globalState() {
|
SkOpGlobalState* globalState() {
|
||||||
@ -235,7 +227,7 @@ public:
|
|||||||
return !fHead && !fTop;
|
return !fHead && !fTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mark(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
void mark(DEBUG_COIN_DECLARE_ONLY_PARAMS());
|
||||||
void markCollapsed(SkOpPtT* );
|
void markCollapsed(SkOpPtT* );
|
||||||
|
|
||||||
static bool Ordered(const SkOpPtT* coinPtTStart, const SkOpPtT* oppPtTStart) {
|
static bool Ordered(const SkOpPtT* coinPtTStart, const SkOpPtT* oppPtTStart) {
|
||||||
@ -256,13 +248,6 @@ private:
|
|||||||
bool addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* testSpan);
|
bool addEndMovedSpans(const SkOpSpan* base, const SkOpSpanBase* testSpan);
|
||||||
bool addEndMovedSpans(const SkOpPtT* ptT);
|
bool addEndMovedSpans(const SkOpPtT* ptT);
|
||||||
|
|
||||||
bool addIfMissing(const SkCoincidentSpans* outer, SkOpPtT* over1s, SkOpPtT* over1e);
|
|
||||||
|
|
||||||
bool addIfMissing(const SkCoincidentSpans* outer, const SkOpPtT* over1s,
|
|
||||||
const SkOpPtT* over1e) {
|
|
||||||
return addIfMissing(outer, const_cast<SkOpPtT*>(over1s), const_cast<SkOpPtT*>(over1e));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over2s,
|
bool addIfMissing(const SkOpPtT* over1s, const SkOpPtT* over2s,
|
||||||
double tStart, double tEnd, SkOpSegment* coinSeg, SkOpSegment* oppSeg,
|
double tStart, double tEnd, SkOpSegment* coinSeg, SkOpSegment* oppSeg,
|
||||||
bool* added
|
bool* added
|
||||||
@ -272,8 +257,6 @@ private:
|
|||||||
bool addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg1o,
|
bool addOverlap(const SkOpSegment* seg1, const SkOpSegment* seg1o,
|
||||||
const SkOpSegment* seg2, const SkOpSegment* seg2o,
|
const SkOpSegment* seg2, const SkOpSegment* seg2o,
|
||||||
const SkOpPtT* overS, const SkOpPtT* overE);
|
const SkOpPtT* overS, const SkOpPtT* overE);
|
||||||
bool alreadyAdded(const SkCoincidentSpans* check, const SkCoincidentSpans* outer,
|
|
||||||
const SkOpPtT* over1s, const SkOpPtT* over1e) const;
|
|
||||||
bool checkOverlap(SkCoincidentSpans* check,
|
bool checkOverlap(SkCoincidentSpans* check,
|
||||||
const SkOpSegment* coinSeg, const SkOpSegment* oppSeg,
|
const SkOpSegment* coinSeg, const SkOpSegment* oppSeg,
|
||||||
double coinTs, double coinTe, double oppTs, double oppTe,
|
double coinTs, double coinTe, double oppTs, double oppTe,
|
||||||
@ -303,8 +286,6 @@ private:
|
|||||||
bool release(SkCoincidentSpans* coin, SkCoincidentSpans* );
|
bool release(SkCoincidentSpans* coin, SkCoincidentSpans* );
|
||||||
void releaseDeleted(SkCoincidentSpans* );
|
void releaseDeleted(SkCoincidentSpans* );
|
||||||
void restoreHead();
|
void restoreHead();
|
||||||
bool testForCoincidence(const SkCoincidentSpans* outer, const SkOpPtT* testS,
|
|
||||||
const SkOpPtT* testE) const;
|
|
||||||
// return coinPtT->segment()->t mapped from overS->fT <= t <= overE->fT
|
// return coinPtT->segment()->t mapped from overS->fT <= t <= overE->fT
|
||||||
static double TRange(const SkOpPtT* overS, double t, const SkOpSegment* coinPtT
|
static double TRange(const SkOpPtT* overS, double t, const SkOpSegment* coinPtT
|
||||||
SkDEBUGPARAMS(const SkOpPtT* overE));
|
SkDEBUGPARAMS(const SkOpPtT* overE));
|
||||||
|
@ -232,11 +232,7 @@ public:
|
|||||||
SkOpSegment* segment = &fHead;
|
SkOpSegment* segment = &fHead;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
do {
|
do {
|
||||||
if (fState->angleCoincidence()) {
|
if (segment->missingCoincidence()) {
|
||||||
#if DEBUG_ANGLE
|
|
||||||
segment->debugCheckAngleCoin();
|
|
||||||
#endif
|
|
||||||
} else if (segment->missingCoincidence()) {
|
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
segment = segment->next();
|
segment = segment->next();
|
||||||
|
@ -321,14 +321,6 @@ void SkOpSegment::clearOne(SkOpSpan* span) {
|
|||||||
this->markDone(span);
|
this->markDone(span);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quads and conics collapse if the end points are the same, because
|
|
||||||
// the curve doesn't enclose an area.
|
|
||||||
bool SkOpSegment::collapsed() const {
|
|
||||||
// FIXME: cubics can have also collapsed -- need to check if the
|
|
||||||
// control points are on a line with the end points
|
|
||||||
return fVerb < SkPath::kCubic_Verb && fHead.pt() == fTail.pt();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkOpSegment::collapsed(double s, double e) const {
|
bool SkOpSegment::collapsed(double s, double e) const {
|
||||||
const SkOpSpanBase* span = &fHead;
|
const SkOpSpanBase* span = &fHead;
|
||||||
do {
|
do {
|
||||||
@ -490,6 +482,8 @@ void SkOpSegment::release(const SkOpSpan* span) {
|
|||||||
SkOPASSERT(fCount >= fDoneCount);
|
SkOPASSERT(fCount >= fDoneCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG_ANGLE
|
||||||
|
// called only by debugCheckNearCoincidence
|
||||||
double SkOpSegment::distSq(double t, const SkOpAngle* oppAngle) const {
|
double SkOpSegment::distSq(double t, const SkOpAngle* oppAngle) const {
|
||||||
SkDPoint testPt = this->dPtAtT(t);
|
SkDPoint testPt = this->dPtAtT(t);
|
||||||
SkDLine testPerp = {{ testPt, testPt }};
|
SkDLine testPerp = {{ testPt, testPt }};
|
||||||
@ -511,6 +505,7 @@ double SkOpSegment::distSq(double t, const SkOpAngle* oppAngle) const {
|
|||||||
}
|
}
|
||||||
return closestDistSq;
|
return closestDistSq;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The M and S variable name parts stand for the operators.
|
The M and S variable name parts stand for the operators.
|
||||||
@ -1534,60 +1529,6 @@ void SkOpSegment::sortAngles() {
|
|||||||
} while (!span->final() && (span = span->upCast()->next()));
|
} while (!span->final() && (span = span->upCast()->next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if midpoints were computed
|
|
||||||
bool SkOpSegment::subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end,
|
|
||||||
SkOpCurve* edge) const {
|
|
||||||
SkASSERT(start != end);
|
|
||||||
const SkOpPtT& startPtT = *start->ptT();
|
|
||||||
const SkOpPtT& endPtT = *end->ptT();
|
|
||||||
SkDEBUGCODE(edge->fVerb = fVerb);
|
|
||||||
edge->fPts[0] = startPtT.fPt;
|
|
||||||
int points = SkPathOpsVerbToPoints(fVerb);
|
|
||||||
edge->fPts[points] = endPtT.fPt;
|
|
||||||
edge->fWeight = 1;
|
|
||||||
if (fVerb == SkPath::kLine_Verb) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
double startT = startPtT.fT;
|
|
||||||
double endT = endPtT.fT;
|
|
||||||
if ((startT == 0 || endT == 0) && (startT == 1 || endT == 1)) {
|
|
||||||
// don't compute midpoints if we already have them
|
|
||||||
if (fVerb == SkPath::kQuad_Verb) {
|
|
||||||
edge->fPts[1] = fPts[1];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (fVerb == SkPath::kConic_Verb) {
|
|
||||||
edge->fPts[1] = fPts[1];
|
|
||||||
edge->fWeight = fWeight;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SkASSERT(fVerb == SkPath::kCubic_Verb);
|
|
||||||
if (start < end) {
|
|
||||||
edge->fPts[1] = fPts[1];
|
|
||||||
edge->fPts[2] = fPts[2];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
edge->fPts[1] = fPts[2];
|
|
||||||
edge->fPts[2] = fPts[1];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const SkDPoint sub[2] = {{ edge->fPts[0].fX, edge->fPts[0].fY},
|
|
||||||
{edge->fPts[points].fX, edge->fPts[points].fY }};
|
|
||||||
if (fVerb == SkPath::kQuad_Verb) {
|
|
||||||
edge->fPts[1] = SkDQuad::SubDivide(fPts, sub[0], sub[1], startT, endT).asSkPoint();
|
|
||||||
} else if (fVerb == SkPath::kConic_Verb) {
|
|
||||||
edge->fPts[1] = SkDConic::SubDivide(fPts, fWeight, sub[0], sub[1],
|
|
||||||
startT, endT, &edge->fWeight).asSkPoint();
|
|
||||||
} else {
|
|
||||||
SkASSERT(fVerb == SkPath::kCubic_Verb);
|
|
||||||
SkDPoint ctrl[2];
|
|
||||||
SkDCubic::SubDivide(fPts, sub[0], sub[1], startT, endT, ctrl);
|
|
||||||
edge->fPts[1] = ctrl[0].asSkPoint();
|
|
||||||
edge->fPts[2] = ctrl[1].asSkPoint();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkOpSegment::subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end,
|
bool SkOpSegment::subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end,
|
||||||
SkDCurve* edge) const {
|
SkDCurve* edge) const {
|
||||||
SkASSERT(start != end);
|
SkASSERT(start != end);
|
||||||
|
@ -107,7 +107,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void calcAngles();
|
void calcAngles();
|
||||||
bool collapsed() const;
|
|
||||||
bool collapsed(double startT, double endT) const;
|
bool collapsed(double startT, double endT) const;
|
||||||
static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle,
|
static void ComputeOneSum(const SkOpAngle* baseAngle, SkOpAngle* nextAngle,
|
||||||
SkOpAngle::IncludeType );
|
SkOpAngle::IncludeType );
|
||||||
@ -186,8 +185,9 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void release(const SkOpSpan* );
|
#if DEBUG_ANGLE
|
||||||
double distSq(double t, const SkOpAngle* opp) const;
|
double distSq(double t, const SkOpAngle* opp) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool done() const {
|
bool done() const {
|
||||||
SkOPASSERT(fDoneCount <= fCount);
|
SkOPASSERT(fDoneCount <= fCount);
|
||||||
@ -331,15 +331,10 @@ public:
|
|||||||
return ptsDisjoint(span.fT, span.fPt, t, pt);
|
return ptsDisjoint(span.fT, span.fPt, t, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ptsDisjoint(const SkOpSpanBase* span, const SkOpSpanBase* test) const {
|
|
||||||
SkASSERT(this == span->segment());
|
|
||||||
SkASSERT(this == test->segment());
|
|
||||||
return ptsDisjoint(span->t(), span->pt(), test->t(), test->pt());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ptsDisjoint(double t1, const SkPoint& pt1, double t2, const SkPoint& pt2) const;
|
bool ptsDisjoint(double t1, const SkPoint& pt1, double t2, const SkPoint& pt2) const;
|
||||||
|
|
||||||
void rayCheck(const SkOpRayHit& base, SkOpRayDir dir, SkOpRayHit** hits, SkChunkAlloc*);
|
void rayCheck(const SkOpRayHit& base, SkOpRayDir dir, SkOpRayHit** hits, SkChunkAlloc*);
|
||||||
|
void release(const SkOpSpan* );
|
||||||
|
|
||||||
#if DEBUG_COIN
|
#if DEBUG_COIN
|
||||||
void resetDebugVisited() const {
|
void resetDebugVisited() const {
|
||||||
@ -391,7 +386,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end, SkDCurve* result) const;
|
bool subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end, SkDCurve* result) const;
|
||||||
bool subDivide(const SkOpSpanBase* start, const SkOpSpanBase* end, SkOpCurve* result) const;
|
|
||||||
|
|
||||||
const SkOpSpanBase* tail() const {
|
const SkOpSpanBase* tail() const {
|
||||||
return &fTail;
|
return &fTail;
|
||||||
|
@ -28,16 +28,6 @@ const SkOpPtT* SkOpPtT::active() const {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkOpPtT::collapsed(const SkOpPtT* check) const {
|
|
||||||
if (fPt != check->fPt) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SkASSERT(this != check);
|
|
||||||
const SkOpSegment* segment = this->segment();
|
|
||||||
SkASSERT(segment == check->segment());
|
|
||||||
return segment->collapsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkOpPtT::contains(const SkOpPtT* check) const {
|
bool SkOpPtT::contains(const SkOpPtT* check) const {
|
||||||
SkOPASSERT(this != check);
|
SkOPASSERT(this != check);
|
||||||
const SkOpPtT* ptT = this;
|
const SkOpPtT* ptT = this;
|
||||||
@ -146,38 +136,6 @@ SkOpPtT* SkOpPtT::prev() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkOpPtT* SkOpPtT::remove(const SkOpPtT* kept) {
|
|
||||||
SkOpPtT* prev = this;
|
|
||||||
do {
|
|
||||||
SkOpPtT* next = prev->fNext;
|
|
||||||
if (next == this) {
|
|
||||||
prev->removeNext(kept);
|
|
||||||
SkASSERT(prev->fNext != prev);
|
|
||||||
fDeleted = true;
|
|
||||||
return prev;
|
|
||||||
}
|
|
||||||
prev = next;
|
|
||||||
} while (prev != this);
|
|
||||||
SkASSERT(0);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SkOpPtT::removeNext(const SkOpPtT* kept) {
|
|
||||||
SkASSERT(this->fNext);
|
|
||||||
SkOpPtT* next = this->fNext;
|
|
||||||
SkASSERT(this != next->fNext);
|
|
||||||
this->fNext = next->fNext;
|
|
||||||
SkOpSpanBase* span = next->span();
|
|
||||||
SkOpCoincidence* coincidence = span->globalState()->coincidence();
|
|
||||||
if (coincidence) {
|
|
||||||
coincidence->fixUp(next, kept);
|
|
||||||
}
|
|
||||||
next->setDeleted();
|
|
||||||
if (span->ptT() == next) {
|
|
||||||
span->upCast()->release(kept);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const SkOpSegment* SkOpPtT::segment() const {
|
const SkOpSegment* SkOpPtT::segment() const {
|
||||||
return span()->segment();
|
return span()->segment();
|
||||||
}
|
}
|
||||||
@ -202,26 +160,6 @@ void SkOpSpanBase::addOpp(SkOpSpanBase* opp) {
|
|||||||
this->checkForCollapsedCoincidence();
|
this->checkForCollapsedCoincidence();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Please keep this in sync with debugMergeContained()
|
|
||||||
void SkOpSpanBase::mergeContained(const SkPathOpsBounds& bounds) {
|
|
||||||
// while adjacent spans' points are contained by the bounds, merge them
|
|
||||||
SkOpSpanBase* prev = this;
|
|
||||||
SkOpSegment* seg = this->segment();
|
|
||||||
while ((prev = prev->prev()) && bounds.contains(prev->pt()) && !seg->ptsDisjoint(prev, this)) {
|
|
||||||
this->mergeMatches(prev);
|
|
||||||
this->addOpp(prev);
|
|
||||||
}
|
|
||||||
SkOpSpanBase* next = this;
|
|
||||||
while (next->upCastable() && (next = next->upCast()->next())
|
|
||||||
&& bounds.contains(next->pt()) && !seg->ptsDisjoint(this, next)) {
|
|
||||||
this->mergeMatches(next);
|
|
||||||
this->addOpp(next);
|
|
||||||
}
|
|
||||||
#if DEBUG_COINCIDENCE
|
|
||||||
this->globalState()->coincidence()->debugValidate();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SkOpSpanBase::collapsed(double s, double e) const {
|
bool SkOpSpanBase::collapsed(double s, double e) const {
|
||||||
const SkOpPtT* start = &fPtT;
|
const SkOpPtT* start = &fPtT;
|
||||||
const SkOpPtT* walk = start;
|
const SkOpPtT* walk = start;
|
||||||
|
@ -41,7 +41,6 @@ public:
|
|||||||
|
|
||||||
bool alias() const;
|
bool alias() const;
|
||||||
bool coincident() const { return fCoincident; }
|
bool coincident() const { return fCoincident; }
|
||||||
bool collapsed(const SkOpPtT* ) const;
|
|
||||||
bool contains(const SkOpPtT* ) const;
|
bool contains(const SkOpPtT* ) const;
|
||||||
bool contains(const SkOpSegment*, const SkPoint& ) const;
|
bool contains(const SkOpSegment*, const SkPoint& ) const;
|
||||||
bool contains(const SkOpSegment*, double t) const;
|
bool contains(const SkOpSegment*, double t) const;
|
||||||
@ -137,8 +136,6 @@ public:
|
|||||||
|
|
||||||
bool ptAlreadySeen(const SkOpPtT* head) const;
|
bool ptAlreadySeen(const SkOpPtT* head) const;
|
||||||
SkOpPtT* prev();
|
SkOpPtT* prev();
|
||||||
SkOpPtT* remove(const SkOpPtT* kept);
|
|
||||||
void removeNext(const SkOpPtT* kept);
|
|
||||||
|
|
||||||
const SkOpSegment* segment() const;
|
const SkOpSegment* segment() const;
|
||||||
SkOpSegment* segment();
|
SkOpSegment* segment();
|
||||||
@ -241,8 +238,6 @@ public:
|
|||||||
#if DEBUG_COIN
|
#if DEBUG_COIN
|
||||||
void debugInsertCoinEnd(SkPathOpsDebug::GlitchLog* ,
|
void debugInsertCoinEnd(SkPathOpsDebug::GlitchLog* ,
|
||||||
const SkOpSpanBase* ) const;
|
const SkOpSpanBase* ) const;
|
||||||
void debugMergeContained(SkPathOpsDebug::GlitchLog* ,
|
|
||||||
const SkPathOpsBounds& bounds, bool* deleted) const;
|
|
||||||
void debugMergeMatches(SkPathOpsDebug::GlitchLog* log,
|
void debugMergeMatches(SkPathOpsDebug::GlitchLog* log,
|
||||||
const SkOpSpanBase* opp) const;
|
const SkOpSpanBase* opp) const;
|
||||||
#endif
|
#endif
|
||||||
@ -293,7 +288,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void merge(SkOpSpan* span);
|
void merge(SkOpSpan* span);
|
||||||
void mergeContained(const SkPathOpsBounds& bounds);
|
|
||||||
void mergeMatches(SkOpSpanBase* opp);
|
void mergeMatches(SkOpSpanBase* opp);
|
||||||
|
|
||||||
const SkOpSpan* prev() const {
|
const SkOpSpan* prev() const {
|
||||||
@ -426,10 +420,6 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkAlreadyAdded() const {
|
|
||||||
return fAlreadyAdded;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool clearCoincident() {
|
bool clearCoincident() {
|
||||||
SkASSERT(!final());
|
SkASSERT(!final());
|
||||||
if (fCoincident == this) {
|
if (fCoincident == this) {
|
||||||
|
@ -259,7 +259,7 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
|||||||
if (!coincidence->addEndMovedSpans(DEBUG_COIN_ONLY_PARAMS())) {
|
if (!coincidence->addEndMovedSpans(DEBUG_COIN_ONLY_PARAMS())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const int SAFETY_COUNT = 100; // FIXME: tune
|
const int SAFETY_COUNT = 3;
|
||||||
int safetyHatch = SAFETY_COUNT;
|
int safetyHatch = SAFETY_COUNT;
|
||||||
// look for coincidence present in A-B and A-C but missing in B-C
|
// look for coincidence present in A-B and A-C but missing in B-C
|
||||||
do {
|
do {
|
||||||
@ -276,8 +276,6 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
|||||||
}
|
}
|
||||||
move_nearby(contourList DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch - 1));
|
move_nearby(contourList DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch - 1));
|
||||||
} while (true);
|
} while (true);
|
||||||
// FIXME: only call this if addMissing modified something when returning false
|
|
||||||
move_nearby(contourList DEBUG_COIN_PARAMS());
|
|
||||||
// check to see if, loosely, coincident ranges may be expanded
|
// check to see if, loosely, coincident ranges may be expanded
|
||||||
if (coincidence->expand(DEBUG_COIN_ONLY_PARAMS())) {
|
if (coincidence->expand(DEBUG_COIN_ONLY_PARAMS())) {
|
||||||
bool added;
|
bool added;
|
||||||
@ -296,20 +294,15 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
|||||||
if (!coincidence->addExpanded(DEBUG_PHASE_ONLY_PARAMS(kWalking))) {
|
if (!coincidence->addExpanded(DEBUG_PHASE_ONLY_PARAMS(kWalking))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
coincidence->correctEnds(DEBUG_COIN_ONLY_PARAMS());
|
|
||||||
// mark spans of coincident segments as coincident
|
// mark spans of coincident segments as coincident
|
||||||
if (!coincidence->mark(DEBUG_COIN_ONLY_PARAMS())) {
|
coincidence->mark(DEBUG_COIN_ONLY_PARAMS());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// look for coincidence lines and curves undetected by intersection
|
// look for coincidence lines and curves undetected by intersection
|
||||||
if (missing_coincidence(contourList DEBUG_COIN_PARAMS())) {
|
if (missing_coincidence(contourList DEBUG_COIN_PARAMS())) {
|
||||||
(void) coincidence->expand(DEBUG_PHASE_ONLY_PARAMS(kIntersecting));
|
(void) coincidence->expand(DEBUG_PHASE_ONLY_PARAMS(kIntersecting));
|
||||||
if (!coincidence->addExpanded(DEBUG_COIN_ONLY_PARAMS())) {
|
if (!coincidence->addExpanded(DEBUG_COIN_ONLY_PARAMS())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!coincidence->mark(DEBUG_PHASE_ONLY_PARAMS(kWalking))) {
|
coincidence->mark(DEBUG_PHASE_ONLY_PARAMS(kWalking));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
(void) coincidence->expand(DEBUG_COIN_ONLY_PARAMS());
|
(void) coincidence->expand(DEBUG_COIN_ONLY_PARAMS());
|
||||||
}
|
}
|
||||||
@ -320,14 +313,10 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
|||||||
do {
|
do {
|
||||||
SkOpCoincidence* pairs = overlaps.isEmpty() ? coincidence : &overlaps;
|
SkOpCoincidence* pairs = overlaps.isEmpty() ? coincidence : &overlaps;
|
||||||
// adjust the winding value to account for coincident edges
|
// adjust the winding value to account for coincident edges
|
||||||
if (!pairs->apply(DEBUG_ITER_ONLY_PARAMS(SAFETY_COUNT - safetyHatch))) {
|
pairs->apply(DEBUG_ITER_ONLY_PARAMS(SAFETY_COUNT - safetyHatch));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// For each coincident pair that overlaps another, when the receivers (the 1st of the pair)
|
// For each coincident pair that overlaps another, when the receivers (the 1st of the pair)
|
||||||
// are different, construct a new pair to resolve their mutual span
|
// are different, construct a new pair to resolve their mutual span
|
||||||
if (!pairs->findOverlaps(&overlaps DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch))) {
|
pairs->findOverlaps(&overlaps DEBUG_ITER_PARAMS(SAFETY_COUNT - safetyHatch));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!--safetyHatch) {
|
if (!--safetyHatch) {
|
||||||
SkASSERT(globalState->debugSkipAssert());
|
SkASSERT(globalState->debugSkipAssert());
|
||||||
return false;
|
return false;
|
||||||
@ -335,12 +324,6 @@ bool HandleCoincidence(SkOpContourHead* contourList, SkOpCoincidence* coincidenc
|
|||||||
} while (!overlaps.isEmpty());
|
} while (!overlaps.isEmpty());
|
||||||
calc_angles(contourList DEBUG_COIN_PARAMS());
|
calc_angles(contourList DEBUG_COIN_PARAMS());
|
||||||
sort_angles(contourList);
|
sort_angles(contourList);
|
||||||
if (globalState->angleCoincidence()) {
|
|
||||||
(void) missing_coincidence(contourList DEBUG_COIN_PARAMS());
|
|
||||||
if (!coincidence->apply(DEBUG_COIN_ONLY_PARAMS())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if DEBUG_COINCIDENCE_VERBOSE
|
#if DEBUG_COINCIDENCE_VERBOSE
|
||||||
coincidence->debugShowCoincidence();
|
coincidence->debugShowCoincidence();
|
||||||
#endif
|
#endif
|
||||||
|
@ -437,7 +437,6 @@ void SkPathOpsDebug::DumpGlitchType(GlitchType glitchType) {
|
|||||||
case kMarkCoinInsert_Glitch: SkDebugf(" MarkCoinInsert"); break;
|
case kMarkCoinInsert_Glitch: SkDebugf(" MarkCoinInsert"); break;
|
||||||
case kMarkCoinMissing_Glitch: SkDebugf(" MarkCoinMissing"); break;
|
case kMarkCoinMissing_Glitch: SkDebugf(" MarkCoinMissing"); break;
|
||||||
case kMarkCoinStart_Glitch: SkDebugf(" MarkCoinStart"); break;
|
case kMarkCoinStart_Glitch: SkDebugf(" MarkCoinStart"); break;
|
||||||
case kMergeContained_Glitch: SkDebugf(" MergeContained"); break;
|
|
||||||
case kMergeMatches_Glitch: SkDebugf(" MergeMatches"); break;
|
case kMergeMatches_Glitch: SkDebugf(" MergeMatches"); break;
|
||||||
case kMissingCoin_Glitch: SkDebugf(" MissingCoin"); break;
|
case kMissingCoin_Glitch: SkDebugf(" MissingCoin"); break;
|
||||||
case kMissingDone_Glitch: SkDebugf(" MissingDone"); break;
|
case kMissingDone_Glitch: SkDebugf(" MissingDone"); break;
|
||||||
@ -2307,11 +2306,7 @@ void SkOpContour::debugMissingCoincidence(SkPathOpsDebug::GlitchLog* log) const
|
|||||||
const SkOpSegment* segment = &fHead;
|
const SkOpSegment* segment = &fHead;
|
||||||
// bool result = false;
|
// bool result = false;
|
||||||
do {
|
do {
|
||||||
if (fState->angleCoincidence()) {
|
if (segment->debugMissingCoincidence(log), false) {
|
||||||
// #if DEBUG_ANGLE
|
|
||||||
// segment->debugCheckAngleCoin();
|
|
||||||
// #endif
|
|
||||||
} else if (segment->debugMissingCoincidence(log), false) {
|
|
||||||
// result = true;
|
// result = true;
|
||||||
}
|
}
|
||||||
segment = segment->next();
|
segment = segment->next();
|
||||||
@ -2468,42 +2463,6 @@ void SkOpSpanBase::debugInsertCoinEnd(SkPathOpsDebug::GlitchLog* log, const SkOp
|
|||||||
debugValidate();
|
debugValidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commented-out lines keep this in sync with mergeContained()
|
|
||||||
void SkOpSpanBase::debugMergeContained(SkPathOpsDebug::GlitchLog* log, const SkPathOpsBounds& bounds, bool* deleted) const {
|
|
||||||
// while adjacent spans' points are contained by the bounds, merge them
|
|
||||||
const SkOpSpanBase* prev = this;
|
|
||||||
const SkOpSegment* seg = this->segment();
|
|
||||||
while ((prev = prev->prev()) && bounds.contains(prev->pt()) && !seg->ptsDisjoint(prev, this)) {
|
|
||||||
if (prev->prev()) {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, this, prev);
|
|
||||||
} else if (this->final()) {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, this, prev);
|
|
||||||
// return;
|
|
||||||
} else {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, prev, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const SkOpSpanBase* current = this;
|
|
||||||
const SkOpSpanBase* next = this;
|
|
||||||
while (next->upCastable() && (next = next->upCast()->next())
|
|
||||||
&& bounds.contains(next->pt()) && !seg->ptsDisjoint(this, next)) {
|
|
||||||
if (!current->prev() && next->final()) {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, next, current);
|
|
||||||
current = next;
|
|
||||||
}
|
|
||||||
if (current->prev()) {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, next, current);
|
|
||||||
current = next;
|
|
||||||
} else {
|
|
||||||
log->record(SkPathOpsDebug::kMergeContained_Glitch, next, current);
|
|
||||||
current = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if DEBUG_COINCIDENCE
|
|
||||||
// this->globalState()->coincidence()->debugValidate();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commented-out lines keep this in sync with mergeMatches()
|
// Commented-out lines keep this in sync with mergeMatches()
|
||||||
// Look to see if pt-t linked list contains same segment more than once
|
// Look to see if pt-t linked list contains same segment more than once
|
||||||
// if so, and if each pt-t is directly pointed to by spans in that segment,
|
// if so, and if each pt-t is directly pointed to by spans in that segment,
|
||||||
|
@ -259,7 +259,6 @@ public:
|
|||||||
kMarkCoinInsert_Glitch,
|
kMarkCoinInsert_Glitch,
|
||||||
kMarkCoinMissing_Glitch,
|
kMarkCoinMissing_Glitch,
|
||||||
kMarkCoinStart_Glitch,
|
kMarkCoinStart_Glitch,
|
||||||
kMergeContained_Glitch,
|
|
||||||
kMergeMatches_Glitch,
|
kMergeMatches_Glitch,
|
||||||
kMissingCoin_Glitch,
|
kMissingCoin_Glitch,
|
||||||
kMissingDone_Glitch,
|
kMissingDone_Glitch,
|
||||||
|
@ -33,19 +33,6 @@ static bool bridgeWinding(SkOpContourHead* contourList, SkPathWriter* simple) {
|
|||||||
SkOpSegment* next = current->findNextWinding(&chase, &nextStart, &nextEnd,
|
SkOpSegment* next = current->findNextWinding(&chase, &nextStart, &nextEnd,
|
||||||
&unsortable);
|
&unsortable);
|
||||||
if (!next) {
|
if (!next) {
|
||||||
if (!unsortable && simple->hasMove()
|
|
||||||
&& current->verb() != SkPath::kLine_Verb
|
|
||||||
&& !simple->isClosed()) {
|
|
||||||
// FIXME: put in the next two lines to avoid handling already added
|
|
||||||
if (start->starter(end)->checkAlreadyAdded()) {
|
|
||||||
simple->finishContour();
|
|
||||||
} else if (!current->addCurveTo(start, end, simple)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!simple->isClosed()) {
|
|
||||||
SkPathOpsDebug::ShowActiveSpans(contourList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if DEBUG_FLOW
|
#if DEBUG_FLOW
|
||||||
|
@ -233,7 +233,6 @@ SkOpGlobalState::SkOpGlobalState(SkOpContourHead* head,
|
|||||||
, fContourHead(head)
|
, fContourHead(head)
|
||||||
, fNested(0)
|
, fNested(0)
|
||||||
, fWindingFailed(false)
|
, fWindingFailed(false)
|
||||||
, fAngleCoincidence(false)
|
|
||||||
, fPhase(SkOpPhase::kIntersecting)
|
, fPhase(SkOpPhase::kIntersecting)
|
||||||
SkDEBUGPARAMS(fDebugTestName(testName))
|
SkDEBUGPARAMS(fDebugTestName(testName))
|
||||||
SkDEBUGPARAMS(fAngleID(0))
|
SkDEBUGPARAMS(fAngleID(0))
|
||||||
|
@ -54,10 +54,6 @@ public:
|
|||||||
return fAllocator;
|
return fAllocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool angleCoincidence() const {
|
|
||||||
return fAngleCoincidence;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bumpNested() {
|
void bumpNested() {
|
||||||
++fNested;
|
++fNested;
|
||||||
}
|
}
|
||||||
@ -155,10 +151,6 @@ public:
|
|||||||
fAllocatedOpSpan = true;
|
fAllocatedOpSpan = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAngleCoincidence() {
|
|
||||||
fAngleCoincidence = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCoincidence(SkOpCoincidence* coincidence) {
|
void setCoincidence(SkOpCoincidence* coincidence) {
|
||||||
fCoincidence = coincidence;
|
fCoincidence = coincidence;
|
||||||
}
|
}
|
||||||
@ -191,7 +183,6 @@ private:
|
|||||||
int fNested;
|
int fNested;
|
||||||
bool fAllocatedOpSpan;
|
bool fAllocatedOpSpan;
|
||||||
bool fWindingFailed;
|
bool fWindingFailed;
|
||||||
bool fAngleCoincidence;
|
|
||||||
SkOpPhase fPhase;
|
SkOpPhase fPhase;
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
const char* fDebugTestName;
|
const char* fDebugTestName;
|
||||||
|
Loading…
Reference in New Issue
Block a user