OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 /* | 8 /* |
9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
10 * | 10 * |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "SkImageEncoder.h" | 31 #include "SkImageEncoder.h" |
32 #include "SkOSFile.h" | 32 #include "SkOSFile.h" |
33 #include "SkPicture.h" | 33 #include "SkPicture.h" |
34 #include "SkRefCnt.h" | 34 #include "SkRefCnt.h" |
35 #include "SkStream.h" | 35 #include "SkStream.h" |
36 #include "SkTArray.h" | 36 #include "SkTArray.h" |
37 #include "SkTDict.h" | 37 #include "SkTDict.h" |
38 #include "SkTileGridPicture.h" | 38 #include "SkTileGridPicture.h" |
39 #include "SamplePipeControllers.h" | 39 #include "SamplePipeControllers.h" |
40 | 40 |
| 41 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 42 |
41 #ifdef SK_BUILD_FOR_WIN | 43 #ifdef SK_BUILD_FOR_WIN |
42 // json includes xlocale which generates warning 4530 because we're compilin
g without | 44 // json includes xlocale which generates warning 4530 because we're compilin
g without |
43 // exceptions; see https://code.google.com/p/skia/issues/detail?id=1067 | 45 // exceptions; see https://code.google.com/p/skia/issues/detail?id=1067 |
44 #pragma warning(push) | 46 #pragma warning(push) |
45 #pragma warning(disable : 4530) | 47 #pragma warning(disable : 4530) |
46 #endif | 48 #endif |
47 #include "json/value.h" | 49 #include "json/value.h" |
48 #ifdef SK_BUILD_FOR_WIN | 50 #ifdef SK_BUILD_FOR_WIN |
49 #pragma warning(pop) | 51 #pragma warning(pop) |
50 #endif | 52 #endif |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 | 1403 |
1402 static int findConfig(const char config[]) { | 1404 static int findConfig(const char config[]) { |
1403 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { | 1405 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { |
1404 if (!strcmp(config, gRec[i].fName)) { | 1406 if (!strcmp(config, gRec[i].fName)) { |
1405 return (int) i; | 1407 return (int) i; |
1406 } | 1408 } |
1407 } | 1409 } |
1408 return -1; | 1410 return -1; |
1409 } | 1411 } |
1410 | 1412 |
| 1413 static bool skip_name(SkCommandLineFlags::StringArray array, const char name[])
{ |
| 1414 // FIXME: this duplicates the logic in test/skia_test.cpp -- consolidate |
| 1415 int count = array.count(); |
| 1416 size_t testLen = strlen(name); |
| 1417 bool anyExclude = count == 0; |
| 1418 for (int i = 0; i < array.count(); ++i) { |
| 1419 const char* matchName = array[i]; |
| 1420 size_t matchLen = strlen(matchName); |
| 1421 bool matchExclude, matchStart, matchEnd; |
| 1422 if ((matchExclude = matchName[0] == '~')) { |
| 1423 anyExclude = true; |
| 1424 matchName++; |
| 1425 matchLen--; |
| 1426 } |
| 1427 if ((matchStart = matchName[0] == '^')) { |
| 1428 matchName++; |
| 1429 matchLen--; |
| 1430 } |
| 1431 if ((matchEnd = matchName[matchLen - 1] == '$')) { |
| 1432 matchLen--; |
| 1433 } |
| 1434 if (matchStart ? (!matchEnd || matchLen == testLen) |
| 1435 && strncmp(name, matchName, matchLen) == 0 |
| 1436 : matchEnd ? matchLen <= testLen |
| 1437 && strncmp(name + testLen - matchLen, matchName, matchLen) == 0 |
| 1438 : strstr(name, matchName) != 0) { |
| 1439 return matchExclude; |
| 1440 } |
| 1441 } |
| 1442 return !anyExclude; |
| 1443 } |
| 1444 |
1411 namespace skiagm { | 1445 namespace skiagm { |
1412 #if SK_SUPPORT_GPU | 1446 #if SK_SUPPORT_GPU |
1413 SkAutoTUnref<GrContext> gGrContext; | 1447 SkAutoTUnref<GrContext> gGrContext; |
1414 /** | 1448 /** |
1415 * Sets the global GrContext, accessible by individual GMs | 1449 * Sets the global GrContext, accessible by individual GMs |
1416 */ | 1450 */ |
1417 static void SetGr(GrContext* grContext) { | 1451 static void SetGr(GrContext* grContext) { |
1418 SkSafeRef(grContext); | 1452 SkSafeRef(grContext); |
1419 gGrContext.reset(grContext); | 1453 gGrContext.reset(grContext); |
1420 } | 1454 } |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 SkAutoTDelete<GM> adgm(gm); | 2069 SkAutoTDelete<GM> adgm(gm); |
2036 ++gmIndex; | 2070 ++gmIndex; |
2037 if (moduloRemainder >= 0) { | 2071 if (moduloRemainder >= 0) { |
2038 if ((gmIndex % moduloDivisor) != moduloRemainder) { | 2072 if ((gmIndex % moduloDivisor) != moduloRemainder) { |
2039 continue; | 2073 continue; |
2040 } | 2074 } |
2041 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); | 2075 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); |
2042 } | 2076 } |
2043 | 2077 |
2044 const char* shortName = gm->shortName(); | 2078 const char* shortName = gm->shortName(); |
2045 | 2079 if (skip_name(FLAGS_match, shortName)) { |
2046 SkTDArray<const char*> matchStrs; | |
2047 for (int i = 0; i < FLAGS_match.count(); ++i) { | |
2048 matchStrs.push(FLAGS_match[i]); | |
2049 } | |
2050 if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) { | |
2051 continue; | 2080 continue; |
2052 } | 2081 } |
2053 | 2082 |
2054 gmsRun++; | 2083 gmsRun++; |
2055 SkISize size = gm->getISize(); | 2084 SkISize size = gm->getISize(); |
2056 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, | 2085 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, |
2057 size.width(), size.height()); | 2086 size.width(), size.height()); |
2058 | 2087 |
2059 run_multiple_configs(gmmain, gm, configs, grFactory); | 2088 run_multiple_configs(gmmain, gm, configs, grFactory); |
2060 | 2089 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 if (FLAGS_forceBWtext) { | 2162 if (FLAGS_forceBWtext) { |
2134 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2163 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2135 } | 2164 } |
2136 } | 2165 } |
2137 | 2166 |
2138 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2167 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2139 int main(int argc, char * const argv[]) { | 2168 int main(int argc, char * const argv[]) { |
2140 return tool_main(argc, (char**) argv); | 2169 return tool_main(argc, (char**) argv); |
2141 } | 2170 } |
2142 #endif | 2171 #endif |
OLD | NEW |