diff options
author | 2015-12-10 10:44:13 -0800 | |
---|---|---|
committer | 2015-12-10 10:44:13 -0800 | |
commit | 565901db954c231840750ea955ed31b820b9ade8 (patch) | |
tree | 376c6355e252cd946babb6a267adba2e016efab4 /src/codec/SkSampledCodec.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/codec/SkSampledCodec.cpp')
-rw-r--r-- | src/codec/SkSampledCodec.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codec/SkSampledCodec.cpp b/src/codec/SkSampledCodec.cpp index 52e5648742..38859ad6be 100644 --- a/src/codec/SkSampledCodec.cpp +++ b/src/codec/SkSampledCodec.cpp @@ -9,6 +9,7 @@ #include "SkCodecPriv.h" #include "SkMath.h" #include "SkSampledCodec.h" +#include "SkTemplates.h" SkSampledCodec::SkSampledCodec(SkCodec* codec) : INHERITED(codec->getInfo()) @@ -267,8 +268,8 @@ SkCodec::Result SkSampledCodec::sampledDecode(const SkImageInfo& info, void* pix } case SkCodec::kNone_SkScanlineOrder: { const int linesNeeded = subsetHeight - samplingOffsetY; - SkAutoMalloc storage(linesNeeded * rowBytes); - uint8_t* storagePtr = static_cast<uint8_t*>(storage.get()); + SkAutoTMalloc<uint8_t> storage(linesNeeded * rowBytes); + uint8_t* storagePtr = storage.get(); if (!fCodec->skipScanlines(startY)) { fCodec->fillIncompleteImage(info, pixels, rowBytes, options.fZeroInitialized, |