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
This commit is contained in:
djsollen@google.com 2012-03-26 17:57:35 +00:00
Родитель d43b0a87f8
Коммит ba28d03e94
65 изменённых файлов: 121 добавлений и 498 удалений

Просмотреть файл

@ -17,8 +17,8 @@
class FailImageFilter : public SkImageFilter {
public:
FailImageFilter() {}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; };
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) {
@ -28,18 +28,18 @@ protected:
FailImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return new FailImageFilter(buffer);
}
typedef SkImageFilter INHERITED;
};
// register the filter with the flattenable registry
static SkFlattenable::Registrar gFailImageFilterReg("FailImageFilter",
FailImageFilter::CreateProc);
class IdentityImageFilter : public SkImageFilter {
public:
IdentityImageFilter() {}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; };
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
protected:
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) {
@ -50,13 +50,14 @@ protected:
IdentityImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return new IdentityImageFilter(buffer);
}
typedef SkImageFilter INHERITED;
};
// register the filter with the flattenable registry
static SkFlattenable::Registrar gIdentityImageFilterReg("IdentityImageFilter",
IdentityImageFilter::CreateProc);
///////////////////////////////////////////////////////////////////////////////
static void draw_paint(SkCanvas* canvas, const SkRect& r, SkImageFilter* imf) {

Просмотреть файл

@ -143,13 +143,13 @@ public:
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;

Просмотреть файл

@ -49,13 +49,11 @@ public:
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:

Просмотреть файл

@ -40,14 +40,13 @@ public:
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;

Просмотреть файл

@ -30,14 +30,10 @@ public:
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:

Просмотреть файл

@ -49,6 +49,15 @@ class SkString;
#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

Просмотреть файл

@ -943,9 +943,7 @@ public:
// 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;

Просмотреть файл

@ -34,10 +34,15 @@ public:
*/
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 @@ public:
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 @@ public:
// 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) {}

Просмотреть файл

@ -32,11 +32,8 @@ public:
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*);

Просмотреть файл

@ -215,8 +215,8 @@ public:
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 @@ protected:
private:
SkXfermodeProc fProc;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkProcXfermode, (buffer)); }
typedef SkXfermode INHERITED;
};

Просмотреть файл

@ -59,9 +59,7 @@ public:
// 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 @@ protected:
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

Просмотреть файл

@ -23,7 +23,7 @@ public:
// 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 @@ private:
Sk2DPathEffect(const Sk2DPathEffect&);
Sk2DPathEffect& operator=(const Sk2DPathEffect&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
friend class Sk2DPathEffectBlitter;
typedef SkPathEffect INHERITED;
};
@ -67,13 +65,12 @@ public:
*/
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:

Просмотреть файл

@ -52,12 +52,8 @@ public:
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 @@ private:
uint32_t fDistMul; // x.14
Mode fMode;
static SkFlattenable* Create(SkFlattenableReadBuffer&);
typedef SkXfermode INHERITED;
};

Просмотреть файл

@ -44,15 +44,12 @@ public:
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;

Просмотреть файл

@ -17,9 +17,7 @@ public:
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 @@ protected:
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;

Просмотреть файл

@ -37,12 +37,9 @@ public:
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:

Просмотреть файл

@ -31,11 +31,8 @@ public:
// 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&);

Просмотреть файл

@ -30,11 +30,8 @@ public:
// 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&);

Просмотреть файл

@ -35,11 +35,10 @@ public:
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 @@ protected:
private:
Light fLight;
SkScalar fBlurRadius;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
typedef SkMaskFilter INHERITED;
};

Просмотреть файл

@ -132,11 +132,9 @@ public:
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

Просмотреть файл

@ -50,14 +50,13 @@ public:
// 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;
};

Просмотреть файл

@ -101,17 +101,13 @@ public:
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 {

Просмотреть файл

@ -33,10 +33,9 @@ public:
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&);

Просмотреть файл

@ -33,10 +33,8 @@ public:
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 @@ public:
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;

Просмотреть файл

