Index: src/core/SkDistanceFieldGen.cpp |
diff --git a/src/core/SkDistanceFieldGen.cpp b/src/core/SkDistanceFieldGen.cpp |
index 4f4de56a46f4c0d8282c7d427153be2536396bbe..30354e09f83cb783c49ee018af74b3d8e236b272 100755 |
--- a/src/core/SkDistanceFieldGen.cpp |
+++ b/src/core/SkDistanceFieldGen.cpp |
@@ -343,10 +343,15 @@ |
int dataWidth = width + 2*pad; |
int dataHeight = height + 2*pad; |
- // create zeroed temp edge+DFData storage |
- SkAutoFree storage(sk_calloc_throw(dataWidth*dataHeight*(1 + sizeof(DFData)))); |
- unsigned char* edgePtr = (unsigned char*)storage.get(); |
- DFData* dataPtr = (DFData*)(edgePtr + dataWidth*dataHeight); |
+ // create temp data |
+ size_t dataSize = dataWidth*dataHeight*sizeof(DFData); |
+ SkAutoSMalloc<1024> dfStorage(dataSize); |
+ DFData* dataPtr = (DFData*) dfStorage.get(); |
+ sk_bzero(dataPtr, dataSize); |
+ |
+ SkAutoSMalloc<1024> edgeStorage(dataWidth*dataHeight*sizeof(char)); |
+ unsigned char* edgePtr = (unsigned char*) edgeStorage.get(); |
+ sk_bzero(edgePtr, dataWidth*dataHeight*sizeof(char)); |
// copy glyph into distance field storage |
init_glyph_data(dataPtr, edgePtr, copyPtr, |