| OLD | NEW |
| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 SkMD5 md5; | 46 SkMD5 md5; |
| 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 SkAutoTUnref<SkData> data(SkData::NewWithoutCopy(ptr, len)); | 56 sk_sp<SkData> data(SkData::MakeWithoutCopy(ptr, len)); |
| 57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data)); | 57 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data.get())); |
| 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 Loading... |
| 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 } |
| OLD | NEW |