@ -22,12 +22,9 @@ public:
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 @@ private:
SkColor fOpColor;
SkPixelXorXfermode(SkFlattenableReadBuffer& rb);
// our private factory
static SkFlattenable* Create(SkFlattenableReadBuffer&);
typedef SkXfermode INHERITED;
};

Просмотреть файл

@ -41,11 +41,9 @@ public:
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&);

Просмотреть файл

@ -53,11 +53,10 @@ public:
// 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];

Просмотреть файл

@ -11,9 +11,7 @@ public:
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 @@ protected:
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 @@ public:
}
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 @@ protected:
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 @@ public:
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 @@ protected:
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 @@ public:
}
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 @@ protected:
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 @@ class SkDownSampleImageFilter : public SkImageFilter {
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 @@ protected:
SkBitmap* result, SkIPoint* loc) SK_OVERRIDE;
// overrides from SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE;
private:
SkScalar fScale;

Просмотреть файл

@ -24,8 +24,8 @@ public:
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 @@ private:
SkTransparentShader(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
static SkFlattenable* Create(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkTransparentShader, (buffer));
}
typedef SkShader INHERITED;
};

Просмотреть файл

@ -20,17 +20,17 @@ public:
// 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 @@ public:
// 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;
};

Просмотреть файл

@ -76,7 +76,8 @@ public:
buffer.writeScalar(fRadius);
}
virtual Factory getFactory() { return CreateProc; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
protected:
virtual void begin(const SkIRect& uvBounds, SkPath* dst) {
@ -103,11 +104,6 @@ private:
SkScalar fRadius;
SkTDArray<SkPoint>* fPts;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer)
{
return new Dot2DPathEffect(buffer);
}
typedef Sk2DPathEffect INHERITED;
};
@ -119,13 +115,12 @@ public:
dst->setFillType(SkPath::kInverseWinding_FillType);
return true;
}
virtual Factory getFactory() { return Factory; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(InverseFillPE)
protected:
// InverseFillPE(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
InverseFillPE(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
static SkFlattenable* Factory(SkFlattenableReadBuffer& buffer) {
return new InverseFillPE;
}
typedef SkPathEffect INHERITED;
};

Просмотреть файл

@ -164,7 +164,7 @@ public:
buffer.writeScalar(fRadius);
}
virtual Factory getFactory() { return CreateProc; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Dot2DPathEffect)
protected:
virtual void next(const SkPoint& loc, int u, int v, SkPath* dst) {
@ -177,10 +177,6 @@ protected:
private:
SkScalar fRadius;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return new Dot2DPathEffect(buffer);
}
typedef Sk2DPathEffect INHERITED;
};
@ -222,11 +218,13 @@ public:
return false;
}
virtual Factory getFactory() { return CreateProc; }
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fWidth);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Line2DPathEffect)
protected:
virtual void nextSpan(int u, int v, int ucount, SkPath* dst) {
if (ucount > 1) {
@ -250,8 +248,6 @@ protected:
private:
SkScalar fWidth;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { return new Line2DPathEffect(buffer); }
typedef Sk2DPathEffect INHERITED;
};

Просмотреть файл

@ -612,12 +612,13 @@ public:
return false;
}
virtual Factory getFactory() { return CreateProc; }
virtual void flatten(SkFlattenableWriteBuffer& buffer)
{
this->INHERITED::flatten(buffer);
buffer.writeScalar(fWidth);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Line2DPathEffect)
protected:
virtual void nextSpan(int u, int v, int ucount, SkPath* dst)
{
@ -644,11 +645,6 @@ protected:
private:
SkScalar fWidth;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer)
{
return new Line2DPathEffect(buffer);
}
typedef Sk2DPathEffect INHERITED;
};

Просмотреть файл

