Switch SkAutoMalloc to SkAutoTMalloc to avoid cast
Make SkAutoTMalloc's interface look more like SkAutoMalloc:
- add free(), which does what you expect
- make reset() return a pointer fPtr
No public API changes (SkAutoTMalloc is in include/private)
BUG=skia:2148
Review URL: https://codereview.chromium.org/1516833003
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index e8a2355..8997f2b 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -17,6 +17,7 @@
#include "SkReadBuffer.h"
#include "SkRect.h"
#include "SkScalar.h"
+#include "SkTemplates.h"
#include "SkUnPreMultiply.h"
#include "SkWriteBuffer.h"
@@ -1082,8 +1083,8 @@
info.flatten(*buffer);
const size_t size = snugRB * info.height();
- SkAutoMalloc storage(size);
- char* dst = (char*)storage.get();
+ SkAutoTMalloc<char> storage(size);
+ char* dst = storage.get();
for (int y = 0; y < info.height(); ++y) {
memcpy(dst, src, snugRB);
dst += snugRB;