Create macro for registering classes for deserialization
Review URL: https://codereview.appspot.com/5909063
git-svn-id: http://skia.googlecode.com/svn/trunk@3494 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index 2151106..2a886bc 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -143,13 +143,13 @@
virtual void beginSession();
virtual void endSession();
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkFilterShader)
+
protected:
SkFilterShader(SkFlattenableReadBuffer& );
virtual void flatten(SkFlattenableWriteBuffer& ) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
+
private:
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkFilterShader, (buffer)); }
SkShader* fShader;
SkColorFilter* fFilter;
diff --git a/include/core/SkColorShader.h b/include/core/SkColorShader.h
index 6c6e11d..356e87a 100644
--- a/include/core/SkColorShader.h
+++ b/include/core/SkColorShader.h
@@ -49,13 +49,11 @@
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader)
protected:
SkColorShader(SkFlattenableReadBuffer&);
-
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
diff --git a/include/core/SkComposeShader.h b/include/core/SkComposeShader.h
index f243954..2fc1239 100644
--- a/include/core/SkComposeShader.h
+++ b/include/core/SkComposeShader.h
@@ -40,14 +40,13 @@
virtual void beginSession();
virtual void endSession();
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeShader)
+
protected:
SkComposeShader(SkFlattenableReadBuffer& );
virtual void flatten(SkFlattenableWriteBuffer& );
- virtual Factory getFactory() { return CreateProc; }
private:
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkComposeShader, (buffer)); }
SkShader* fShaderA;
SkShader* fShaderB;
diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h
index 1541c89..53e3d2b 100644
--- a/include/core/SkEmptyShader.h
+++ b/include/core/SkEmptyShader.h
@@ -30,14 +30,10 @@
virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkEmptyShader, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
protected:
SkEmptyShader(SkFlattenableReadBuffer&);
-
- virtual Factory getFactory() SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
private:
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h
index 4170e26..554ffc0 100644
--- a/include/core/SkFlattenable.h
+++ b/include/core/SkFlattenable.h
@@ -49,6 +49,15 @@
#endif
+#define SK_DECLARE_UNFLATTENABLE_OBJECT() \
+ virtual Factory getFactory() SK_OVERRIDE { return NULL; }; \
+
+#define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
+ virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }; \
+ static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { \
+ return SkNEW_ARGS(flattenable, (buffer)); \
+ }
+
/** \class SkFlattenable
SkFlattenable is the base class for objects that need to be flattened
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 26c4e6a..4d4fbc6 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -943,9 +943,7 @@
// overrides for SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&);
- virtual Factory getFactory();
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkStrokePathEffect)
private:
SkScalar fWidth, fMiter;
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index 880219f..48181ee 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -34,10 +34,15 @@
*/
virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width) = 0;
+protected:
+ SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
+
private:
// illegal
SkPathEffect(const SkPathEffect&);
SkPathEffect& operator=(const SkPathEffect&);
+
+ typedef SkFlattenable INHERITED;
};
/** \class SkPairPathEffect
@@ -80,12 +85,7 @@
virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkComposePathEffect, (buffer));
- }
-
-protected:
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
private:
SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
@@ -115,12 +115,7 @@
// overrides
virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkSumPathEffect, (buffer));
- }
-
-protected:
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
private:
SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
diff --git a/include/core/SkShape.h b/include/core/SkShape.h
index b40d886..3968fce 100644
--- a/include/core/SkShape.h
+++ b/include/core/SkShape.h
@@ -32,11 +32,8 @@
void drawMatrix(SkCanvas*, const SkMatrix&);
// overrides
- virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
-
- // public for Registrar
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkShape)
protected:
virtual void onDraw(SkCanvas*);
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index 4f28bb2..65e0f0d 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -215,8 +215,8 @@
const SkAlpha aa[]) SK_OVERRIDE;
// overrides from SkFlattenable
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcXfermode)
protected:
SkProcXfermode(SkFlattenableReadBuffer&);
@@ -229,9 +229,6 @@
private:
SkXfermodeProc fProc;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkProcXfermode, (buffer)); }
-
typedef SkXfermode INHERITED;
};
diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h
index 51a5a78..53126f2 100644
--- a/include/effects/Sk1DPathEffect.h
+++ b/include/effects/Sk1DPathEffect.h
@@ -59,9 +59,7 @@
// override from SkPathEffect
virtual bool filterPath(SkPath*, const SkPath&, SkScalar* width) SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkPath1DPathEffect, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
protected:
SkPath1DPathEffect(SkFlattenableReadBuffer& buffer);
@@ -71,7 +69,6 @@
virtual SkScalar next(SkPath*, SkScalar distance, SkPathMeasure&) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
SkPath fPath; // copied from constructor
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index f0d60ca..28c5aea 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -23,7 +23,7 @@
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
protected:
/** New virtual, to be overridden by subclasses.
@@ -53,8 +53,6 @@
Sk2DPathEffect(const Sk2DPathEffect&);
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
-
friend class Sk2DPathEffectBlitter;
typedef SkPathEffect INHERITED;
};
@@ -67,13 +65,12 @@
*/
SkPath2DPathEffect(const SkMatrix&, const SkPath&);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath2DPathEffect)
protected:
SkPath2DPathEffect(SkFlattenableReadBuffer& buffer);
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
virtual void next(const SkPoint&, int u, int v, SkPath* dst) SK_OVERRIDE;
private:
diff --git a/include/effects/SkAvoidXfermode.h b/include/effects/SkAvoidXfermode.h
index 8497265..db14f25 100644
--- a/include/effects/SkAvoidXfermode.h
+++ b/include/effects/SkAvoidXfermode.h
@@ -52,12 +52,8 @@
const SkAlpha aa[]) SK_OVERRIDE;
// overrides from SkFlattenable
- virtual Factory getFactory() SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkAvoidXfermode, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAvoidXfermode)
protected:
SkAvoidXfermode(SkFlattenableReadBuffer&);
@@ -67,8 +63,6 @@
uint32_t fDistMul; // x.14
Mode fMode;
- static SkFlattenable* Create(SkFlattenableReadBuffer&);
-
typedef SkXfermode INHERITED;
};
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h
index 46f72b9..453a618 100644
--- a/include/effects/SkBlurDrawLooper.h
+++ b/include/effects/SkBlurDrawLooper.h
@@ -44,15 +44,12 @@
virtual void init(SkCanvas*);
virtual bool next(SkCanvas*, SkPaint* paint);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkBlurDrawLooper, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
protected:
SkBlurDrawLooper(SkFlattenableReadBuffer&);
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& );
- virtual Factory getFactory() { return CreateProc; }
private:
SkMaskFilter* fBlur;
diff --git a/include/effects/SkBlurImageFilter.h b/include/effects/SkBlurImageFilter.h
index 2af31e8..846b900 100644
--- a/include/effects/SkBlurImageFilter.h
+++ b/include/effects/SkBlurImageFilter.h
@@ -17,9 +17,7 @@
virtual bool asABlur(SkSize* sigma) const SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkBlurImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
protected:
explicit SkBlurImageFilter(SkFlattenableReadBuffer& buffer);
@@ -27,7 +25,6 @@
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
SkSize fSigma;
diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h
index 62e8d3d..abfd95d 100644
--- a/include/effects/SkColorMatrixFilter.h
+++ b/include/effects/SkColorMatrixFilter.h
@@ -37,12 +37,9 @@
int32_t fResult[4];
};
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter)
protected:
- // overrides for SkFlattenable
- virtual Factory getFactory();
-
SkColorMatrixFilter(SkFlattenableReadBuffer& buffer);
private:
diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h
index b4d7f86..8c58476 100644
--- a/include/effects/SkCornerPathEffect.h
+++ b/include/effects/SkCornerPathEffect.h
@@ -31,11 +31,8 @@
// overrides for SkFlattenable
// This method is not exported to java.
- virtual Factory getFactory();
- // This method is not exported to java.
virtual void flatten(SkFlattenableWriteBuffer&);
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
protected:
SkCornerPathEffect(SkFlattenableReadBuffer&);
diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h
index 02ef391..76a3523 100644
--- a/include/effects/SkDiscretePathEffect.h
+++ b/include/effects/SkDiscretePathEffect.h
@@ -30,11 +30,8 @@
// overrides for SkFlattenable
// This method is not exported to java.
- virtual Factory getFactory();
- // This method is not exported to java.
virtual void flatten(SkFlattenableWriteBuffer&);
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)
protected:
SkDiscretePathEffect(SkFlattenableReadBuffer&);
diff --git a/include/effects/SkEmbossMaskFilter.h b/include/effects/SkEmbossMaskFilter.h
index c0e6b7e..a03a283 100644
--- a/include/effects/SkEmbossMaskFilter.h
+++ b/include/effects/SkEmbossMaskFilter.h
@@ -35,11 +35,10 @@
SkIPoint* margin);
// overrides from SkFlattenable
-
- // This method is not exported to java.
- virtual Factory getFactory();
// This method is not exported to java.
virtual void flatten(SkFlattenableWriteBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmbossMaskFilter)
+
protected:
SkEmbossMaskFilter(SkFlattenableReadBuffer&);
@@ -47,8 +46,6 @@
private:
Light fLight;
SkScalar fBlurRadius;
-
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
typedef SkMaskFilter INHERITED;
};
diff --git a/include/effects/SkGroupShape.h b/include/effects/SkGroupShape.h
index 76dd13d..56e9d32 100644
--- a/include/effects/SkGroupShape.h
+++ b/include/effects/SkGroupShape.h
@@ -132,11 +132,9 @@
void removeAllShapes();
// overrides
- virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
- // public for Registrar
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkGroupShape)
protected:
// overrides
diff --git a/include/effects/SkKernel33MaskFilter.h b/include/effects/SkKernel33MaskFilter.h
index 2b9e6d4..9c43629 100644
--- a/include/effects/SkKernel33MaskFilter.h
+++ b/include/effects/SkKernel33MaskFilter.h
@@ -50,14 +50,13 @@
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& wb);
- virtual Factory getFactory();
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkKernel33MaskFilter)
private:
int fKernel[3][3];
int fShift;
SkKernel33MaskFilter(SkFlattenableReadBuffer& rb);
- static SkFlattenable* Create(SkFlattenableReadBuffer& rb);
typedef SkKernel33ProcMaskFilter INHERITED;
};
diff --git a/include/effects/SkLayerDrawLooper.h b/include/effects/SkLayerDrawLooper.h
index b9b0802..3e7306f 100644
--- a/include/effects/SkLayerDrawLooper.h
+++ b/include/effects/SkLayerDrawLooper.h
@@ -101,17 +101,13 @@
virtual void init(SkCanvas*);
virtual bool next(SkCanvas*, SkPaint* paint);
- // must be public for Registrar :(
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkLayerDrawLooper, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerDrawLooper)
protected:
SkLayerDrawLooper(SkFlattenableReadBuffer&);
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& );
- virtual Factory getFactory() { return CreateProc; }
private:
struct Rec {
diff --git a/include/effects/SkLayerRasterizer.h b/include/effects/SkLayerRasterizer.h
index 50758b1..e31ed33 100644
--- a/include/effects/SkLayerRasterizer.h
+++ b/include/effects/SkLayerRasterizer.h
@@ -33,10 +33,9 @@
void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy);
// overrides from SkFlattenable
- virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer)
protected:
SkLayerRasterizer(SkFlattenableReadBuffer&);
diff --git a/include/effects/SkMorphologyImageFilter.h b/include/effects/SkMorphologyImageFilter.h
index 8d9f453..368d17b 100644
--- a/include/effects/SkMorphologyImageFilter.h
+++ b/include/effects/SkMorphologyImageFilter.h
@@ -33,10 +33,8 @@
virtual bool asADilate(SkISize* radius) const SK_OVERRIDE;
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkDilateImageFilter, (buffer));
- }
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
+
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
typedef SkMorphologyImageFilter INHERITED;
};
@@ -50,10 +48,7 @@
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkErodeImageFilter, (buffer));
- }
- virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
private:
typedef SkMorphologyImageFilter INHERITED;
diff --git a/include/effects/SkPixelXorXfermode.h b/include/effects/SkPixelXorXfermode.h
index b9975cf..fe0536d 100644
--- a/include/effects/SkPixelXorXfermode.h
+++ b/include/effects/SkPixelXorXfermode.h
@@ -22,12 +22,9 @@
SkPixelXorXfermode(SkColor opColor) : fOpColor(opColor) {}
// override from SkFlattenable
- virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkPixelXorXfermode, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPixelXorXfermode)
protected:
// override from SkXfermode
@@ -37,8 +34,6 @@
SkColor fOpColor;
SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
- // our private factory
- static SkFlattenable* Create(SkFlattenableReadBuffer&);
typedef SkXfermode INHERITED;
};
diff --git a/include/effects/SkRectShape.h b/include/effects/SkRectShape.h
index b521846..b0efc28 100644
--- a/include/effects/SkRectShape.h
+++ b/include/effects/SkRectShape.h
@@ -41,11 +41,9 @@
void setRRect(const SkRect&, SkScalar rx, SkScalar ry);
// overrides
- virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
- // public for Registrar
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRectShape)
protected:
SkRectShape(SkFlattenableReadBuffer&);
diff --git a/include/effects/SkTableMaskFilter.h b/include/effects/SkTableMaskFilter.h
index f213de7..15bb930 100644
--- a/include/effects/SkTableMaskFilter.h
+++ b/include/effects/SkTableMaskFilter.h
@@ -53,11 +53,10 @@
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& wb);
- virtual Factory getFactory();
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTableMaskFilter)
protected:
SkTableMaskFilter(SkFlattenableReadBuffer& rb);
- static SkFlattenable* Factory(SkFlattenableReadBuffer&);
private:
uint8_t fTable[256];
diff --git a/include/effects/SkTestImageFilters.h b/include/effects/SkTestImageFilters.h
index 55522c1..e2c9cf4 100755
--- a/include/effects/SkTestImageFilters.h
+++ b/include/effects/SkTestImageFilters.h
@@ -11,9 +11,7 @@
fOffset.set(dx, dy);
}
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkOffsetImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkOffsetImageFilter)
protected:
SkOffsetImageFilter(SkFlattenableReadBuffer& buffer);
@@ -23,7 +21,6 @@
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
SkVector fOffset;
@@ -41,9 +38,7 @@
}
virtual ~SkComposeImageFilter();
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkComposeImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeImageFilter)
protected:
SkComposeImageFilter(SkFlattenableReadBuffer& buffer);
@@ -53,7 +48,6 @@
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
SkImageFilter* fOuter;
@@ -72,9 +66,7 @@
const SkXfermode::Mode modes[] = NULL);
virtual ~SkMergeImageFilter();
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkMergeImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
protected:
SkMergeImageFilter(SkFlattenableReadBuffer& buffer);
@@ -84,7 +76,6 @@
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
SkImageFilter** fFilters;
@@ -108,9 +99,7 @@
}
virtual ~SkColorFilterImageFilter();
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkColorFilterImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorFilterImageFilter)
protected:
SkColorFilterImageFilter(SkFlattenableReadBuffer& buffer);
@@ -119,7 +108,6 @@
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
SkColorFilter* fColorFilter;
@@ -134,9 +122,7 @@
public:
SkDownSampleImageFilter(SkScalar scale) : fScale(scale) {}
- static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkDownSampleImageFilter, (buffer));
- }
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDownSampleImageFilter)
protected:
SkDownSampleImageFilter(SkFlattenableReadBuffer& buffer);
@@ -145,7 +131,6 @@
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
- virtual Factory getFactory() SK_OVERRIDE;
private:
SkScalar fScale;
diff --git a/include/effects/SkTransparentShader.h b/include/effects/SkTransparentShader.h
index e951bba..0aa9192 100644
--- a/include/effects/SkTransparentShader.h
+++ b/include/effects/SkTransparentShader.h
@@ -24,8 +24,8 @@
virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
// overrides for SkFlattenable
- virtual Factory getFactory() SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTransparentShader)
private:
// these are a cache from the call to setContext()
@@ -34,10 +34,6 @@
SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
- static SkFlattenable* Create(SkFlattenableReadBuffer& buffer) {
- return SkNEW_ARGS(SkTransparentShader, (buffer));
- }
-
typedef SkShader INHERITED;
};
diff --git a/include/utils/SkUnitMappers.h b/include/utils/SkUnitMappers.h
index a14f1af..d8856ae 100644
--- a/include/utils/SkUnitMappers.h
+++ b/include/utils/SkUnitMappers.h
@@ -20,17 +20,17 @@
// override from SkUnitMapper
virtual uint16_t mapUnit16(uint16_t x);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscreteMapper)
+
protected:
SkDiscreteMapper(SkFlattenableReadBuffer& );
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& );
- virtual Factory getFactory();
+
private:
int fSegments;
SkFract fScale; // computed from fSegments
- static SkFlattenable* Create(SkFlattenableReadBuffer& buffer);
-
typedef SkUnitMapper INHERITED;
};
@@ -43,13 +43,12 @@
// override from SkUnitMapper
virtual uint16_t mapUnit16(uint16_t x);
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCosineMapper)
+
protected:
SkCosineMapper(SkFlattenableReadBuffer&);
- // overrides from SkFlattenable
- virtual Factory getFactory();
private:
- static SkFlattenable* Create(SkFlattenableReadBuffer&);
typedef SkUnitMapper INHERITED;
};