@ -54,12 +54,10 @@ public:
// if (c < min) c = min;
return c;
}
virtual Factory getFactory() { return Create; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ReduceNoise)
private:
ReduceNoise(SkFlattenableReadBuffer& rb) : SkKernel33ProcMaskFilter(rb) {}
static SkFlattenable* Create(SkFlattenableReadBuffer& rb) {
return new ReduceNoise(rb);
}
};
class Darken : public SkKernel33ProcMaskFilter {
@ -78,12 +76,10 @@ public:
SkASSERT(f >= 0 && f <= 1);
return (int)(f * 255);
}
virtual Factory getFactory() { return Create; }
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Darken)
private:
Darken(SkFlattenableReadBuffer& rb) : SkKernel33ProcMaskFilter(rb) {}
static SkFlattenable* Create(SkFlattenableReadBuffer& rb) {
return new Darken(rb);
}
};
static SkMaskFilter* makemf() { return new Darken(0x30); }
@ -136,11 +132,11 @@ public:
typedef SkFlattenable* (*Factory)(SkFlattenableReadBuffer&);
// overrides for SkFlattenable
virtual Factory getFactory() { return Create; }
virtual void flatten(SkFlattenableWriteBuffer& b) {
// this->INHERITED::flatten(b); How can we know if this is legal????
b.write32(SkScalarToFixed(fExp));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPowerMode)
private:
SkScalar fExp; // user's value
@ -151,9 +147,6 @@ private:
// read the exponent
this->init(SkFixedToScalar(b.readS32()));
}
static SkFlattenable* Create(SkFlattenableReadBuffer& b) {
return SkNEW_ARGS(SkPowerMode, (b));
}
typedef SkXfermode INHERITED;
};

Просмотреть файл

@ -189,11 +189,11 @@ public:
return false;
}
virtual Factory getFactory() { return CreateProc; }
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fWidth);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Line2DPathEffect)
protected:
virtual void nextSpan(int u, int v, int ucount, SkPath* dst) {
@ -218,10 +218,6 @@ protected:
private:
SkScalar fWidth;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return new Line2DPathEffect(buffer);
}
typedef Sk2DPathEffect INHERITED;
};

Просмотреть файл

@ -91,6 +91,8 @@ public:
fDraw(draw), fMaker(maker) {
}
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
virtual SkScalar begin(SkScalar contourLength)
{
@ -139,7 +141,6 @@ protected:
private:
virtual void flatten(SkFlattenableWriteBuffer& ) {}
virtual Factory getFactory() { return NULL; }
static bool GetContourLength(const char* token, size_t len, void* clen, SkScriptValue* value) {
if (SK_LITERAL_STR_EQUAL("contourLength", token, len)) {

Просмотреть файл

@ -35,8 +35,7 @@ public:
SkGradientUnitMapper(SkAnimateMaker* maker, const char* script) : fMaker(maker), fScript(script) {
}
// overrides for SkFlattenable
virtual Factory getFactory() { return NULL; }
SK_DECLARE_UNFLATTENABLE_OBJECT()
protected:
virtual uint16_t mapUnit16(uint16_t x) {

Просмотреть файл

@ -30,17 +30,13 @@ public:
static bool CanDo(const SkBitmap&, TileMode tx, TileMode ty);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkBitmapProcShader, (buffer));
}
// override from flattenable
virtual bool toDumpString(SkString* str) const;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapProcShader)
protected:
SkBitmapProcShader(SkFlattenableReadBuffer& );
virtual void flatten(SkFlattenableWriteBuffer& );
virtual Factory getFactory() { return CreateProc; }
SkBitmap fRawBitmap; // experimental for RLE encoding
SkBitmapProcState fState;

Просмотреть файл

@ -656,6 +656,8 @@ public:
this->INHERITED::endSession();
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk3DShader)
protected:
Sk3DShader(SkFlattenableReadBuffer& buffer) :
INHERITED(buffer) {
@ -670,15 +672,7 @@ protected:
buffer.write32(fPMColor);
}
virtual Factory getFactory() {
return CreateProc;
}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Sk3DShader, (buffer));
}
SkShader* fProxy;
SkPMColor fPMColor;
const SkMask* fMask;

Просмотреть файл

