Index: tools/skdiff_utils.cpp |
diff --git a/tools/skdiff_utils.cpp b/tools/skdiff_utils.cpp |
index a00ea7b567b3bb3ac158f673c858b1418f892b4b..e656e3c44b5ca3d9173b5f15315490e583b39377 100644 |
--- a/tools/skdiff_utils.cpp |
+++ b/tools/skdiff_utils.cpp |
@@ -11,9 +11,10 @@ |
#include "SkImageDecoder.h" |
#include "SkImageEncoder.h" |
#include "SkStream.h" |
-#include "SkTemplates.h" |
#include "SkTypes.h" |
+#include <memory> |
+ |
bool are_buffers_equal(SkData* skdata1, SkData* skdata2) { |
if ((NULL == skdata1) || (NULL == skdata2)) { |
return false; |
@@ -35,17 +36,15 @@ SkData* read_file(const char* file_path) { |
bool get_bitmap(SkData* fileBits, DiffResource& resource, SkImageDecoder::Mode mode) { |
SkMemoryStream stream(fileBits->data(), fileBits->size()); |
- SkImageDecoder* codec = SkImageDecoder::Factory(&stream); |
+ // In debug, the DLL will automatically be unloaded when this is deleted, |
+ // but that shouldn't be a problem in release mode. |
+ std::unique_ptr<SkImageDecoder> codec(SkImageDecoder::Factory(&stream)); |
if (NULL == codec) { |
SkDebugf("ERROR: no codec found for <%s>\n", resource.fFullPath.c_str()); |
resource.fStatus = DiffResource::kCouldNotDecode_Status; |
return false; |
} |
- // In debug, the DLL will automatically be unloaded when this is deleted, |
- // but that shouldn't be a problem in release mode. |
- SkAutoTDelete<SkImageDecoder> ad(codec); |
- |
stream.rewind(); |
if (!codec->decode(&stream, &resource.fBitmap, kN32_SkColorType, mode)) { |
SkDebugf("ERROR: codec failed for basePath <%s>\n", resource.fFullPath.c_str()); |