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; |
} |