aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkDiscretePathEffect.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:40:19 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-20 20:40:19 +0000
commit0a2bf90dccba3bde188e0386a7f0c60e6dde1ae9 (patch)
treeaa5c4198b4a200d6efe87d1a81964c8c219c1091 /include/effects/SkDiscretePathEffect.h
parent4012ba51a218883daef6c9be142f970b8ef5d0d2 (diff)
Factory methods for heap-allocated SkPathEffect and SkXfermode objects.
This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkPathEffect, SkXfermode and their subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep the constructors of the following classes public to not break Chrome/Blink: SkXfermode SkCornerPathEffect SkDashPathEffect BUG=skia:2187 R=scroggo@google.com, reed@google.com, mtklein@google.com, bungeman@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/166583002 git-svn-id: http://skia.googlecode.com/svn/trunk@13519 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects/SkDiscretePathEffect.h')
-rw-r--r--include/effects/SkDiscretePathEffect.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h
index 60eb85274c..126b408218 100644
--- a/include/effects/SkDiscretePathEffect.h
+++ b/include/effects/SkDiscretePathEffect.h
@@ -20,7 +20,9 @@ public:
away from the original path by a maximum of deviation.
Note: works on filled or framed paths
*/
- SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
+ static SkDiscretePathEffect* Create(SkScalar segLength, SkScalar deviation) {
+ return SkNEW_ARGS(SkDiscretePathEffect, (segLength, deviation));
+ }
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
@@ -31,6 +33,11 @@ protected:
SkDiscretePathEffect(SkReadBuffer&);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
+
private:
SkScalar fSegLength, fPerterb;