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

Unified Diff: tools/skdiff_utils.cpp

Issue 1272293004: Move SkTemplates.h to private. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: It's a struct! Created 5 years, 4 months 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 | « tools/skdiff_main.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « tools/skdiff_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698