bzero SkPaint in its constructor, to allow us to cleanly use memcmp in our

operator==, given that we may be padded and not know how to init those pad bytes



git-svn-id: http://skia.googlecode.com/svn/trunk@321 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-08-13 20:38:25 +00:00
parent 07d1f008b3
commit a3122b9b1e

View File

@ -33,13 +33,15 @@
#define SK_DefaultFlags 0 //(kNativeHintsText_Flag) #define SK_DefaultFlags 0 //(kNativeHintsText_Flag)
SkPaint::SkPaint() SkPaint::SkPaint() {
{ // since we may have padding, we zero everything so that our memcmp() call
fTypeface = NULL; // in operator== will work correctly.
fTextSize = SK_DefaultTextSize; // with this, we can skip 0 and null individual initializations
fTextScaleX = SK_Scalar1; sk_bzero(this, sizeof(*this));
fTextSkewX = 0;
#if 0 // not needed with the bzero call above
fTypeface = NULL;
fTextSkewX = 0;
fPathEffect = NULL; fPathEffect = NULL;
fShader = NULL; fShader = NULL;
fXfermode = NULL; fXfermode = NULL;
@ -47,9 +49,12 @@ SkPaint::SkPaint()
fColorFilter = NULL; fColorFilter = NULL;
fRasterizer = NULL; fRasterizer = NULL;
fLooper = NULL; fLooper = NULL;
fColor = SK_ColorBLACK;
fWidth = 0; fWidth = 0;
#endif
fTextSize = SK_DefaultTextSize;
fTextScaleX = SK_Scalar1;
fColor = SK_ColorBLACK;
fMiterLimit = SK_DefaultMiterLimit; fMiterLimit = SK_DefaultMiterLimit;
fFlags = SK_DefaultFlags; fFlags = SK_DefaultFlags;
fCapType = kDefault_Cap; fCapType = kDefault_Cap;