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

Side by Side Diff: tools/get_images_from_skps.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « tools/fiddle/fiddle_main.cpp ('k') | tools/skdiff_main.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 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCommandLineFlags.h" 10 #include "SkCommandLineFlags.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 md5.write(ptr, len); 47 md5.write(ptr, len);
48 SkMD5::Digest digest; 48 SkMD5::Digest digest;
49 md5.finish(digest); 49 md5.finish(digest);
50 50
51 if (gSeen.contains(digest)) { 51 if (gSeen.contains(digest)) {
52 return; 52 return;
53 } 53 }
54 gSeen.add(digest); 54 gSeen.add(digest);
55 55
56 sk_sp<SkData> data(SkData::MakeWithoutCopy(ptr, len)); 56 sk_sp<SkData> data(SkData::MakeWithoutCopy(ptr, len));
57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data.get())); 57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data));
58 if (!codec) { 58 if (!codec) {
59 // FIXME: This code is currently unreachable because we create an em pty generator when 59 // FIXME: This code is currently unreachable because we create an em pty generator when
60 // we fail to create a codec. 60 // we fail to create a codec.
61 SkDebugf("Codec could not be created for %s\n", skpName.c_str()); 61 SkDebugf("Codec could not be created for %s\n", skpName.c_str());
62 gSkpToUnknownCount[skpName]++; 62 gSkpToUnknownCount[skpName]++;
63 return; 63 return;
64 } 64 }
65 SkString ext; 65 SkString ext;
66 switch (codec->getEncodedFormat()) { 66 switch (codec->getEncodedFormat()) {
67 case SkEncodedFormat::kBMP_SkEncodedFormat: ext = "bmp"; break; 67 case SkEncodedFormat::kBMP_SkEncodedFormat: ext = "bmp"; break;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (!FLAGS_failuresJsonPath.isEmpty()) { 163 if (!FLAGS_failuresJsonPath.isEmpty()) {
164 SkDebugf("Writing failures to %s\n", FLAGS_failuresJsonPath[0]); 164 SkDebugf("Writing failures to %s\n", FLAGS_failuresJsonPath[0]);
165 SkFILEWStream stream(FLAGS_failuresJsonPath[0]); 165 SkFILEWStream stream(FLAGS_failuresJsonPath[0]);
166 stream.writeText(Json::StyledWriter().write(fRoot).c_str()); 166 stream.writeText(Json::StyledWriter().write(fRoot).c_str());
167 stream.flush(); 167 stream.flush();
168 } 168 }
169 return -1; 169 return -1;
170 } 170 }
171 return 0; 171 return 0;
172 } 172 }
OLDNEW
« no previous file with comments | « tools/fiddle/fiddle_main.cpp ('k') | tools/skdiff_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698