some pathops fuzz fixes
R=kjlubick@google.com Bug: skia: Change-Id: I0b2089f728f91ef5af780d0e9f91d266c252c054 Reviewed-on: https://skia-review.googlesource.com/c/169341 Auto-Submit: Cary Clark <caryclark@skia.org> Commit-Queue: Kevin Lubick <kjlubick@google.com> Reviewed-by: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
77b3f3aeee
commit
1379508a3a
@ -860,7 +860,7 @@ bool SkOpCoincidence::addMissing(bool* added DEBUG_COIN_DECLARE_PARAMS()) {
|
||||
}
|
||||
} else if (outerOpp == innerCoin) {
|
||||
const SkOpPtT* ooe = outer->oppPtTEnd();
|
||||
SkASSERT(!ooe->deleted());
|
||||
FAIL_IF(ooe->deleted());
|
||||
const SkOpPtT* ice = inner->coinPtTEnd();
|
||||
SkASSERT(!ice->deleted());
|
||||
SkASSERT(outerCoin != innerOpp);
|
||||
|
@ -260,7 +260,7 @@ public:
|
||||
return winding;
|
||||
}
|
||||
|
||||
void containerContains(Contour& contour, Contour& test) {
|
||||
bool containerContains(Contour& contour, Contour& test) {
|
||||
// find outside point on lesser contour
|
||||
// arbitrarily, choose non-horizontal edge where point <= bounds left
|
||||
// note that if leftmost point is control point, may need tight bounds
|
||||
@ -273,8 +273,8 @@ public:
|
||||
int winding = this->nextEdge(contour, Edge::kCompare);
|
||||
// if edge is up, mark contour cw, otherwise, ccw
|
||||
// sum of greater edges direction should be cw, 0, ccw
|
||||
SkASSERT(-1 <= winding && winding <= 1);
|
||||
test.fContained = winding != 0;
|
||||
return -1 <= winding && winding <= 1;
|
||||
}
|
||||
|
||||
void inParent(Contour& contour, Contour& parent) {
|
||||
@ -297,14 +297,19 @@ public:
|
||||
parent.fChildren.push_back(&contour);
|
||||
}
|
||||
|
||||
void checkContainerChildren(Contour* parent, Contour* child) {
|
||||
bool checkContainerChildren(Contour* parent, Contour* child) {
|
||||
for (auto grandChild : child->fChildren) {
|
||||
checkContainerChildren(child, grandChild);
|
||||
if (!checkContainerChildren(child, grandChild)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (parent) {
|
||||
containerContains(*parent, *child);
|
||||
if (!containerContains(*parent, *child)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool markReverse(Contour* parent, Contour* child) {
|
||||
bool reversed = false;
|
||||
@ -402,7 +407,9 @@ bool SK_API AsWinding(const SkPath& path, SkPath* result) {
|
||||
// starting with outermost and moving inward, see if one path contains another
|
||||
for (auto contour : sorted.fChildren) {
|
||||
winder.nextEdge(*contour, OpAsWinding::Edge::kInitial);
|
||||
winder.checkContainerChildren(nullptr, contour);
|
||||
if (!winder.checkContainerChildren(nullptr, contour)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// starting with outermost and moving inward, mark paths to reverse
|
||||
bool reversed = false;
|
||||
|
@ -122,12 +122,12 @@ static bool bridgeXor(SkOpContourHead* contourList, SkPathWriter* writer) {
|
||||
start = nextStart;
|
||||
end = nextEnd;
|
||||
} while (!writer->isClosed() && (!unsortable || !start->starter(end)->done()));
|
||||
#ifdef SK_DEBUG
|
||||
if (!writer->isClosed()) {
|
||||
SkOpSpan* spanStart = start->starter(end);
|
||||
SkASSERT(spanStart->done());
|
||||
if (!spanStart->done()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
writer->finishContour();
|
||||
SkPathOpsDebug::ShowActiveSpans(contourList);
|
||||
} while (true);
|
||||
|
@ -997,7 +997,9 @@ int SkTSect::intersects(SkTSpan* span,
|
||||
hullResult = 1;
|
||||
}
|
||||
if (!oppSpan->fBounded || !oppSpan->fBounded->fNext) {
|
||||
SkASSERT(!oppSpan->fBounded || oppSpan->fBounded->fBounded == span);
|
||||
if (oppSpan->fBounded && oppSpan->fBounded->fBounded != span) {
|
||||
return 0;
|
||||
}
|
||||
if (oppStart) {
|
||||
oppSpan->fEndT = oppSpan->fStartT;
|
||||
} else {
|
||||
|
@ -354,7 +354,9 @@ void SkPathWriter::assemble() {
|
||||
const SkPath& contour = fPartials[rIndex];
|
||||
if (!first) {
|
||||
SkPoint prior, next;
|
||||
SkAssertResult(fPathPtr->getLastPt(&prior));
|
||||
if (!fPathPtr->getLastPt(&prior)) {
|
||||
return;
|
||||
}
|
||||
if (forward) {
|
||||
next = contour.getPoint(0);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user