diff options
author | scroggo <scroggo@google.com> | 2015-12-10 10:44:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-10 10:44:13 -0800 |
commit | 565901db954c231840750ea955ed31b820b9ade8 (patch) | |
tree | 376c6355e252cd946babb6a267adba2e016efab4 /src/core/SkBitmap.cpp | |
parent | 9907371f0a79776d90b68d534aeb44eb46acafe5 (diff) |
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
Diffstat (limited to 'src/core/SkBitmap.cpp')
-rw-r--r-- | src/core/SkBitmap.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index e8a235597d..8997f2b014 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 @@ static void write_raw_pixels(SkWriteBuffer* buffer, const SkPixmap& pmap) { 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; |