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 "GrContext.h" | 4 #include "GrContext.h" |
5 #include "GrContextFactory.h" | 5 #include "GrContextFactory.h" |
6 #include "SkCommandLineFlags.h" | 6 #include "SkCommandLineFlags.h" |
7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "SkString.h" |
9 #include "gm.h" | 10 #include "gm.h" |
10 | 11 |
11 #include "DMReporter.h" | 12 #include "DMReporter.h" |
12 #include "DMTask.h" | 13 #include "DMTask.h" |
13 #include "DMTaskRunner.h" | 14 #include "DMTaskRunner.h" |
14 #include "DMCpuTask.h" | 15 #include "DMCpuTask.h" |
15 #include "DMGpuTask.h" | 16 #include "DMGpuTask.h" |
16 | 17 |
17 #include <string.h> | 18 #include <string.h> |
18 | 19 |
(...skipping 13 matching lines...) Expand all Loading... |
32 "^ requires the start of the GM to match\n" | 33 "^ requires the start of the GM to match\n" |
33 "$ requires the end of the GM to match\n" | 34 "$ requires the end of the GM to match\n" |
34 "^ and $ requires an exact match\n" | 35 "^ and $ requires an exact match\n" |
35 "If a GM does not match any list entry,\n" | 36 "If a GM does not match any list entry,\n" |
36 "it is skipped unless some list entry starts with ~"); | 37 "it is skipped unless some list entry starts with ~"); |
37 DEFINE_string(config, "8888 gpu", | 38 DEFINE_string(config, "8888 gpu", |
38 "Options: 565 8888 gpu msaa4 msaa16 gpunull gpudebug angle mesa"); // TO
DO(mtklein): pdf | 39 "Options: 565 8888 gpu msaa4 msaa16 gpunull gpudebug angle mesa"); // TO
DO(mtklein): pdf |
39 | 40 |
40 __SK_FORCE_IMAGE_DECODER_LINKING; | 41 __SK_FORCE_IMAGE_DECODER_LINKING; |
41 | 42 |
42 // Split str on any characters in delimiters into out. (Think, strtok with a sa
ne API.) | |
43 static void split(const char* str, const char* delimiters, SkTArray<SkString>* o
ut) { | |
44 const char* end = str + strlen(str); | |
45 while (str != end) { | |
46 // Find a token. | |
47 const size_t len = strcspn(str, delimiters); | |
48 out->push_back().set(str, len); | |
49 str += len; | |
50 // Skip any delimiters. | |
51 str += strspn(str, delimiters); | |
52 } | |
53 } | |
54 | |
55 // "FooBar" -> "foobar". Obviously, ASCII only. | 43 // "FooBar" -> "foobar". Obviously, ASCII only. |
56 static SkString lowercase(SkString s) { | 44 static SkString lowercase(SkString s) { |
57 for (size_t i = 0; i < s.size(); i++) { | 45 for (size_t i = 0; i < s.size(); i++) { |
58 s[i] = tolower(s[i]); | 46 s[i] = tolower(s[i]); |
59 } | 47 } |
60 return s; | 48 return s; |
61 } | 49 } |
62 | 50 |
63 static void kick_off_tasks(const SkTDArray<GMRegistry::Factory>& gms, | 51 static void kick_off_tasks(const SkTDArray<GMRegistry::Factory>& gms, |
64 const SkTArray<SkString>& configs, | 52 const SkTArray<SkString>& configs, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 }; | 115 }; |
128 | 116 |
129 int tool_main(int argc, char** argv); | 117 int tool_main(int argc, char** argv); |
130 int tool_main(int argc, char** argv) { | 118 int tool_main(int argc, char** argv) { |
131 SkGraphics::Init(); | 119 SkGraphics::Init(); |
132 | 120 |
133 SkCommandLineFlags::Parse(argc, argv); | 121 SkCommandLineFlags::Parse(argc, argv); |
134 GM::SetResourcePath(FLAGS_resources[0]); | 122 GM::SetResourcePath(FLAGS_resources[0]); |
135 SkTArray<SkString> configs; | 123 SkTArray<SkString> configs; |
136 for (int i = 0; i < FLAGS_config.count(); i++) { | 124 for (int i = 0; i < FLAGS_config.count(); i++) { |
137 split(FLAGS_config[i], ", ", &configs); | 125 SkStrSplit(FLAGS_config[i], ", ", &configs); |
138 } | 126 } |
139 | 127 |
140 SkTDArray<GMRegistry::Factory> gms; | 128 SkTDArray<GMRegistry::Factory> gms; |
141 for (const GMRegistry* reg = GMRegistry::Head(); reg != NULL; reg = reg->nex
t()) { | 129 for (const GMRegistry* reg = GMRegistry::Head(); reg != NULL; reg = reg->nex
t()) { |
142 SkAutoTDelete<GM> gmForName(reg->factory()(NULL)); | 130 SkAutoTDelete<GM> gmForName(reg->factory()(NULL)); |
143 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, gmForName->shortName())
) { | 131 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, gmForName->shortName())
) { |
144 *gms.append() = reg->factory(); | 132 *gms.append() = reg->factory(); |
145 } | 133 } |
146 } | 134 } |
147 SkDebugf("%d GMs x %d configs\n", gms.count(), configs.count()); | 135 SkDebugf("%d GMs x %d configs\n", gms.count(), configs.count()); |
(...skipping 15 matching lines...) Expand all Loading... |
163 SkGraphics::Term(); | 151 SkGraphics::Term(); |
164 | 152 |
165 return reporter.failed() > 0; | 153 return reporter.failed() > 0; |
166 } | 154 } |
167 | 155 |
168 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 156 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
169 int main(int argc, char** argv) { | 157 int main(int argc, char** argv) { |
170 return tool_main(argc, argv); | 158 return tool_main(argc, argv); |
171 } | 159 } |
172 #endif | 160 #endif |
OLD | NEW |