Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: src/images/SkImageDecoder_libpng.cpp

Issue 1516833003: Switch SkAutoMalloc to SkAutoTMalloc to avoid cast (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Go back to patch set 3 Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/SkImageDecoder_libjpeg.cpp ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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++) {
« no previous file with comments | « src/images/SkImageDecoder_libjpeg.cpp ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698