@ -2212,18 +2212,15 @@ public:
virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTriColorShader)
protected:
SkTriColorShader(SkFlattenableReadBuffer& buffer) : SkShader(buffer) {}
virtual Factory getFactory() { return CreateProc; }
private:
SkMatrix fDstToUnit;
SkPMColor fColors[3];
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkTriColorShader, (buffer));
}
typedef SkShader INHERITED;
};

Просмотреть файл

@ -108,14 +108,6 @@ bool SkStrokePathEffect::filterPath(SkPath* dst, const SkPath& src,
return true;
}
SkFlattenable::Factory SkStrokePathEffect::getFactory() {
return CreateProc;
}
SkFlattenable* SkStrokePathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkStrokePathEffect, (buffer));
}
void SkStrokePathEffect::flatten(SkFlattenableWriteBuffer& buffer) {
buffer.writeScalar(fWidth);
buffer.writeScalar(fMiter);

Просмотреть файл

@ -247,14 +247,6 @@ void SkColorShader::flatten(SkFlattenableWriteBuffer& buffer) {
buffer.write32(fColor);
}
SkFlattenable* SkColorShader::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkColorShader, (buffer));
}
SkFlattenable::Factory SkColorShader::getFactory() {
return CreateProc;
}
uint32_t SkColorShader::getFlags() {
return fFlags;
}
@ -359,8 +351,6 @@ void SkEmptyShader::shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) {
SkDEBUGFAIL("should never get called, since setContext() returned false");
}
SkFlattenable::Factory SkEmptyShader::getFactory() { return NULL; }
void SkEmptyShader::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
}

Просмотреть файл

@ -60,14 +60,6 @@ SkShape::SkShape(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
inc_shape(this);
}
SkFlattenable* SkShape::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkShape, (buffer));
}
SkFlattenable::Factory SkShape::getFactory() {
return CreateProc;
}
void SkShape::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
}

Просмотреть файл

@ -729,15 +729,12 @@ public:
return true;
}
virtual Factory getFactory() { return CreateProc; }
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
buffer.write32(fMode);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkProcCoeffXfermode, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode)
protected:
SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer)
@ -768,11 +765,8 @@ public:
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkClearXfermode, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkClearXfermode)
private:
SkClearXfermode(SkFlattenableReadBuffer& buffer)
@ -825,11 +819,8 @@ public:
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkSrcXfermode, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSrcXfermode)
private:
SkSrcXfermode(SkFlattenableReadBuffer& buffer)
@ -887,11 +878,8 @@ public:
SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode) {}
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkDstInXfermode, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDstInXfermode)
private:
SkDstInXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
@ -926,11 +914,8 @@ public:
SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mode) {}
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkDstOutXfermode, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDstOutXfermode)
private:
SkDstOutXfermode(SkFlattenableReadBuffer& buffer)

Просмотреть файл

@ -80,14 +80,6 @@ Sk2DPathEffect::Sk2DPathEffect(SkFlattenableReadBuffer& buffer) {
fMatrix.invert(&fInverse);
}
SkFlattenable::Factory Sk2DPathEffect::getFactory() {
return CreateProc;
}
SkFlattenable* Sk2DPathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Sk2DPathEffect, (buffer));
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@ -100,19 +92,11 @@ SkPath2DPathEffect::SkPath2DPathEffect(SkFlattenableReadBuffer& buffer)
fPath.unflatten(buffer);
}
SkFlattenable* SkPath2DPathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkPath2DPathEffect, (buffer));
}
void SkPath2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
fPath.flatten(buffer);
}
SkFlattenable::Factory SkPath2DPathEffect::getFactory() {
return CreateProc;
}
void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, SkPath* dst) {
dst->addPath(fPath, loc.fX, loc.fY);
}

Просмотреть файл

