support multiple (OR'd) -match parameters
git-svn-id: http://skia.googlecode.com/svn/trunk@2568 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 7800abc..c58d5b1 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -232,6 +232,20 @@
}
}
+static bool skip_name(const SkTDArray<const char*> array, const char name[]) {
+ if (0 == array.count()) {
+ // no names, so don't skip anything
+ return false;
+ }
+ for (int i = 0; i < array.count(); ++i) {
+ if (strstr(name, array[i])) {
+ // found the name, so don't skip
+ return false;
+ }
+ }
+ return true;
+}
+
int main (int argc, char * const argv[]) {
SkAutoGraphics ag;
@@ -247,10 +261,10 @@
bool doScale = false;
bool doRotate = false;
bool doClip = false;
- const char* matchStr = NULL;
bool hasStrokeWidth = false;
float strokeWidth;
bool useNullGL = false;
+ SkTDArray<const char*> fMatches;
SkString outDir;
SkBitmap::Config outConfig = SkBitmap::kNo_Config;
@@ -342,7 +356,7 @@
} else if (strcmp(*argv, "-match") == 0) {
argv++;
if (argv < stop) {
- matchStr = *argv;
+ *fMatches.append() = *argv;
} else {
log_error("missing arg for -match\n");
return -1;
@@ -485,7 +499,7 @@
}
// only run benchmarks if their name contains matchStr
- if (matchStr && strstr(bench->getName(), matchStr) == NULL) {
+ if (skip_name(fMatches, bench->getName())) {
continue;
}