diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-13 20:38:25 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-13 20:38:25 +0000 |
commit | a3122b9b1ec66efef606d8797b7b16b6634e08d2 (patch) | |
tree | bc85243abd06602379bdff6ed2a5eefc60983e24 /src | |
parent | 07d1f008b365e94ef7c7347be19a03d00bd36805 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPaint.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index cb78734027..76a2066c8c 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -33,13 +33,15 @@ #define SK_DefaultFlags 0 //(kNativeHintsText_Flag) -SkPaint::SkPaint() -{ +SkPaint::SkPaint() { + // since we may have padding, we zero everything so that our memcmp() call + // in operator== will work correctly. + // with this, we can skip 0 and null individual initializations + sk_bzero(this, sizeof(*this)); + +#if 0 // not needed with the bzero call above fTypeface = NULL; - fTextSize = SK_DefaultTextSize; - fTextScaleX = SK_Scalar1; fTextSkewX = 0; - fPathEffect = NULL; fShader = NULL; fXfermode = NULL; @@ -47,9 +49,12 @@ SkPaint::SkPaint() fColorFilter = NULL; fRasterizer = NULL; fLooper = NULL; + fWidth = 0; +#endif + fTextSize = SK_DefaultTextSize; + fTextScaleX = SK_Scalar1; fColor = SK_ColorBLACK; - fWidth = 0; fMiterLimit = SK_DefaultMiterLimit; fFlags = SK_DefaultFlags; fCapType = kDefault_Cap; |