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 /tests/CanvasTest.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 'tests/CanvasTest.cpp')
-rw-r--r-- | tests/CanvasTest.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 2ec25e4bab..87705dc7f5 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -61,6 +61,7 @@ #include "SkShader.h" #include "SkStream.h" #include "SkSurface.h" +#include "SkTemplates.h" #include "SkTDArray.h" #include "Test.h" @@ -635,8 +636,8 @@ static void test_newraster(skiatest::Reporter* reporter) { SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10); const size_t minRowBytes = info.minRowBytes(); const size_t size = info.getSafeSize(minRowBytes); - SkAutoMalloc storage(size); - SkPMColor* baseAddr = static_cast<SkPMColor*>(storage.get()); + SkAutoTMalloc<SkPMColor> storage(size); + SkPMColor* baseAddr = storage.get(); sk_bzero(baseAddr, size); SkCanvas* canvas = SkCanvas::NewRasterDirect(info, baseAddr, minRowBytes); |