@ -13,20 +13,13 @@ public:
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE;
static SkFlattenable* Create(SkFlattenableReadBuffer& buffer) {
return NULL;
}
SK_DECLARE_UNFLATTENABLE_OBJECT()
private:
SkScalar fK[4];
};
SkFlattenable::Factory SkArithmeticMode_scalar::getFactory() {
return Create;
}
static int pinToByte(int value) {
if (value < 0) {
value = 0;

Просмотреть файл

@ -38,16 +38,6 @@ void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer)
buffer.write8(fMode);
}
SkFlattenable* SkAvoidXfermode::Create(SkFlattenableReadBuffer& rb)
{
return SkNEW_ARGS(SkAvoidXfermode, (rb));
}
SkFlattenable::Factory SkAvoidXfermode::getFactory()
{
return Create;
}
// returns 0..31
static unsigned color_dist16(uint16_t c, unsigned r, unsigned g, unsigned b)
{

Просмотреть файл

@ -25,10 +25,9 @@ public:
virtual void computeFastBounds(const SkRect& src, SkRect* dst) SK_OVERRIDE;
// overrides from SkFlattenable
virtual Factory getFactory() SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
private:
SkScalar fRadius;
@ -104,14 +103,6 @@ void SkBlurMaskFilterImpl::computeFastBounds(const SkRect& src, SkRect* dst) {
src.fRight + fRadius, src.fBottom + fRadius);
}
SkFlattenable* SkBlurMaskFilterImpl::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkBlurMaskFilterImpl, (buffer));
}
SkFlattenable::Factory SkBlurMaskFilterImpl::getFactory() {
return CreateProc;
}
SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkFlattenableReadBuffer& buffer)
: SkMaskFilter(buffer) {
fRadius = buffer.readScalar();

Просмотреть файл

@ -96,13 +96,9 @@ public:
sk_memset16(result, SkPixel32ToPixel16(fPMColor), count);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Src_SkModeColorFilter, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Src_SkModeColorFilter)
protected:
virtual Factory getFactory() { return CreateProc; }
Src_SkModeColorFilter(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
@ -139,13 +135,9 @@ public:
sk_memset16(result, SkPixel32ToPixel16(fPMColor), count);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SrcOver_SkModeColorFilter, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SrcOver_SkModeColorFilter)
protected:
virtual Factory getFactory() { return CreateProc; }
SrcOver_SkModeColorFilter(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer), fColor32Proc(NULL) {}
@ -198,9 +190,7 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Proc_SkModeColorFilter, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Proc_SkModeColorFilter)
protected:
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
@ -209,10 +199,6 @@ protected:
buffer.writeFunctionPtr((void*)fProc16);
}
virtual Factory getFactory() {
return CreateProc;
}
Proc_SkModeColorFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
fProc = (SkXfermodeProc) buffer.readFunctionPtr();
fProc16 = (SkXfermodeProc16) buffer.readFunctionPtr();
@ -323,9 +309,7 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter)
protected:
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
@ -334,10 +318,6 @@ protected:
buffer.write32(fAdd);
}
virtual Factory getFactory() {
return CreateProc;
}
SkLightingColorFilter(SkFlattenableReadBuffer& buffer) {
fMul = buffer.readU32();
fAdd = buffer.readU32();
@ -374,13 +354,9 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter_JustAdd, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter_JustAdd)
protected:
virtual Factory getFactory() { return CreateProc; }
SkLightingColorFilter_JustAdd(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
@ -412,13 +388,9 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter_JustMul, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter_JustMul)
protected:
virtual Factory getFactory() { return CreateProc; }
SkLightingColorFilter_JustMul(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
@ -453,13 +425,9 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter_SingleMul, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter_SingleMul)
protected:
virtual Factory getFactory() { return CreateProc; }
SkLightingColorFilter_SingleMul(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
@ -496,13 +464,9 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter_NoPin, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter_NoPin)
protected:
virtual Factory getFactory() { return CreateProc; }
SkLightingColorFilter_NoPin(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}

Просмотреть файл

