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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1401 } | 1401 } |
1402 | 1402 |
1403 // Macro magic to convert a numeric preprocessor token into a string. | 1403 // Macro magic to convert a numeric preprocessor token into a string. |
1404 // Adapted from http://stackoverflow.com/questions/240353/convert-a-preprocessor -token-to-a-string | 1404 // Adapted from http://stackoverflow.com/questions/240353/convert-a-preprocessor -token-to-a-string |
1405 // This should probably be moved into one of our common headers... | 1405 // This should probably be moved into one of our common headers... |
1406 #define TOSTRING_INTERNAL(x) #x | 1406 #define TOSTRING_INTERNAL(x) #x |
1407 #define TOSTRING(x) TOSTRING_INTERNAL(x) | 1407 #define TOSTRING(x) TOSTRING_INTERNAL(x) |
1408 | 1408 |
1409 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). | 1409 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). |
1410 DEFINE_string(config, "", configUsage().c_str()); | 1410 DEFINE_string(config, "", configUsage().c_str()); |
1411 DEFINE_string(pdfRasterizers, "", pdfRasterizerUsage().c_str()); | 1411 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); |
1412 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); | 1412 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); |
1413 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); | 1413 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); |
1414 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); | 1414 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); |
1415 #if SK_SUPPORT_GPU | 1415 #if SK_SUPPORT_GPU |
1416 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or " | 1416 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si ze or " |
1417 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " | 1417 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means " |
1418 "use the default. 0 for either disables the cache."); | 1418 "use the default. 0 for either disables the cache."); |
1419 #endif | 1419 #endif |
1420 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " | 1420 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " |
1421 "when reading/writing files."); | 1421 "when reading/writing files."); |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1995 bool configHasPDF = false; | 1995 bool configHasPDF = false; |
1996 for (int i = 0; i < configs.count(); i++) { | 1996 for (int i = 0; i < configs.count(); i++) { |
1997 if (gRec[configs[i]].fBackend == kPDF_Backend) { | 1997 if (gRec[configs[i]].fBackend == kPDF_Backend) { |
1998 configHasPDF = true; | 1998 configHasPDF = true; |
1999 break; | 1999 break; |
2000 } | 2000 } |
2001 } | 2001 } |
2002 if (!configHasPDF) { | 2002 if (!configHasPDF) { |
2003 return true; | 2003 return true; |
2004 } | 2004 } |
2005 | 2005 |
robertphillips
2013/11/06 16:36:13
Won't this now not use a rasterizer by default?
vandebo (ex-Chrome)
2013/11/06 16:46:40
I changed the default value of the flag to "defaul
| |
2006 for (int i = 0; i < FLAGS_pdfRasterizers.count(); i++) { | 2006 if (FLAGS_pdfRasterizers.count() == 1 && |
2007 const char* rasterizer = FLAGS_pdfRasterizers[i]; | 2007 !strcmp(FLAGS_pdfRasterizers[0], "default")) { |
2008 const PDFRasterizerData* rasterizerPtr = findPDFRasterizer(rasterizer); | |
2009 | |
2010 if (rasterizerPtr == NULL) { | |
2011 gm_fprintf(stderr, "unrecognized rasterizer %s\n", rasterizer); | |
2012 return false; | |
2013 } | |
2014 appendUnique<const PDFRasterizerData*>(outRasterizers, | |
2015 rasterizerPtr); | |
2016 } | |
2017 | |
2018 if (outRasterizers->count() == 0) { | |
2019 // if no config is specified by user, add the defaults | |
2020 for (int i = 0; i < (int)SK_ARRAY_COUNT(kPDFRasterizers); ++i) { | 2008 for (int i = 0; i < (int)SK_ARRAY_COUNT(kPDFRasterizers); ++i) { |
2021 if (kPDFRasterizers[i].fRunByDefault) { | 2009 if (kPDFRasterizers[i].fRunByDefault) { |
2022 *outRasterizers->append() = &kPDFRasterizers[i]; | 2010 *outRasterizers->append() = &kPDFRasterizers[i]; |
2023 } | 2011 } |
2024 } | 2012 } |
2013 } else { | |
2014 for (int i = 0; i < FLAGS_pdfRasterizers.count(); i++) { | |
2015 const char* rasterizer = FLAGS_pdfRasterizers[i]; | |
2016 const PDFRasterizerData* rasterizerPtr = | |
2017 findPDFRasterizer(rasterizer); | |
2018 if (rasterizerPtr == NULL) { | |
2019 gm_fprintf(stderr, "unrecognized rasterizer %s\n", rasterizer); | |
2020 return false; | |
2021 } | |
2022 appendUnique<const PDFRasterizerData*>(outRasterizers, | |
2023 rasterizerPtr); | |
2024 } | |
2025 } | 2025 } |
2026 | 2026 |
2027 // now show the user the set of configs that will be run. | 2027 // now show the user the set of configs that will be run. |
2028 SkString configStr("These PDF rasterizers will be run:"); | 2028 SkString configStr("These PDF rasterizers will be run:"); |
2029 // show the user the config that will run. | 2029 // show the user the config that will run. |
2030 for (int i = 0; i < outRasterizers->count(); ++i) { | 2030 for (int i = 0; i < outRasterizers->count(); ++i) { |
2031 configStr.appendf(" %s", (*outRasterizers)[i]->fName); | 2031 configStr.appendf(" %s", (*outRasterizers)[i]->fName); |
2032 } | 2032 } |
2033 gm_fprintf(stdout, "%s\n", configStr.c_str()); | 2033 gm_fprintf(stdout, "%s\n", configStr.c_str()); |
2034 | 2034 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2375 if (FLAGS_forceBWtext) { | 2375 if (FLAGS_forceBWtext) { |
2376 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2376 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2377 } | 2377 } |
2378 } | 2378 } |
2379 | 2379 |
2380 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2380 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2381 int main(int argc, char * const argv[]) { | 2381 int main(int argc, char * const argv[]) { |
2382 return tool_main(argc, (char**) argv); | 2382 return tool_main(argc, (char**) argv); |
2383 } | 2383 } |
2384 #endif | 2384 #endif |
OLD | NEW |