Index: src/images/SkImageDecoder_libpng.cpp |
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp |
index 2dead5872987fcc2ec0fb0ad2b4bd976670734de..4ccc9a2c6ce3aa4a7743831d8d3374f7481afb9b 100644 |
--- a/src/images/SkImageDecoder_libpng.cpp |
+++ b/src/images/SkImageDecoder_libpng.cpp |
@@ -399,8 +399,8 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap |
const int height = decodedBitmap->height(); |
if (number_passes > 1) { |
- SkAutoMalloc storage(origWidth * origHeight * srcBytesPerPixel); |
- uint8_t* base = (uint8_t*)storage.get(); |
+ SkAutoTMalloc<uint8_t> storage(origWidth * origHeight * srcBytesPerPixel); |
+ uint8_t* base = storage.get(); |
size_t rowBytes = origWidth * srcBytesPerPixel; |
for (int i = 0; i < number_passes; i++) { |
@@ -418,8 +418,8 @@ SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap |
base += sampler.srcDY() * rowBytes; |
} |
} else { |
- SkAutoMalloc storage(origWidth * srcBytesPerPixel); |
- uint8_t* srcRow = (uint8_t*)storage.get(); |
+ SkAutoTMalloc<uint8_t> storage(origWidth * srcBytesPerPixel); |
+ uint8_t* srcRow = storage.get(); |
skip_src_rows(png_ptr, srcRow, sampler.srcY0()); |
for (int y = 0; y < height; y++) { |
@@ -964,8 +964,8 @@ bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap, |
png_write_info(png_ptr, info_ptr); |
const char* srcImage = (const char*)bitmap.getPixels(); |
- SkAutoSMalloc<1024> rowStorage(bitmap.width() << 2); |
- char* storage = (char*)rowStorage.get(); |
+ SkAutoSTMalloc<1024, char> rowStorage(bitmap.width() << 2); |
+ char* storage = rowStorage.get(); |
transform_scanline_proc proc = choose_proc(ct, hasAlpha); |
for (int y = 0; y < bitmap.height(); y++) { |