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

Unified Diff: src/pathops/SkOpBuilder.cpp

Issue 2481463002: use reversePathTo in place of addPathReverse (Closed)
Patch Set: fix nanobench; stop after one contour Created 4 years, 1 month 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/core/SkPath.cpp ('k') | src/pathops/SkPathWriter.cpp » ('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 011d6a6aba0fb0f344e14d9e5b2e3539a8c0dbc2..075520d2c1a42b195a4689ee7d614abb8bdc7d88 100644
--- a/src/pathops/SkOpBuilder.cpp
+++ b/src/pathops/SkOpBuilder.cpp
@@ -25,7 +25,17 @@ static bool one_contour(const SkPath& path) {
return true;
}
-bool FixWinding(SkPath* path) {
+void SkOpBuilder::ReversePath(SkPath* path) {
+ SkPath temp;
+ SkPoint lastPt;
+ SkAssertResult(path->getLastPt(&lastPt));
+ temp.moveTo(lastPt);
+ temp.reversePathTo(*path);
+ temp.close();
+ *path = temp;
+}
+
+bool SkOpBuilder::FixWinding(SkPath* path) {
SkPath::FillType fillType = path->getFillType();
if (fillType == SkPath::kInverseEvenOdd_FillType) {
fillType = SkPath::kInverseWinding_FillType;
@@ -35,9 +45,7 @@ bool FixWinding(SkPath* path) {
SkPathPriv::FirstDirection dir;
if (one_contour(*path) && SkPathPriv::CheapComputeFirstDirection(*path, &dir)) {
if (dir != SkPathPriv::kCCW_FirstDirection) {
- SkPath temp;
- temp.reverseAddPath(*path);
- *path = temp;
+ ReversePath(path);
}
path->setFillType(fillType);
return true;
@@ -133,9 +141,7 @@ bool SkOpBuilder::resolve(SkPath* result) {
if (firstDir == SkPathPriv::kUnknown_FirstDirection) {
firstDir = dir;
} else if (firstDir != dir) {
- SkPath temp;
- temp.reverseAddPath(*test);
- *test = temp;
+ ReversePath(test);
}
continue;
}
« no previous file with comments | « src/core/SkPath.cpp ('k') | src/pathops/SkPathWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698