@ -318,8 +318,6 @@ void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) {
buffer.write32(fFlags);
}
SkFlattenable::Factory SkColorMatrixFilter::getFactory() { return CreateProc; }
SkColorMatrixFilter::SkColorMatrixFilter(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {
fProc = (Proc)buffer.readFunctionPtr();
@ -344,10 +342,6 @@ bool SkColorMatrixFilter::asColorMatrix(SkScalar matrix[20]) {
return true;
}
SkFlattenable* SkColorMatrixFilter::CreateProc(SkFlattenableReadBuffer& buf) {
return SkNEW_ARGS(SkColorMatrixFilter, (buf));
}
void SkColorMatrixFilter::setMatrix(const SkColorMatrix& matrix) {
setup(matrix.fMat);
}

Просмотреть файл

@ -129,18 +129,10 @@ DONE:
return true;
}
SkFlattenable::Factory SkCornerPathEffect::getFactory() {
return CreateProc;
}
void SkCornerPathEffect::flatten(SkFlattenableWriteBuffer& buffer) {
buffer.writeScalar(fRadius);
}
SkFlattenable* SkCornerPathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkCornerPathEffect, (buffer));
}
SkCornerPathEffect::SkCornerPathEffect(SkFlattenableReadBuffer& buffer) {
fRadius = buffer.readScalar();
}

Просмотреть файл

@ -67,14 +67,6 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src,
return true;
}
SkFlattenable::Factory SkDiscretePathEffect::getFactory() {
return CreateProc;
}
SkFlattenable* SkDiscretePathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkDiscretePathEffect, (buffer));
}
void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) {
buffer.writeScalar(fSegLength);
buffer.writeScalar(fPerterb);

Просмотреть файл

@ -115,14 +115,6 @@ bool SkEmbossMaskFilter::filterMask(SkMask* dst, const SkMask& src,
return true;
}
SkFlattenable* SkEmbossMaskFilter::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkEmbossMaskFilter, (buffer));
}
SkFlattenable::Factory SkEmbossMaskFilter::getFactory() {
return CreateProc;
}
SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer)
: SkMaskFilter(buffer) {
buffer.read(&fLight, sizeof(fLight));

Просмотреть файл

@ -849,10 +849,6 @@ public:
SkScalar* twoPointRadialParams) const SK_OVERRIDE;
virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Linear_Gradient, (buffer));
}
virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fStart.fX);
@ -861,13 +857,14 @@ public:
buffer.writeScalar(fEnd.fY);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Linear_Gradient)
protected:
Linear_Gradient(SkFlattenableReadBuffer& buffer)
: Gradient_Shader(buffer),
fStart(unflatten_point(buffer)),
fEnd(unflatten_point(buffer)) {
}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
typedef Gradient_Shader INHERITED;
@ -1510,10 +1507,6 @@ public:
return kRadial_GradientType;
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Radial_Gradient, (buffer));
}
virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fCenter.fX);
@ -1521,13 +1514,14 @@ public:
buffer.writeScalar(fRadius);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Radial_Gradient)
protected:
Radial_Gradient(SkFlattenableReadBuffer& buffer)
: Gradient_Shader(buffer),
fCenter(unflatten_point(buffer)),
fRadius(buffer.readScalar()) {
}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
typedef Gradient_Shader INHERITED;
@ -2045,10 +2039,6 @@ public:
return true;
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Two_Point_Radial_Gradient, (buffer));
}
virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fCenter1.fX);
@ -2059,6 +2049,8 @@ public:
buffer.writeScalar(fRadius2);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Two_Point_Radial_Gradient)
protected:
Two_Point_Radial_Gradient(SkFlattenableReadBuffer& buffer)
: Gradient_Shader(buffer),
@ -2068,7 +2060,6 @@ protected:
fRadius2(buffer.readScalar()) {
init();
};
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
typedef Gradient_Shader INHERITED;
@ -2134,24 +2125,20 @@ public:
return kSweep_GradientType;
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Sweep_Gradient, (buffer));
}
virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fCenter.fX);
buffer.writeScalar(fCenter.fY);
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sweep_Gradient)
protected:
Sweep_Gradient(SkFlattenableReadBuffer& buffer)
: Gradient_Shader(buffer),
fCenter(unflatten_point(buffer)) {
}
virtual Factory getFactory() SK_OVERRIDE { return CreateProc; }
private:
typedef Gradient_Shader INHERITED;
const SkPoint fCenter;

