aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-09 18:14:31 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-08-09 18:14:31 +0000
commite28b917669fc4677b2f1c0a08c4711b651cbf1a1 (patch)
treeb1f16207d6bdfdb5b073ffb1535fa20f1cc87448
parenteefe6f1eef1b5cd394853a3f31a92c3c8db62c45 (diff)
register 1D and 2D patheffects, so they work when serialized (and piperized)
git-svn-id: http://skia.googlecode.com/svn/trunk@2085 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/effects/Sk1DPathEffect.h8
-rw-r--r--include/effects/Sk2DPathEffect.h4
-rw-r--r--src/effects/Sk1DPathEffect.cpp5
-rw-r--r--src/effects/Sk2DPathEffect.cpp3
4 files changed, 14 insertions, 6 deletions
diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h
index 8d353393d6..1ba824cb23 100644
--- a/include/effects/Sk1DPathEffect.h
+++ b/include/effects/Sk1DPathEffect.h
@@ -59,6 +59,10 @@ public:
// override from SkPathEffect
virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
+ return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
+ }
+
protected:
SkPath1DPathEffect(SkFlattenableReadBuffer& buffer);
@@ -74,10 +78,6 @@ private:
SkScalar fAdvance; // copied from constructor
SkScalar fInitialOffset; // computed from phase
Style fStyle; // copied from constructor
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
- }
typedef Sk1DPathEffect INHERITED;
};
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index 7534561caa..22b5dd360b 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -29,6 +29,8 @@ public:
// This method is not exported to java.
virtual Factory getFactory();
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+
protected:
/** New virtual, to be overridden by subclasses.
This is called once from filterPath, and provides the
@@ -57,8 +59,6 @@ private:
Sk2DPathEffect(const Sk2DPathEffect&);
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
-
friend class Sk2DPathEffectBlitter;
typedef SkPathEffect INHERITED;
};
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index bcc77dfa0b..0df8cbd9c1 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -196,3 +196,8 @@ SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance, SkPathMeasure&
return fAdvance;
}
+///////////////////////////////////////////////////////////////////////////////
+
+static SkFlattenable::Registrar gReg("SkPath1DPathEffect",
+ SkPath1DPathEffect::CreateProc);
+
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 37ceabde9b..b205f7042b 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -100,5 +100,8 @@ SkFlattenable* Sk2DPathEffect::CreateProc(SkFlattenableReadBuffer& buffer)
return SkNEW_ARGS(Sk2DPathEffect, (buffer));
}
+///////////////////////////////////////////////////////////////////////////////
+static SkFlattenable::Registrar gReg("Sk2DPathEffect",
+ Sk2DPathEffect::CreateProc);