Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: src/pathops/SkPathOpsSimplify.cpp

Issue 14407006: path ops -- handle non-finite numbers (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/pathops/SkPathOpsSimplify.cpp
===================================================================
--- src/pathops/SkPathOpsSimplify.cpp (revision 8862)
+++ src/pathops/SkPathOpsSimplify.cpp (working copy)
@@ -143,26 +143,27 @@
}
// FIXME : add this as a member of SkPath
-void Simplify(const SkPath& path, SkPath* result) {
+bool Simplify(const SkPath& path, SkPath* result) {
#if DEBUG_SORT || DEBUG_SWAP_TOP
gDebugSortCount = gDebugSortCountDefault;
#endif
// returns 1 for evenodd, -1 for winding, regardless of inverse-ness
- result->reset();
SkPath::FillType fillType = path.isInverseFillType() ? SkPath::kInverseEvenOdd_FillType
: SkPath::kEvenOdd_FillType;
- result->setFillType(fillType);
- SkPathWriter simple(*result);
// turn path into list of segments
SkTArray<SkOpContour> contours;
SkOpEdgeBuilder builder(path, contours);
- builder.finish();
+ if (!builder.finish()) {
+ return false;
+ }
SkTDArray<SkOpContour*> contourList;
MakeContourList(contours, contourList, false, false);
SkOpContour** currentPtr = contourList.begin();
+ result->setFillType(fillType);
+ result->reset();
if (!currentPtr) {
- return;
+ return true;
}
SkOpContour** listEnd = contourList.end();
// find all intersections between segments
@@ -185,6 +186,7 @@
DebugShowActiveSpans(contourList);
#endif
// construct closed contours
+ SkPathWriter simple(*result);
if (builder.xorMask() == kWinding_PathOpsMask ? bridgeWinding(contourList, &simple)
: !bridgeXor(contourList, &simple))
{ // if some edges could not be resolved, assemble remaining fragments
@@ -193,5 +195,7 @@
SkPathWriter assembled(temp);
Assemble(simple, &assembled);
*result = *assembled.nativePath();
+ result->setFillType(fillType);
}
+ return true;
}

Powered by Google App Engine
This is Rietveld 408576698