Просмотреть файл

@ -83,10 +83,6 @@ void SkGroupShape::onDraw(SkCanvas* canvas) {
}
}
SkFlattenable::Factory SkGroupShape::getFactory() {
return CreateProc;
}
void SkGroupShape::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
@ -127,9 +123,5 @@ SkGroupShape::SkGroupShape(SkFlattenableReadBuffer& buffer) : INHERITED(buffer){
}
}
SkFlattenable* SkGroupShape::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkGroupShape, (buffer));
}
SK_DEFINE_FLATTENABLE_REGISTRAR(SkGroupShape)

Просмотреть файл

@ -110,14 +110,6 @@ void SkKernel33MaskFilter::flatten(SkFlattenableWriteBuffer& wb) {
wb.write32(fShift);
}
SkFlattenable::Factory SkKernel33MaskFilter::getFactory() {
return Create;
}
SkFlattenable* SkKernel33MaskFilter::Create(SkFlattenableReadBuffer& rb) {
return new SkKernel33MaskFilter(rb);
}
SkKernel33MaskFilter::SkKernel33MaskFilter(SkFlattenableReadBuffer& rb)
: SkKernel33ProcMaskFilter(rb) {
rb.read(fKernel, 9 * sizeof(int));

Просмотреть файл

@ -216,13 +216,5 @@ void SkLayerRasterizer::flatten(SkFlattenableWriteBuffer& buffer) {
}
}
SkFlattenable* SkLayerRasterizer::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLayerRasterizer, (buffer));
}
SkFlattenable::Factory SkLayerRasterizer::getFactory() {
return CreateProc;
}
SK_DEFINE_FLATTENABLE_REGISTRAR(SkLayerRasterizer)

Просмотреть файл

@ -28,12 +28,4 @@ SkPixelXorXfermode::SkPixelXorXfermode(SkFlattenableReadBuffer& rb)
fOpColor = rb.readU32();
}
SkFlattenable::Factory SkPixelXorXfermode::getFactory() {
return Create;
}
SkFlattenable* SkPixelXorXfermode::Create(SkFlattenableReadBuffer& rb) {
return SkNEW_ARGS(SkPixelXorXfermode, (rb));
}
SK_DEFINE_FLATTENABLE_REGISTRAR(SkPixelXorXfermode)

Просмотреть файл

