Simplify firstdirection
Change-Id: I30d3056dc97a16c08b85fd77120485ef07b18d96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314037
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/pathops/SkOpBuilder.cpp b/src/pathops/SkOpBuilder.cpp
index 595553a..a52bf5b 100644
--- a/src/pathops/SkOpBuilder.cpp
+++ b/src/pathops/SkOpBuilder.cpp
@@ -42,13 +42,15 @@
} else if (fillType == SkPathFillType::kEvenOdd) {
fillType = SkPathFillType::kWinding;
}
- SkPathFirstDirection dir;
- if (one_contour(*path) && SkPathPriv::CheapComputeFirstDirection(*path, &dir)) {
- if (dir != SkPathFirstDirection::kCCW) {
- ReversePath(path);
+ if (one_contour(*path)) {
+ SkPathFirstDirection dir = SkPathPriv::ComputeFirstDirection(*path);
+ if (dir != SkPathFirstDirection::kUnknown) {
+ if (dir == SkPathFirstDirection::kCW) {
+ ReversePath(path);
+ }
+ path->setFillType(fillType);
+ return true;
}
- path->setFillType(fillType);
- return true;
}
SkSTArenaAlloc<4096> allocator;
SkOpContourHead contourHead;
@@ -136,8 +138,8 @@
}
// If all paths are convex, track direction, reversing as needed.
if (test->isConvex()) {
- SkPathFirstDirection dir;
- if (!SkPathPriv::CheapComputeFirstDirection(*test, &dir)) {
+ SkPathFirstDirection dir = SkPathPriv::ComputeFirstDirection(*test);
+ if (dir == SkPathFirstDirection::kUnknown) {
allUnion = false;
break;
}