| OLD | NEW |
| 1 // Main binary for DM. | 1 // Main binary for DM. |
| 2 // For a high-level overview, please see dm/README. | 2 // For a high-level overview, please see dm/README. |
| 3 | 3 |
| 4 #include "CrashHandler.h" | 4 #include "CrashHandler.h" |
| 5 #include "LazyDecodeBitmap.h" | 5 #include "LazyDecodeBitmap.h" |
| 6 #include "SkCommonFlags.h" | 6 #include "SkCommonFlags.h" |
| 7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
| 10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 SkOSFile::Iter it(FLAGS_skps[0], ".skp"); | 129 SkOSFile::Iter it(FLAGS_skps[0], ".skp"); |
| 130 SkString filename; | 130 SkString filename; |
| 131 while (it.next(&filename)) { | 131 while (it.next(&filename)) { |
| 132 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) { | 132 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, filename.c_str())) { |
| 133 skps->push_back(SkOSPath::Join(FLAGS_skps[0], filename.c_str())); | 133 skps->push_back(SkOSPath::Join(FLAGS_skps[0], filename.c_str())); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 static void kick_off_skps(const SkTArray<SkString>& skps, | 138 static void kick_off_skps(const SkTArray<SkString>& skps, |
| 139 DM::Reporter* reporter, DM::TaskRunner* tasks) { | 139 const DM::Expectations& expectations, |
| 140 DM::Reporter* reporter, |
| 141 DM::TaskRunner* tasks) { |
| 140 for (int i = 0; i < skps.count(); ++i) { | 142 for (int i = 0; i < skps.count(); ++i) { |
| 141 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(skps[i].c_str())); | 143 SkAutoTUnref<SkStream> stream(SkStream::NewFromFile(skps[i].c_str())); |
| 142 if (stream.get() == NULL) { | 144 if (stream.get() == NULL) { |
| 143 SkDebugf("Could not read %s.\n", skps[i].c_str()); | 145 SkDebugf("Could not read %s.\n", skps[i].c_str()); |
| 144 exit(1); | 146 exit(1); |
| 145 } | 147 } |
| 146 SkAutoTUnref<SkPicture> pic( | 148 SkAutoTUnref<SkPicture> pic( |
| 147 SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeB
itmap)); | 149 SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeB
itmap)); |
| 148 if (pic.get() == NULL) { | 150 if (pic.get() == NULL) { |
| 149 SkDebugf("Could not read %s as an SkPicture.\n", skps[i].c_str()); | 151 SkDebugf("Could not read %s as an SkPicture.\n", skps[i].c_str()); |
| 150 exit(1); | 152 exit(1); |
| 151 } | 153 } |
| 152 | 154 |
| 153 SkString filename = SkOSPath::Basename(skps[i].c_str()); | 155 SkString filename = SkOSPath::Basename(skps[i].c_str()); |
| 154 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename))); | 156 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, expectations, pic,
filename))); |
| 155 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename, | 157 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename, |
| 156 RASTERIZE_PDF_PROC))); | 158 RASTERIZE_PDF_PROC))); |
| 157 } | 159 } |
| 158 } | 160 } |
| 159 | 161 |
| 160 static void report_failures(const SkTArray<SkString>& failures) { | 162 static void report_failures(const SkTArray<SkString>& failures) { |
| 161 if (failures.count() == 0) { | 163 if (failures.count() == 0) { |
| 162 return; | 164 return; |
| 163 } | 165 } |
| 164 | 166 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 SkTArray<SkString> skps; | 232 SkTArray<SkString> skps; |
| 231 find_skps(&skps); | 233 find_skps(&skps); |
| 232 | 234 |
| 233 SkDebugf("%d GMs x %d configs, %d tests, %d pictures\n", | 235 SkDebugf("%d GMs x %d configs, %d tests, %d pictures\n", |
| 234 gms.count(), configs.count(), tests.count(), skps.count()); | 236 gms.count(), configs.count(), tests.count(), skps.count()); |
| 235 DM::Reporter reporter; | 237 DM::Reporter reporter; |
| 236 | 238 |
| 237 DM::TaskRunner tasks; | 239 DM::TaskRunner tasks; |
| 238 kick_off_tests(tests, &reporter, &tasks); | 240 kick_off_tests(tests, &reporter, &tasks); |
| 239 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); | 241 kick_off_gms(gms, configs, gpuAPI, *expectations, &reporter, &tasks); |
| 240 kick_off_skps(skps, &reporter, &tasks); | 242 kick_off_skps(skps, *expectations, &reporter, &tasks); |
| 241 tasks.wait(); | 243 tasks.wait(); |
| 242 | 244 |
| 243 DM::WriteTask::DumpJson(); | 245 DM::WriteTask::DumpJson(); |
| 244 | 246 |
| 245 SkDebugf("\n"); | 247 SkDebugf("\n"); |
| 246 #ifdef SK_DEBUG | 248 #ifdef SK_DEBUG |
| 247 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { | 249 if (FLAGS_portableFonts && FLAGS_reportUsedChars) { |
| 248 sk_tool_utils::report_used_chars(); | 250 sk_tool_utils::report_used_chars(); |
| 249 } | 251 } |
| 250 #endif | 252 #endif |
| 251 | 253 |
| 252 SkTArray<SkString> failures; | 254 SkTArray<SkString> failures; |
| 253 reporter.getFailures(&failures); | 255 reporter.getFailures(&failures); |
| 254 report_failures(failures); | 256 report_failures(failures); |
| 255 return failures.count() > 0; | 257 return failures.count() > 0; |
| 256 } | 258 } |
| 257 | 259 |
| 258 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 260 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 259 int main(int argc, char** argv) { | 261 int main(int argc, char** argv) { |
| 260 SkCommandLineFlags::Parse(argc, argv); | 262 SkCommandLineFlags::Parse(argc, argv); |
| 261 return dm_main(); | 263 return dm_main(); |
| 262 } | 264 } |
| 263 #endif | 265 #endif |
| OLD | NEW |