Revert r10280, which caused https://code.google.com/p/skia/issues/detail?id=1441
Review URL: https://codereview.chromium.org/19537005
git-svn-id: http://skia.googlecode.com/svn/trunk@10284 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index c0471d5..01eaaeb 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -38,6 +38,8 @@
#include "SkTileGridPicture.h"
#include "SamplePipeControllers.h"
+__SK_FORCE_IMAGE_DECODER_LINKING;
+
#ifdef SK_BUILD_FOR_WIN
// json includes xlocale which generates warning 4530 because we're compiling without
// exceptions; see https://code.google.com/p/skia/issues/detail?id=1067
@@ -1408,6 +1410,38 @@
return -1;
}
+static bool skip_name(SkCommandLineFlags::StringArray array, const char name[]) {
+ // FIXME: this duplicates the logic in test/skia_test.cpp -- consolidate
+ int count = array.count();
+ size_t testLen = strlen(name);
+ bool anyExclude = count == 0;
+ for (int i = 0; i < array.count(); ++i) {
+ const char* matchName = array[i];
+ size_t matchLen = strlen(matchName);
+ bool matchExclude, matchStart, matchEnd;
+ if ((matchExclude = matchName[0] == '~')) {
+ anyExclude = true;
+ matchName++;
+ matchLen--;
+ }
+ if ((matchStart = matchName[0] == '^')) {
+ matchName++;
+ matchLen--;
+ }
+ if ((matchEnd = matchName[matchLen - 1] == '$')) {
+ matchLen--;
+ }
+ if (matchStart ? (!matchEnd || matchLen == testLen)
+ && strncmp(name, matchName, matchLen) == 0
+ : matchEnd ? matchLen <= testLen
+ && strncmp(name + testLen - matchLen, matchName, matchLen) == 0
+ : strstr(name, matchName) != 0) {
+ return matchExclude;
+ }
+ }
+ return !anyExclude;
+}
+
namespace skiagm {
#if SK_SUPPORT_GPU
SkAutoTUnref<GrContext> gGrContext;
@@ -2042,12 +2076,7 @@
}
const char* shortName = gm->shortName();
-
- SkTDArray<const char*> matchStrs;
- for (int i = 0; i < FLAGS_match.count(); ++i) {
- matchStrs.push(FLAGS_match[i]);
- }
- if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) {
+ if (skip_name(FLAGS_match, shortName)) {
continue;
}