@ -60,10 +60,6 @@ void SkRectShape::onDraw(SkCanvas* canvas) {
}
}
SkFlattenable::Factory SkRectShape::getFactory() {
return CreateProc;
}
void SkRectShape::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
@ -76,10 +72,6 @@ SkRectShape::SkRectShape(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
buffer.read(&fRadii, sizeof(fRadii));
}
SkFlattenable* SkRectShape::CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkRectShape, (buffer));
}
///////////////////////////////////////////////////////////////////////////////
void SkPaintShape::flatten(SkFlattenableWriteBuffer& buffer) {

Просмотреть файл

@ -36,11 +36,8 @@ public:
virtual void filterSpan(const SkPMColor src[], int count,
SkPMColor dst[]) SK_OVERRIDE;
virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE;
virtual Factory getFactory() SK_OVERRIDE;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkTable_ColorFilter, (buffer));
}
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter)
protected:
SkTable_ColorFilter(SkFlattenableReadBuffer& buffer);
@ -139,10 +136,6 @@ void SkTable_ColorFilter::filterSpan(const SkPMColor src[], int count,
}
}
SkFlattenable::Factory SkTable_ColorFilter::getFactory() {
return CreateProc;
}
static const uint8_t gCountNibBits[] = {
0, 1, 1, 2,
1, 2, 2, 3,

Просмотреть файл

@ -81,14 +81,6 @@ SkTableMaskFilter::SkTableMaskFilter(SkFlattenableReadBuffer& rb)
rb.read(fTable, 256);
}
SkFlattenable* SkTableMaskFilter::Factory(SkFlattenableReadBuffer& rb) {
return SkNEW_ARGS(SkTableMaskFilter, (rb));
}
SkFlattenable::Factory SkTableMaskFilter::getFactory() {
return SkTableMaskFilter::Factory;
}
///////////////////////////////////////////////////////////////////////////////
void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) {

Просмотреть файл

@ -43,10 +43,6 @@ SkOffsetImageFilter::SkOffsetImageFilter(SkFlattenableReadBuffer& buffer) : INHE
fOffset.fY = buffer.readScalar();
}
SkFlattenable::Factory SkOffsetImageFilter::getFactory() {
return CreateProc;
}
///////////////////////////////////////////////////////////////////////////////
SkComposeImageFilter::~SkComposeImageFilter() {
@ -100,10 +96,6 @@ SkComposeImageFilter::SkComposeImageFilter(SkFlattenableReadBuffer& buffer) : IN
fInner = (SkImageFilter*)buffer.readFlattenable();
}
SkFlattenable::Factory SkComposeImageFilter::getFactory() {
return CreateProc;
}
///////////////////////////////////////////////////////////////////////////////
template <typename T> T* SkSafeRefReturn(T* obj) {
@ -282,10 +274,6 @@ SkMergeImageFilter::SkMergeImageFilter(SkFlattenableReadBuffer& buffer) : INHERI
}
}
SkFlattenable::Factory SkMergeImageFilter::getFactory() {
return CreateProc;
}
///////////////////////////////////////////////////////////////////////////////
#include "SkColorFilter.h"
@ -329,10 +317,6 @@ SkColorFilterImageFilter::SkColorFilterImageFilter(SkFlattenableReadBuffer& buff
fColorFilter = (SkColorFilter*)buffer.readFlattenable();
}
SkFlattenable::Factory SkColorFilterImageFilter::getFactory() {
return CreateProc;
}
///////////////////////////////////////////////////////////////////////////////
bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
@ -395,10 +379,6 @@ SkDownSampleImageFilter::SkDownSampleImageFilter(SkFlattenableReadBuffer& buffer
fScale = buffer.readScalar();
}
SkFlattenable::Factory SkDownSampleImageFilter::getFactory() {
return CreateProc;
}
SK_DEFINE_FLATTENABLE_REGISTRAR(SkOffsetImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR(SkComposeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR(SkMergeImageFilter)

Просмотреть файл

@ -126,10 +126,6 @@ void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count)
}
}
SkFlattenable::Factory SkTransparentShader::getFactory() {
return Create;
}
void SkTransparentShader::flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
}

Просмотреть файл

@ -33,14 +33,6 @@ SkDiscreteMapper::SkDiscreteMapper(SkFlattenableReadBuffer& rb)
fScale = rb.readU32();
}
SkFlattenable::Factory SkDiscreteMapper::getFactory() {
return Create;
}
SkFlattenable* SkDiscreteMapper::Create(SkFlattenableReadBuffer& rb) {
return SkNEW_ARGS(SkDiscreteMapper, (rb));
}
void SkDiscreteMapper::flatten(SkFlattenableWriteBuffer& wb) {
this->INHERITED::flatten(wb);
@ -65,11 +57,3 @@ uint16_t SkCosineMapper::mapUnit16(uint16_t input)
SkCosineMapper::SkCosineMapper(SkFlattenableReadBuffer& rb)
: SkUnitMapper(rb) {}
SkFlattenable::Factory SkCosineMapper::getFactory() {
return Create;
}
SkFlattenable* SkCosineMapper::Create(SkFlattenableReadBuffer& rb) {
return SkNEW_ARGS(SkCosineMapper, (rb));
}

Просмотреть файл

@ -29,9 +29,7 @@ public:
return false;
}
virtual Factory getFactory() SK_OVERRIDE {
return NULL;
}
SK_DECLARE_UNFLATTENABLE_OBJECT()
};
static void test_drawBitmap(skiatest::Reporter* reporter) {