Extend SkTrimPathEffect semantics
Add support for multiple contours, and an explicit "inverted" mode.
Bug: skia:
Change-Id: Iafadbbe9d4692f2467a4ef8585f7fcd9cee9566a
Reviewed-on: https://skia-review.googlesource.com/113270
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/include/effects/SkTrimPathEffect.h b/include/effects/SkTrimPathEffect.h
index d40c9e2..e96b94f 100644
--- a/include/effects/SkTrimPathEffect.h
+++ b/include/effects/SkTrimPathEffect.h
@@ -12,6 +12,11 @@
class SK_API SkTrimPathEffect {
public:
+ enum class Mode {
+ kNormal, // return the subset path [start,stop]
+ kInverted, // return the complement/subset paths [0,start] + [stop,1]
+ };
+
/**
* Take start and stop "t" values (values between 0...1), and return a path that is that
* subset of the original path.
@@ -26,11 +31,11 @@
* startT and stopT must be 0..1 inclusive. If they are outside of that interval, they will
* be pinned to the nearest legal value. If either is NaN, null will be returned.
*
- * Note: if startT < stopT, this will return one (logical) segment (even if it is spread
- * across multiple contours). If startT > stopT, then this will return 2 logical
+ * Note: for Mode::kNormal, this will return one (logical) segment (even if it is spread
+ * across multiple contours). For Mode::kInverted, this will return 2 logical
* segments: 0...stopT and startT...1
*/
- static sk_sp<SkPathEffect> Make(SkScalar startT, SkScalar stopT);
+ static sk_sp<SkPathEffect> Make(SkScalar startT, SkScalar stopT, Mode = Mode::kNormal);
};
#endif