From 4a21c94f40815d56c6dff6264a2ae6c942c52dcd Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Thu, 9 Mar 2017 07:51:09 -0500 Subject: move intermediate patheffect classes inside src BUG=skia: Change-Id: I49d2079ff35c7d228839940a57ba29169cb5b310 Reviewed-on: https://skia-review.googlesource.com/9462 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- include/core/SkPathEffect.h | 129 +++++--------------------------------------- 1 file changed, 14 insertions(+), 115 deletions(-) (limited to 'include/core') diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index 62f8993354..65adb33f3c 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -26,7 +26,21 @@ class SkStrokeRec; */ class SK_API SkPathEffect : public SkFlattenable { public: + /** + * Returns a patheffect that apples each effect (first and second) to the original path, + * and returns a path with the sum of these. + * + * result = first(path) + second(path) + * + */ static sk_sp MakeSum(sk_sp first, sk_sp second); + + /** + * Returns a patheffect that applies the inner effect to the path, and then applies the + * outer effect to the result of the inner's. + * + * result = outer(inner(path)) + */ static sk_sp MakeCompose(sk_sp outer, sk_sp inner); /** @@ -152,119 +166,4 @@ private: typedef SkFlattenable INHERITED; }; -#ifdef SK_SUPPORT_LEGACY_PATHEFFECT_SUBCLASSES - -/** \class SkPairPathEffect - - Common baseclass for Compose and Sum. This subclass manages two pathEffects, - including flattening them. It does nothing in filterPath, and is only useful - for managing the lifetimes of its two arguments. -*/ -class SK_API SkPairPathEffect : public SkPathEffect { -protected: - SkPairPathEffect(sk_sp pe0, sk_sp pe1); - - void flatten(SkWriteBuffer&) const override; - - // these are visible to our subclasses - sk_sp fPE0; - sk_sp fPE1; - - SK_TO_STRING_OVERRIDE() - -private: - typedef SkPathEffect INHERITED; -}; - -/** \class SkComposePathEffect - - This subclass of SkPathEffect composes its two arguments, to create - a compound pathEffect. -*/ -class SK_API SkComposePathEffect : public SkPairPathEffect { -public: - /** Construct a pathEffect whose effect is to apply first the inner pathEffect - and the the outer pathEffect (e.g. outer(inner(path))) - The reference counts for outer and inner are both incremented in the constructor, - and decremented in the destructor. - */ - static sk_sp Make(sk_sp outer, sk_sp inner) { - if (!outer) { - return inner; - } - if (!inner) { - return outer; - } - return sk_sp(new SkComposePathEffect(outer, inner)); - } - - virtual bool filterPath(SkPath* dst, const SkPath& src, - SkStrokeRec*, const SkRect*) const override; - - SK_TO_STRING_OVERRIDE() - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect) - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - bool exposedInAndroidJavaAPI() const override { return true; } -#endif - -protected: - SkComposePathEffect(sk_sp outer, sk_sp inner) - : INHERITED(outer, inner) {} - -private: - // illegal - SkComposePathEffect(const SkComposePathEffect&); - SkComposePathEffect& operator=(const SkComposePathEffect&); - friend class SkPathEffect; - - typedef SkPairPathEffect INHERITED; -}; - -/** \class SkSumPathEffect - - This subclass of SkPathEffect applies two pathEffects, one after the other. - Its filterPath() returns true if either of the effects succeeded. -*/ -class SK_API SkSumPathEffect : public SkPairPathEffect { -public: - /** Construct a pathEffect whose effect is to apply two effects, in sequence. - (e.g. first(path) + second(path)) - The reference counts for first and second are both incremented in the constructor, - and decremented in the destructor. - */ - static sk_sp Make(sk_sp first, sk_sp second) { - if (!first) { - return second; - } - if (!second) { - return first; - } - return sk_sp(new SkSumPathEffect(first, second)); - } - - virtual bool filterPath(SkPath* dst, const SkPath& src, - SkStrokeRec*, const SkRect*) const override; - - SK_TO_STRING_OVERRIDE() - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect) - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - bool exposedInAndroidJavaAPI() const override { return true; } -#endif - -protected: - SkSumPathEffect(sk_sp first, sk_sp second) - : INHERITED(first, second) {} - -private: - // illegal - SkSumPathEffect(const SkSumPathEffect&); - SkSumPathEffect& operator=(const SkSumPathEffect&); - friend class SkPathEffect; - - typedef SkPairPathEffect INHERITED; -}; -#endif - #endif -- cgit v1.2.3