Fix unnitialized memory in Sk2DPathEffect.  The SkDescriptor checksum
calculation for Sk2DPathEffect currently evaluates all the bytes in the
embedded SkMatrix.  This includes the type mask, which contains some
uninitialized padding.  Changing it to use SkMatrix::flatten() and
SkMatrix::unflatten() (as SkGroupShape was doing) avoids the uninitialized
data errors.

Review URL:  http://codereview.appspot.com/4529074/



git-svn-id: http://skia.googlecode.com/svn/trunk@1395 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 603deb7..1dfc24d 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -82,12 +82,19 @@
 
 void Sk2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer)
 {
-    buffer.writeMul4(&fMatrix, sizeof(fMatrix));
+    char storage[SkMatrix::kMaxFlattenSize];
+    uint32_t size = fMatrix.flatten(storage);
+    buffer.write32(size);
+    buffer.write(storage, size);
 }
 
 Sk2DPathEffect::Sk2DPathEffect(SkFlattenableReadBuffer& buffer)
 {
-    buffer.read(&fMatrix, sizeof(fMatrix));
+    char storage[SkMatrix::kMaxFlattenSize];
+    uint32_t size = buffer.readS32();
+    SkASSERT(size <= sizeof(storage));
+    buffer.read(storage, size);
+    fMatrix.unflatten(storage);
     fMatrix.invert(&fInverse);
 }