OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
9 #include "DMSrcSink.h" | 9 #include "DMSrcSink.h" |
10 #include "DMSrcSinkAndroid.h" | 10 #include "DMSrcSinkAndroid.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 DEFINE_string(uninterestingHashesFile, "", | 67 DEFINE_string(uninterestingHashesFile, "", |
68 "File containing a list of uninteresting hashes. If a result hashes to s
omething in " | 68 "File containing a list of uninteresting hashes. If a result hashes to s
omething in " |
69 "this list, no image is written for that result."); | 69 "this list, no image is written for that result."); |
70 | 70 |
71 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); | 71 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); |
72 DEFINE_int32(shard, 0, "Which shard do I run?"); | 72 DEFINE_int32(shard, 0, "Which shard do I run?"); |
73 | 73 |
74 DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.")
; | 74 DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.")
; |
75 | 75 |
| 76 DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file."); |
| 77 |
76 using namespace DM; | 78 using namespace DM; |
77 using sk_gpu_test::GrContextFactory; | 79 using sk_gpu_test::GrContextFactory; |
78 using sk_gpu_test::GLTestContext; | 80 using sk_gpu_test::GLTestContext; |
79 using sk_gpu_test::ContextInfo; | 81 using sk_gpu_test::ContextInfo; |
80 | 82 |
81 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 83 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
82 | 84 |
83 static const double kStartMs = SkTime::GetMSecs(); | 85 static const double kStartMs = SkTime::GetMSecs(); |
84 | 86 |
85 static FILE* gVLog; | 87 static FILE* gVLog; |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 }; | 705 }; |
704 | 706 |
705 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { | 707 for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) { |
706 if (0 == strcmp(exts[i], ext)) { | 708 if (0 == strcmp(exts[i], ext)) { |
707 return true; | 709 return true; |
708 } | 710 } |
709 } | 711 } |
710 return false; | 712 return false; |
711 } | 713 } |
712 | 714 |
| 715 template <typename T> |
| 716 void gather_file_srcs(const SkCommandLineFlags::StringArray& flags, const char*
ext) { |
| 717 for (int i = 0; i < flags.count(); i++) { |
| 718 const char* path = flags[i]; |
| 719 if (sk_isdir(path)) { |
| 720 SkOSFile::Iter it(path, ext); |
| 721 for (SkString file; it.next(&file); ) { |
| 722 push_src(ext, "", new T(SkOSPath::Join(path, file.c_str()))); |
| 723 } |
| 724 } else { |
| 725 push_src(ext, "", new T(path)); |
| 726 } |
| 727 } |
| 728 } |
| 729 |
713 static bool gather_srcs() { | 730 static bool gather_srcs() { |
714 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { | 731 for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->nex
t()) { |
715 push_src("gm", "", new GMSrc(r->factory())); | 732 push_src("gm", "", new GMSrc(r->factory())); |
716 } | 733 } |
717 for (int i = 0; i < FLAGS_skps.count(); i++) { | |
718 const char* path = FLAGS_skps[i]; | |
719 if (sk_isdir(path)) { | |
720 SkOSFile::Iter it(path, "skp"); | |
721 for (SkString file; it.next(&file); ) { | |
722 push_src("skp", "", new SKPSrc(SkOSPath::Join(path, file.c_str()
))); | |
723 } | |
724 } else { | |
725 push_src("skp", "", new SKPSrc(path)); | |
726 } | |
727 } | |
728 | 734 |
729 for (int i = 0; i < FLAGS_mskps.count(); i++) { | 735 gather_file_srcs<SKPSrc>(FLAGS_skps, "skp"); |
730 const char* path = FLAGS_mskps[i]; | 736 gather_file_srcs<MSKPSrc>(FLAGS_mskps, "mskp"); |
731 if (sk_isdir(path)) { | 737 #if defined(SK_XML) |
732 SkOSFile::Iter it(path, "mskp"); | 738 gather_file_srcs<SVGSrc>(FLAGS_svgs, "svg"); |
733 for (SkString file; it.next(&file);) { | 739 #endif |
734 push_src("mskp", "", | |
735 new MSKPSrc(SkOSPath::Join(path, file.c_str()))); | |
736 } | |
737 } else { | |
738 push_src("mskp", "", new MSKPSrc(path)); | |
739 } | |
740 } | |
741 | 740 |
742 SkTArray<SkString> images; | 741 SkTArray<SkString> images; |
743 if (!CollectImages(FLAGS_images, &images)) { | 742 if (!CollectImages(FLAGS_images, &images)) { |
744 return false; | 743 return false; |
745 } | 744 } |
746 | 745 |
747 for (auto image : images) { | 746 for (auto image : images) { |
748 push_codec_srcs(image); | 747 push_codec_srcs(image); |
749 if (FLAGS_simpleCodec) { | 748 if (FLAGS_simpleCodec) { |
750 continue; | 749 continue; |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 #endif | 1434 #endif |
1436 } | 1435 } |
1437 } // namespace skiatest | 1436 } // namespace skiatest |
1438 | 1437 |
1439 #if !defined(SK_BUILD_FOR_IOS) | 1438 #if !defined(SK_BUILD_FOR_IOS) |
1440 int main(int argc, char** argv) { | 1439 int main(int argc, char** argv) { |
1441 SkCommandLineFlags::Parse(argc, argv); | 1440 SkCommandLineFlags::Parse(argc, argv); |
1442 return dm_main(); | 1441 return dm_main(); |
1443 } | 1442 } |
1444 #endif | 1443 #endif |
OLD | NEW |