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

Unified Diff: include/effects/Sk2DPathEffect.h

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: guard constructors by SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS if used by Chrome. Created 6 years, 10 months 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
Index: include/effects/Sk2DPathEffect.h
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index 859b5cd95292f96f6ec5021e344b22b8071553a9..9e8b271d8a4c850a836cff9ee0524ea4bf088926 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -14,7 +14,9 @@
class SK_API Sk2DPathEffect : public SkPathEffect {
public:
- Sk2DPathEffect(const SkMatrix& mat);
+ static Sk2DPathEffect* Create(const SkMatrix& mat) {
+ return SkNEW_ARGS(Sk2DPathEffect, (mat));
+ }
virtual bool filterPath(SkPath*, const SkPath&,
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
@@ -22,6 +24,8 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
protected:
+ Sk2DPathEffect(const SkMatrix& mat);
+
/** New virtual, to be overridden by subclasses.
This is called once from filterPath, and provides the
uv parameter bounds for the path. Subsequent calls to
@@ -58,8 +62,9 @@ private:
class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
public:
- SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
- : Sk2DPathEffect(matrix), fWidth(width) {}
+ static SkLine2DPathEffect* Create(SkScalar width, const SkMatrix& matrix) {
+ return SkNEW_ARGS(SkLine2DPathEffect, (width, matrix));
+ }
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
@@ -67,6 +72,9 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLine2DPathEffect)
protected:
+ SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
+ : Sk2DPathEffect(matrix), fWidth(width) {}
+
virtual void nextSpan(int u, int v, int ucount, SkPath*) const SK_OVERRIDE;
SkLine2DPathEffect(SkReadBuffer&);
@@ -85,11 +93,14 @@ public:
* Stamp the specified path to fill the shape, using the matrix to define
* the latice.
*/
- SkPath2DPathEffect(const SkMatrix&, const SkPath&);
+ static SkPath2DPathEffect* Create(const SkMatrix& matrix, const SkPath& path) {
+ return SkNEW_ARGS(SkPath2DPathEffect, (matrix, path));
+ }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
protected:
+ SkPath2DPathEffect(const SkMatrix&, const SkPath&);
SkPath2DPathEffect(SkReadBuffer& buffer);
virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698