Add missing flattenable registrations and CreateProc() functions;

fixes gm --serialize xfermode test case.



git-svn-id: http://skia.googlecode.com/svn/trunk@1199 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
tomhudson@google.com 2011-04-27 14:09:52 +00:00
parent 938d604026
commit 1447c6f7f4
10 changed files with 226 additions and 173 deletions

View File

@ -221,4 +221,3 @@ private:
};
#endif

View File

@ -62,6 +62,10 @@ public:
virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkAvoidXfermode, (buffer));
}
protected:
SkAvoidXfermode(SkFlattenableReadBuffer&);

View File

@ -43,6 +43,8 @@ public:
int32_t fResult[4];
};
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer);
protected:
// overrides for SkFlattenable
virtual Factory getFactory();
@ -50,7 +52,6 @@ protected:
SkColorMatrixFilter(SkFlattenableReadBuffer& buffer);
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer);
typedef void (*Proc)(State*, unsigned r, unsigned g, unsigned b,
unsigned a);

View File

@ -32,6 +32,10 @@ public:
virtual Factory getFactory();
virtual void flatten(SkFlattenableWriteBuffer&);
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkPixelXorXfermode, (buffer));
}
protected:
// override from SkXfermode
virtual SkPMColor xferColor(SkPMColor src, SkPMColor dst);
@ -47,4 +51,3 @@ private:
};
#endif

View File

@ -748,6 +748,10 @@ public:
buffer.write32(fDstCoeff);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkProcCoeffXfermode, (buffer));
}
protected:
SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {
@ -760,8 +764,6 @@ private:
Mode fMode;
Coeff fSrcCoeff, fDstCoeff;
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkProcCoeffXfermode, (buffer)); }
typedef SkProcXfermode INHERITED;
};
@ -811,13 +813,14 @@ public:
virtual Factory getFactory() { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkClearXfermode, (buffer));
}
private:
SkClearXfermode(SkFlattenableReadBuffer& buffer)
: SkProcCoeffXfermode(buffer) {}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkClearXfermode, (buffer));
}
};
///////////////////////////////////////////////////////////////////////////////
@ -871,13 +874,14 @@ public:
virtual Factory getFactory() { return CreateProc; }
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkSrcXfermode, (buffer));
}
private:
SkSrcXfermode(SkFlattenableReadBuffer& buffer)
: SkProcCoeffXfermode(buffer) {}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkSrcXfermode, (buffer));
}
};
class SkDstInXfermode : public SkProcCoeffXfermode {
@ -906,13 +910,13 @@ public:
virtual Factory getFactory() { return CreateProc; }
private:
SkDstInXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkDstInXfermode, (buffer));
}
private:
SkDstInXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
typedef SkProcCoeffXfermode INHERITED;
};
@ -942,14 +946,14 @@ public:
virtual Factory getFactory() { return CreateProc; }
private:
SkDstOutXfermode(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkDstOutXfermode, (buffer));
}
private:
SkDstOutXfermode(SkFlattenableReadBuffer& buffer)
: INHERITED(buffer) {}
typedef SkProcCoeffXfermode INHERITED;
};
@ -1194,3 +1198,18 @@ SkXfermodeProc16 SkXfermode::GetProc16(Mode mode, SkColor srcColor) {
return proc16;
}
static SkFlattenable::Registrar
gSkProcCoeffXfermodeReg("SkProcCoeffXfermode",
SkProcCoeffXfermode::CreateProc);
static SkFlattenable::Registrar
gSkClearXfermodeReg("SkClearXfermode", SkClearXfermode::CreateProc);
static SkFlattenable::Registrar
gSkSrcXfermodeReg("SkSrcXfermode", SkSrcXfermode::CreateProc);
static SkFlattenable::Registrar
gSkDstInXfermodeReg("SkDstInXfermode", SkDstInXfermode::CreateProc);
static SkFlattenable::Registrar
gSkDstOutXfermodeReg("SkDstOutXfermode", SkDstOutXfermode::CreateProc);

View File

