Index: src/pipe/utils/SamplePipeControllers.cpp |
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp |
index 1e25cb61c40f5890887d046d10ef538d02f9b5d9..de26346a15ab0fb8aea789e356af629d279601b2 100644 |
--- a/src/pipe/utils/SamplePipeControllers.cpp |
+++ b/src/pipe/utils/SamplePipeControllers.cpp |
@@ -13,23 +13,16 @@ |
#include "SkMatrix.h" |
PipeController::PipeController(SkCanvas* target, SkPicture::InstallPixelRefProc proc) |
-:fReader(target) { |
- fBlock = NULL; |
- fBlockSize = fBytesWritten = 0; |
+ : fReader(target), fBlockSize(0), fBytesWritten(0) { |
fReader.setBitmapDecoder(proc); |
} |
-PipeController::~PipeController() { |
- sk_free(fBlock); |
-} |
- |
-void* PipeController::requestBlock(size_t minRequest, size_t *actual) { |
- sk_free(fBlock); |
- fBlockSize = minRequest * 4; |
- fBlock = sk_malloc_throw(fBlockSize); |
+void* PipeController::requestBlock(size_t minRequest, size_t* actual) { |
+ fBlockSize = minRequest; |
+ fBlock.reset(fBlockSize); |
fBytesWritten = 0; |
*actual = fBlockSize; |
- return fBlock; |
+ return fBlock.get(); |
} |
void PipeController::notifyWritten(size_t bytes) { |