Grab-bag of memory fixes. SkFlatMatrix::Flatten had the same issue as
authorsenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 24 May 2011 20:25:32 +0000 (20:25 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 24 May 2011 20:25:32 +0000 (20:25 +0000)
Sk2DPathEffect:  it was encoding a partially-unintialized matrix type mask.
The others are simply uninitialized vars in the sample code.

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

git-svn-id: http://skia.googlecode.com/svn/trunk@1414 2bbb7eff-a529-9590-31e7-b0007b416f81

samplecode/SampleHairline.cpp
samplecode/SampleLineClipper.cpp
src/core/SkPictureFlat.cpp

index ab5ac8c..8368f5b 100644 (file)
@@ -186,6 +186,7 @@ class HairlineView : public SampleView {
     bool fDoAA;
 public:
        HairlineView() {
+        fCounter = 0;
         fProcIndex = 0;
         fDoAA = true;
         fNow = 0;
index d0a8667..ac6b013 100644 (file)
@@ -166,6 +166,7 @@ public:
        LineClipperView() {
         fProcIndex = 0;
         fCounter = 0;
+        fNow = 0;
 
         int x = (640 - W)/2;
         int y = (480 - H)/2;
index 5c5ea0b..105df3c 100644 (file)
@@ -28,9 +28,9 @@ SkFlatBitmap* SkFlatBitmap::Flatten(SkChunkAlloc* heap, const SkBitmap& bitmap,
 }
 
 SkFlatMatrix* SkFlatMatrix::Flatten(SkChunkAlloc* heap, const SkMatrix& matrix, int index) {
-    int32_t size = sizeof(SkMatrix);
+    size_t size = matrix.flatten(NULL);
     SkFlatMatrix* result = (SkFlatMatrix*) INHERITED::Alloc(heap, size, index);
-    memcpy(&result->fMatrixData, &matrix, sizeof(SkMatrix));
+    matrix.flatten(&result->fMatrixData);
     return result;
 }