@ -258,3 +258,5 @@ void SkAvoidXfermode::xferA8(SkAlpha dst[], const SkPMColor src[], int count, co
// override in subclass
}
static SkFlattenable::Registrar
gSkAvoidXfermodeReg("SkAvoidXfermode", SkAvoidXfermode::CreateProc);

View File

@ -58,6 +58,7 @@ public:
protected:
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
buffer.write32(fColor);
buffer.write32(fMode);
}
@ -75,6 +76,8 @@ protected:
private:
SkColor fColor;
SkXfermode::Mode fMode;
typedef SkColorFilter INHERITED;
};
class Src_SkModeColorFilter : public SkModeColorFilter {
@ -100,6 +103,10 @@ public:
sk_memset16(result, SkPixel32ToPixel16(fPMColor), count);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Src_SkModeColorFilter, (buffer));
}
protected:
virtual Factory getFactory() { return CreateProc; }
@ -107,10 +114,6 @@ protected:
: INHERITED(buffer) {}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Src_SkModeColorFilter, (buffer));
}
typedef SkModeColorFilter INHERITED;
};
@ -143,6 +146,10 @@ public:
sk_memset16(result, SkPixel32ToPixel16(fPMColor), count);
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SrcOver_SkModeColorFilter, (buffer));
}
protected:
virtual Factory getFactory() { return CreateProc; }
@ -150,9 +157,6 @@ protected:
: INHERITED(buffer), fColor32Proc(NULL) {}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SrcOver_SkModeColorFilter, (buffer));
}
SkBlitRow::ColorProc fColor32Proc;
@ -201,6 +205,10 @@ public:
}
}
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Proc_SkModeColorFilter, (buffer));
}
protected:
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
@ -218,10 +226,6 @@ protected:
}
private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(Proc_SkModeColorFilter, (buffer));
}
SkXfermodeProc fProc;
SkXfermodeProc16 fProc16;
@ -328,6 +332,7 @@ public:
protected:
virtual void flatten(SkFlattenableWriteBuffer& buffer) {
this->INHERITED::flatten(buffer);
buffer.write32(fMul);
buffer.write32(fAdd);
}
@ -347,6 +352,8 @@ private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter, (buffer));
}
typedef SkColorFilter INHERITED;
};
class SkLightingColorFilter_JustAdd : public SkLightingColorFilter {
@ -384,6 +391,7 @@ private:
static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) {
return SkNEW_ARGS(SkLightingColorFilter_JustAdd, (buffer));
}
typedef SkLightingColorFilter INHERITED;
};
@ -560,3 +568,14 @@ SkColorFilter* SkColorFilter::CreateLightingFilter(SkColor mul, SkColor add) {
return SkNEW_ARGS(SkLightingColorFilter, (mul, add));
}
static SkFlattenable::Registrar
gSrcColorFilterReg("Src_SkModeColorFilterReg",
Src_SkModeColorFilter::CreateProc);
static SkFlattenable::Registrar
gSrcOverColorFilterReg("SrcOver_SkModeColorFilterReg",
SrcOver_SkModeColorFilter::CreateProc);
static SkFlattenable::Registrar
gProcColorFilterReg("Proc_SkModeColorFilterReg",
Proc_SkModeColorFilter::CreateProc);

View File

@ -328,3 +328,6 @@ SkFlattenable* SkColorMatrixFilter::CreateProc(SkFlattenableReadBuffer& buf) {
return SkNEW_ARGS(SkColorMatrixFilter, (buf));
}
static SkFlattenable::Registrar
gSkColorMatrixFilterReg("SkColorMatrixFilter",
SkColorMatrixFilter::CreateProc);

View File

@ -43,3 +43,6 @@ SkFlattenable* SkPixelXorXfermode::Create(SkFlattenableReadBuffer& rb) {
return SkNEW_ARGS(SkPixelXorXfermode, (rb));
}
static SkFlattenable::Registrar
gSkPixelXorXfermodeReg("SkPixelXorXfermode",
SkPixelXorXfermode::CreateProc);