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

Side by Side Diff: src/images/SkImageDecoder_libwebp.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 unified diff | Download patch
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/svg/parser/SkSVG.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 WebPFreeDecBuffer(&config->output); 194 WebPFreeDecBuffer(&config->output);
195 return false; 195 return false;
196 } 196 }
197 197
198 if (!stream->rewind()) { 198 if (!stream->rewind()) {
199 SkDebugf("Failed to rewind webp stream!"); 199 SkDebugf("Failed to rewind webp stream!");
200 return false; 200 return false;
201 } 201 }
202 const size_t readBufferSize = stream->hasLength() ? 202 const size_t readBufferSize = stream->hasLength() ?
203 SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_B UFFER_SZ; 203 SkTMin(stream->getLength(), WEBP_IDECODE_BUFFER_SZ) : WEBP_IDECODE_B UFFER_SZ;
204 SkAutoMalloc srcStorage(readBufferSize); 204 SkAutoTMalloc<unsigned char> srcStorage(readBufferSize);
205 unsigned char* input = (uint8_t*)srcStorage.get(); 205 unsigned char* input = srcStorage.get();
206 if (nullptr == input) { 206 if (nullptr == input) {
207 WebPIDelete(idec); 207 WebPIDelete(idec);
208 WebPFreeDecBuffer(&config->output); 208 WebPFreeDecBuffer(&config->output);
209 return false; 209 return false;
210 } 210 }
211 211
212 bool success = true; 212 bool success = true;
213 VP8StatusCode status = VP8_STATUS_SUSPENDED; 213 VP8StatusCode status = VP8_STATUS_SUSPENDED;
214 do { 214 do {
215 const size_t bytesRead = stream->read(input, readBufferSize); 215 const size_t bytesRead = stream->read(input, readBufferSize);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 return SkImageDecoder::kUnknown_Format; 550 return SkImageDecoder::kUnknown_Format;
551 } 551 }
552 552
553 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { 553 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
554 return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : nullptr; 554 return (SkImageEncoder::kWEBP_Type == t) ? new SkWEBPImageEncoder : nullptr;
555 } 555 }
556 556
557 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); 557 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
558 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); 558 static SkImageDecoder_FormatReg gFormatReg(get_format_webp);
559 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); 559 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/svg/parser/SkSVG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698