| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const char* inputs = FLAGS_skps[0]; | 121 const char* inputs = FLAGS_skps[0]; |
| 122 gOutputDir = FLAGS_out[0]; | 122 gOutputDir = FLAGS_out[0]; |
| 123 | 123 |
| 124 if (!sk_isdir(inputs) || !sk_isdir(gOutputDir)) { | 124 if (!sk_isdir(inputs) || !sk_isdir(gOutputDir)) { |
| 125 SkCommandLineFlags::PrintUsage(); | 125 SkCommandLineFlags::PrintUsage(); |
| 126 return 1; | 126 return 1; |
| 127 } | 127 } |
| 128 | 128 |
| 129 SkOSFile::Iter iter(inputs, "skp"); | 129 SkOSFile::Iter iter(inputs, "skp"); |
| 130 for (SkString file; iter.next(&file); ) { | 130 for (SkString file; iter.next(&file); ) { |
| 131 std::unique_ptr<SkStream> stream = | 131 SkAutoTDelete<SkStream> stream = |
| 132 SkStream::MakeFromFile(SkOSPath::Join(inputs, file.c_str()).c_st
r()); | 132 SkStream::NewFromFile(SkOSPath::Join(inputs, file.c_str()).c_str
()); |
| 133 sk_sp<SkPicture> picture(SkPicture::MakeFromStream(stream.get())); | 133 sk_sp<SkPicture> picture(SkPicture::MakeFromStream(stream)); |
| 134 | 134 |
| 135 SkDynamicMemoryWStream scratch; | 135 SkDynamicMemoryWStream scratch; |
| 136 Sniffer sniff(file.c_str()); | 136 Sniffer sniff(file.c_str()); |
| 137 picture->serialize(&scratch, &sniff); | 137 picture->serialize(&scratch, &sniff); |
| 138 } | 138 } |
| 139 int totalUnknowns = 0; | 139 int totalUnknowns = 0; |
| 140 /** | 140 /** |
| 141 JSON results are written out in the following format: | 141 JSON results are written out in the following format: |
| 142 { | 142 { |
| 143 "failures": { | 143 "failures": { |
| (...skipping 19 matching lines...) Expand all 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 |