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

Unified Diff: src/pathops/SkOpBuilder.cpp

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: turn off pathops specific debuggging Created 5 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
« no previous file with comments | « src/pathops/SkOpAngle.cpp ('k') | src/pathops/SkOpCoincidence.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkOpBuilder.cpp
diff --git a/src/pathops/SkOpBuilder.cpp b/src/pathops/SkOpBuilder.cpp
index 1c21a5984c464ba849e92cc23f7221ae2376adb2..2f19b332bccb98ed095ca08a348604da0fe1f339 100644
--- a/src/pathops/SkOpBuilder.cpp
+++ b/src/pathops/SkOpBuilder.cpp
@@ -27,6 +27,7 @@ void SkOpBuilder::reset() {
paths with union ops could be locally resolved and still improve over doing the
ops one at a time. */
bool SkOpBuilder::resolve(SkPath* result) {
+ SkPath original = *result;
int count = fOps.count();
bool allUnion = true;
SkPath::Direction firstDir;
@@ -67,6 +68,7 @@ bool SkOpBuilder::resolve(SkPath* result) {
for (int index = 1; index < count; ++index) {
if (!Op(*result, fPathRefs[index], fOps[index], result)) {
reset();
+ *result = original;
return false;
}
}
@@ -77,10 +79,15 @@ bool SkOpBuilder::resolve(SkPath* result) {
for (int index = 0; index < count; ++index) {
if (!Simplify(fPathRefs[index], &fPathRefs[index])) {
reset();
+ *result = original;
return false;
}
sum.addPath(fPathRefs[index]);
}
reset();
- return Simplify(sum, result);
+ bool success = Simplify(sum, result);
+ if (!success) {
+ *result = original;
+ }
+ return success;
}
« no previous file with comments | « src/pathops/SkOpAngle.cpp ('k') | src/pathops/SkOpCoincidence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698