Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Side by Side Diff: gm/gmmain.cpp

Issue 21715002: Refactor gmmain to separate out config parsing (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Minor cleanup Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 SkString subdir; 1760 SkString subdir;
1761 subdir.appendf("%s%c%s", root, SkPATH_SEPARATOR, config.fName); 1761 subdir.appendf("%s%c%s", root, SkPATH_SEPARATOR, config.fName);
1762 if (!sk_mkdir(subdir.c_str())) { 1762 if (!sk_mkdir(subdir.c_str())) {
1763 return false; 1763 return false;
1764 } 1764 }
1765 } 1765 }
1766 } 1766 }
1767 return true; 1767 return true;
1768 } 1768 }
1769 1769
1770 int tool_main(int argc, char** argv); 1770 static bool parse_flags_configs(SkTDArray<size_t>* outConfigs,
1771 int tool_main(int argc, char** argv) { 1771 GrContextFactory* grFactory) {
1772
1773 #if SK_ENABLE_INST_COUNT
1774 gPrintInstCount = true;
1775 #endif
1776
1777 SkGraphics::Init();
1778 // we don't need to see this during a run
1779 gSkSuppressFontCachePurgeSpew = true;
1780
1781 setSystemPreferences();
1782 GMMain gmmain;
1783
1784 SkTDArray<size_t> configs;
1785 SkTDArray<size_t> excludeConfigs; 1772 SkTDArray<size_t> excludeConfigs;
1786 bool userConfig = false;
1787
1788 SkString usage;
1789 usage.printf("Run the golden master tests.\n");
1790 SkCommandLineFlags::SetUsage(usage.c_str());
1791 SkCommandLineFlags::Parse(argc, argv);
1792
1793 gmmain.fUseFileHierarchy = FLAGS_hierarchy;
1794 gmmain.fWriteChecksumBasedFilenames = FLAGS_writeChecksumBasedFilenames;
1795 if (FLAGS_mismatchPath.count() == 1) {
1796 gmmain.fMismatchPath = FLAGS_mismatchPath[0];
1797 }
1798 if (FLAGS_missingExpectationsPath.count() == 1) {
1799 gmmain.fMissingExpectationsPath = FLAGS_missingExpectationsPath[0];
1800 }
1801 1773
1802 for (int i = 0; i < FLAGS_config.count(); i++) { 1774 for (int i = 0; i < FLAGS_config.count(); i++) {
1803 const char* config = FLAGS_config[i]; 1775 const char* config = FLAGS_config[i];
1804 userConfig = true;
1805 bool exclude = false; 1776 bool exclude = false;
1806 if (*config == kExcludeConfigChar) { 1777 if (*config == kExcludeConfigChar) {
1807 exclude = true; 1778 exclude = true;
1808 config += 1; 1779 config += 1;
1809 } 1780 }
1810 int index = findConfig(config); 1781 int index = findConfig(config);
1811 if (index >= 0) { 1782 if (index >= 0) {
1812 if (exclude) { 1783 if (exclude) {
1813 *excludeConfigs.append() = index; 1784 *excludeConfigs.append() = index;
1814 } else { 1785 } else {
1815 appendUnique<size_t>(&configs, index); 1786 appendUnique<size_t>(outConfigs, index);
1816 } 1787 }
1817 } else if (0 == strcmp(kDefaultsConfigStr, config)) { 1788 } else if (0 == strcmp(kDefaultsConfigStr, config)) {
1789 if (exclude) {
1790 gm_fprintf(stderr, "%c%s is not allowed.\n",
1791 kExcludeConfigChar, kDefaultsConfigStr);
1792 return false;
1793 }
1818 for (size_t c = 0; c < SK_ARRAY_COUNT(gRec); ++c) { 1794 for (size_t c = 0; c < SK_ARRAY_COUNT(gRec); ++c) {
1819 if (gRec[c].fRunByDefault) { 1795 if (gRec[c].fRunByDefault) {
1820 if (exclude) { 1796 appendUnique<size_t>(outConfigs, c);
1821 gm_fprintf(stderr, "%c%s is not allowed.\n",
1822 kExcludeConfigChar, kDefaultsConfigStr);
1823 return -1;
1824 } else {
1825 appendUnique<size_t>(&configs, c);
1826 }
1827 } 1797 }
1828 } 1798 }
1829 } else { 1799 } else {
1830 gm_fprintf(stderr, "unrecognized config %s\n", config); 1800 gm_fprintf(stderr, "unrecognized config %s\n", config);
1831 return -1; 1801 return false;
1832 } 1802 }
1833 } 1803 }
1834 1804
1835 for (int i = 0; i < FLAGS_excludeConfig.count(); i++) { 1805 for (int i = 0; i < FLAGS_excludeConfig.count(); i++) {
1836 int index = findConfig(FLAGS_excludeConfig[i]); 1806 int index = findConfig(FLAGS_excludeConfig[i]);
1837 if (index >= 0) { 1807 if (index >= 0) {
1838 *excludeConfigs.append() = index; 1808 *excludeConfigs.append() = index;
1839 } else { 1809 } else {
1840 gm_fprintf(stderr, "unrecognized excludeConfig %s\n", FLAGS_excludeC onfig[i]); 1810 gm_fprintf(stderr, "unrecognized excludeConfig %s\n", FLAGS_excludeC onfig[i]);
1841 return -1; 1811 return false;
1842 } 1812 }
1843 } 1813 }
1844 1814
1845 int moduloRemainder = -1; 1815 if (outConfigs->count() == 0) {
1846 int moduloDivisor = -1; 1816 // if no config is specified by user, add the defaults
1847 1817 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
1848 if (FLAGS_modulo.count() == 2) { 1818 if (gRec[i].fRunByDefault) {
1849 moduloRemainder = atoi(FLAGS_modulo[0]); 1819 *outConfigs->append() = i;
1850 moduloDivisor = atoi(FLAGS_modulo[1]); 1820 }
1851 if (moduloRemainder < 0 || moduloDivisor <= 0 || moduloRemainder >= modu loDivisor) { 1821 }
1852 gm_fprintf(stderr, "invalid modulo values."); 1822 }
1853 return -1; 1823 // now remove any explicitly excluded configs
1854 } 1824 for (int i = 0; i < excludeConfigs.count(); ++i) {
1855 } 1825 int index = outConfigs->find(excludeConfigs[i]);
1856 1826 if (index >= 0) {
1827 outConfigs->remove(index);
1828 // now assert that there was only one copy in configs[]
1829 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0);
1830 }
1831 }
1832
1833 #if SK_SUPPORT_GPU
1834 SkASSERT(grFactory != NULL);
1835 for (int i = 0; i < outConfigs->count(); ++i) {
1836 size_t index = (*outConfigs)[i];
1837 if (kGPU_Backend == gRec[index].fBackend) {
1838 GrContext* ctx = grFactory->get(gRec[index].fGLContextType);
1839 if (NULL == ctx) {
1840 gm_fprintf(stderr, "GrContext could not be created for config %s ."
1841 " Config will be skipped.\n", gRec[index].fName);
1842 outConfigs->remove(i);
1843 --i;
1844 continue;
1845 }
1846 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) {
1847 gm_fprintf(stderr, "Sample count (%d) of config %s is not suppor ted."
1848 " Config will be skipped.\n",
1849 gRec[index].fSampleCnt, gRec[index].fName);
1850 outConfigs->remove(i);
1851 --i;
1852 }
1853 }
1854 }
1855 #endif
1856
1857 if (outConfigs->isEmpty()) {
1858 gm_fprintf(stderr, "No configs to run.");
1859 return false;
1860 }
1861
1862 // now show the user the set of configs that will be run.
1863 SkString configStr("These configs will be run: ");
1864 // show the user the config that will run.
1865 for (int i = 0; i < outConfigs->count(); ++i) {
1866 configStr.appendf("%s ", gRec[(*outConfigs)[i]].fName);
1867 }
1868 gm_fprintf(stdout, "%s\n", configStr.c_str());
1869
1870 return true;
1871 }
1872
1873 static bool parse_flags_ignore_error_types(ErrorCombination* outErrorTypes) {
1857 if (FLAGS_ignoreErrorTypes.count() > 0) { 1874 if (FLAGS_ignoreErrorTypes.count() > 0) {
1858 gmmain.fIgnorableErrorTypes = ErrorCombination(); 1875 *outErrorTypes = ErrorCombination();
1859 for (int i = 0; i < FLAGS_ignoreErrorTypes.count(); i++) { 1876 for (int i = 0; i < FLAGS_ignoreErrorTypes.count(); i++) {
1860 ErrorType type; 1877 ErrorType type;
1861 const char *name = FLAGS_ignoreErrorTypes[i]; 1878 const char *name = FLAGS_ignoreErrorTypes[i];
1862 if (!getErrorTypeByName(name, &type)) { 1879 if (!getErrorTypeByName(name, &type)) {
1863 gm_fprintf(stderr, "cannot find ErrorType with name '%s'\n", nam e); 1880 gm_fprintf(stderr, "cannot find ErrorType with name '%s'\n", nam e);
1864 return -1; 1881 return false;
1865 } else { 1882 } else {
1866 gmmain.fIgnorableErrorTypes.add(type); 1883 outErrorTypes->add(type);
1867 } 1884 }
1868 } 1885 }
1869 } 1886 }
1870 1887 return true;
1871 #if SK_SUPPORT_GPU 1888 }
1889
1890 static bool parse_flags_modulo(int* moduloRemainder, int* moduloDivisor) {
1891 if (FLAGS_modulo.count() == 2) {
1892 *moduloRemainder = atoi(FLAGS_modulo[0]);
1893 *moduloDivisor = atoi(FLAGS_modulo[1]);
1894 if (*moduloRemainder < 0 || *moduloDivisor <= 0 ||
1895 *moduloRemainder >= *moduloDivisor) {
1896 gm_fprintf(stderr, "invalid modulo values.");
1897 return false;
1898 }
1899 }
1900 return true;
1901 }
1902
1903 #if SK_SUPPORT_GPU
1904 static bool parse_flags_gpu_cache(int* sizeBytes, int* sizeCount) {
1872 if (FLAGS_gpuCacheSize.count() > 0) { 1905 if (FLAGS_gpuCacheSize.count() > 0) {
1873 if (FLAGS_gpuCacheSize.count() != 2) { 1906 if (FLAGS_gpuCacheSize.count() != 2) {
1874 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n"); 1907 gm_fprintf(stderr, "--gpuCacheSize requires two arguments\n");
1875 return -1; 1908 return false;
1876 } 1909 }
1877 gGpuCacheSizeBytes = atoi(FLAGS_gpuCacheSize[0]); 1910 *sizeBytes = atoi(FLAGS_gpuCacheSize[0]);
1878 gGpuCacheSizeCount = atoi(FLAGS_gpuCacheSize[1]); 1911 *sizeCount = atoi(FLAGS_gpuCacheSize[1]);
1879 } else { 1912 } else {
1880 gGpuCacheSizeBytes = DEFAULT_CACHE_VALUE; 1913 *sizeBytes = DEFAULT_CACHE_VALUE;
1881 gGpuCacheSizeCount = DEFAULT_CACHE_VALUE; 1914 *sizeCount = DEFAULT_CACHE_VALUE;
1882 } 1915 }
1883 #endif 1916 return true;
1884 1917 }
1885 SkTDArray<SkScalar> tileGridReplayScales; 1918 #endif
1886 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal e 1.0 1919
1920 static bool parse_flags_tile_grid_replay_scales(SkTDArray<SkScalar>* outScales) {
1921 *outScales->append() = SK_Scalar1; // By default only test at scale 1.0
1887 if (FLAGS_tileGridReplayScales.count() > 0) { 1922 if (FLAGS_tileGridReplayScales.count() > 0) {
1888 tileGridReplayScales.reset(); 1923 outScales->reset();
1889 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) { 1924 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) {
1890 double val = atof(FLAGS_tileGridReplayScales[i]); 1925 double val = atof(FLAGS_tileGridReplayScales[i]);
1891 if (0 < val) { 1926 if (0 < val) {
1892 *tileGridReplayScales.append() = SkDoubleToScalar(val); 1927 *outScales->append() = SkDoubleToScalar(val);
1893 } 1928 }
1894 } 1929 }
1895 if (0 == tileGridReplayScales.count()) { 1930 if (0 == outScales->count()) {
1896 // Should have at least one scale 1931 // Should have at least one scale
1897 gm_fprintf(stderr, "--tileGridReplayScales requires at least one sca le.\n"); 1932 gm_fprintf(stderr, "--tileGridReplayScales requires at least one sca le.\n");
1898 return -1; 1933 return false;
1899 } 1934 }
1900 } 1935 }
1901 1936 return true;
1902 if (!userConfig) { 1937 }
1903 // if no config is specified by user, add the defaults 1938
1904 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 1939 static bool parse_flags_gmmain_paths(GMMain* gmmain) {
1905 if (gRec[i].fRunByDefault) { 1940 gmmain->fUseFileHierarchy = FLAGS_hierarchy;
1906 *configs.append() = i; 1941 gmmain->fWriteChecksumBasedFilenames = FLAGS_writeChecksumBasedFilenames;
1907 } 1942
1908 } 1943 if (FLAGS_mismatchPath.count() == 1) {
1909 } 1944 gmmain->fMismatchPath = FLAGS_mismatchPath[0];
1910 // now remove any explicitly excluded configs 1945 }
1911 for (int i = 0; i < excludeConfigs.count(); ++i) { 1946
1912 int index = configs.find(excludeConfigs[i]); 1947 if (FLAGS_missingExpectationsPath.count() == 1) {
1913 if (index >= 0) { 1948 gmmain->fMissingExpectationsPath = FLAGS_missingExpectationsPath[0];
1914 configs.remove(index);
1915 // now assert that there was only one copy in configs[]
1916 SkASSERT(configs.find(excludeConfigs[i]) < 0);
1917 }
1918 }
1919
1920 #if SK_SUPPORT_GPU
1921 GrContextFactory* grFactory = new GrContextFactory;
1922 for (int i = 0; i < configs.count(); ++i) {
1923 size_t index = configs[i];
1924 if (kGPU_Backend == gRec[index].fBackend) {
1925 GrContext* ctx = grFactory->get(gRec[index].fGLContextType);
1926 if (NULL == ctx) {
1927 gm_fprintf(stderr, "GrContext could not be created for config %s ."
1928 " Config will be skipped.\n", gRec[index].fName);
1929 configs.remove(i);
1930 --i;
1931 continue;
1932 }
1933 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) {
1934 gm_fprintf(stderr, "Sample count (%d) of config %s is not suppor ted."
1935 " Config will be skipped.\n", gRec[index].fSampleCnt, gRec[index].fName);
1936 configs.remove(i);
1937 --i;
1938 }
1939 }
1940 }
1941 #else
1942 GrContextFactory* grFactory = NULL;
1943 #endif
1944
1945 if (configs.isEmpty()) {
1946 gm_fprintf(stderr, "No configs to run.");
1947 return -1;
1948 }
1949
1950 // now show the user the set of configs that will be run.
1951 SkString configStr("These configs will be run: ");
1952 // show the user the config that will run.
1953 for (int i = 0; i < configs.count(); ++i) {
1954 configStr.appendf("%s%s", gRec[configs[i]].fName, (i == configs.count() - 1) ? "\n" : " ");
1955 }
1956 gm_fprintf(stdout, "%s", configStr.c_str());
1957
1958 if (FLAGS_resourcePath.count() == 1) {
1959 GM::SetResourcePath(FLAGS_resourcePath[0]);
1960 } 1949 }
1961 1950
1962 if (FLAGS_readPath.count() == 1) { 1951 if (FLAGS_readPath.count() == 1) {
1963 const char* readPath = FLAGS_readPath[0]; 1952 const char* readPath = FLAGS_readPath[0];
1964 if (!sk_exists(readPath)) { 1953 if (!sk_exists(readPath)) {
1965 gm_fprintf(stderr, "readPath %s does not exist!\n", readPath); 1954 gm_fprintf(stderr, "readPath %s does not exist!\n", readPath);
1966 return -1; 1955 return false;
1967 } 1956 }
1968 if (sk_isdir(readPath)) { 1957 if (sk_isdir(readPath)) {
1969 if (FLAGS_verbose) { 1958 if (FLAGS_verbose) {
1970 gm_fprintf(stdout, "reading from %s\n", readPath); 1959 gm_fprintf(stdout, "reading from %s\n", readPath);
1971 } 1960 }
1972 gmmain.fExpectationsSource.reset(SkNEW_ARGS( 1961 gmmain->fExpectationsSource.reset(SkNEW_ARGS(
1973 IndividualImageExpectationsSource, (readPath))); 1962 IndividualImageExpectationsSource, (readPath)));
1974 } else { 1963 } else {
1975 if (FLAGS_verbose) { 1964 if (FLAGS_verbose) {
1976 gm_fprintf(stdout, "reading expectations from JSON summary file %s\n", readPath); 1965 gm_fprintf(stdout, "reading expectations from JSON summary file %s\n", readPath);
1977 } 1966 }
1978 gmmain.fExpectationsSource.reset(SkNEW_ARGS( 1967 gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource, (readPath)));
1979 JsonExpectationsSource, (readPath))); 1968 }
1980 } 1969 }
1981 } 1970 return true;
1971 }
1972
1973 static bool parse_flags_match_strs(SkTDArray<const char*>* matchStrs) {
1974 for (int i = 0; i < FLAGS_match.count(); ++i) {
1975 matchStrs->push(FLAGS_match[i]);
1976 }
1977 return true;
1978 }
1979
1980 static bool parse_flags_resource_path() {
1981 if (FLAGS_resourcePath.count() == 1) {
1982 GM::SetResourcePath(FLAGS_resourcePath[0]);
1983 }
1984 return true;
1985 }
1986
1987 static bool parse_flags_jpeg_quality() {
1988 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) {
1989 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range. ");
1990 return false;
1991 }
1992 return true;
1993 }
1994
1995 int tool_main(int argc, char** argv);
1996 int tool_main(int argc, char** argv) {
1997
1998 #if SK_ENABLE_INST_COUNT
1999 gPrintInstCount = true;
2000 #endif
2001
2002 SkGraphics::Init();
2003 // we don't need to see this during a run
2004 gSkSuppressFontCachePurgeSpew = true;
2005
2006 setSystemPreferences();
2007 GMMain gmmain;
2008
2009 SkString usage;
2010 usage.printf("Run the golden master tests.\n");
2011 SkCommandLineFlags::SetUsage(usage.c_str());
2012 SkCommandLineFlags::Parse(argc, argv);
2013
2014 SkTDArray<size_t> configs;
2015 int moduloRemainder = -1;
2016 int moduloDivisor = -1;
2017 SkTDArray<SkScalar> tileGridReplayScales;
2018 #if SK_SUPPORT_GPU
2019 GrContextFactory* grFactory = new GrContextFactory;
2020 #else
2021 GrContextFactory* grFactory = NULL;
2022 #endif
2023 SkTDArray<const char*> matchStrs;
2024
2025 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) ||
2026 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) ||
2027 #if SK_SUPPORT_GPU
2028 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) ||
2029 #endif
2030 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) ||
2031 !parse_flags_gmmain_paths(&gmmain) ||
2032 !parse_flags_resource_path() ||
2033 !parse_flags_match_strs(&matchStrs) ||
2034 !parse_flags_jpeg_quality() ||
2035 !parse_flags_configs(&configs, grFactory)) {
2036 return -1;
2037 }
2038
1982 if (FLAGS_verbose) { 2039 if (FLAGS_verbose) {
1983 if (FLAGS_writePath.count() == 1) { 2040 if (FLAGS_writePath.count() == 1) {
1984 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]); 2041 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]);
1985 } 2042 }
1986 if (NULL != gmmain.fMismatchPath) { 2043 if (NULL != gmmain.fMismatchPath) {
1987 gm_fprintf(stdout, "writing mismatches to %s\n", gmmain.fMismatchPat h); 2044 gm_fprintf(stdout, "writing mismatches to %s\n", gmmain.fMismatchPat h);
1988 } 2045 }
1989 if (NULL != gmmain.fMissingExpectationsPath) { 2046 if (NULL != gmmain.fMissingExpectationsPath) {
1990 gm_fprintf(stdout, "writing images without expectations to %s\n", 2047 gm_fprintf(stdout, "writing images without expectations to %s\n",
1991 gmmain.fMissingExpectationsPath); 2048 gmmain.fMissingExpectationsPath);
1992 } 2049 }
1993 if (FLAGS_writePicturePath.count() == 1) { 2050 if (FLAGS_writePicturePath.count() == 1) {
1994 gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePat h[0]); 2051 gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePat h[0]);
1995 } 2052 }
1996 if (FLAGS_resourcePath.count() == 1) { 2053 if (FLAGS_resourcePath.count() == 1) {
1997 gm_fprintf(stdout, "reading resources from %s\n", FLAGS_resourcePath [0]); 2054 gm_fprintf(stdout, "reading resources from %s\n", FLAGS_resourcePath [0]);
1998 } 2055 }
1999 } 2056 }
2000 2057
2001 if (moduloDivisor <= 0) {
2002 moduloRemainder = -1;
2003 }
2004 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) {
2005 moduloRemainder = -1;
2006 }
2007
2008 int gmsRun = 0; 2058 int gmsRun = 0;
2009 int gmIndex = -1; 2059 int gmIndex = -1;
2010 SkString moduloStr; 2060 SkString moduloStr;
2011 2061
2012 // If we will be writing out files, prepare subdirectories. 2062 // If we will be writing out files, prepare subdirectories.
2013 if (FLAGS_writePath.count() == 1) { 2063 if (FLAGS_writePath.count() == 1) {
2014 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy , configs)) { 2064 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy , configs)) {
2015 return -1; 2065 return -1;
2016 } 2066 }
2017 } 2067 }
2018 if (NULL != gmmain.fMismatchPath) { 2068 if (NULL != gmmain.fMismatchPath) {
2019 if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarc hy, configs)) { 2069 if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarc hy, configs)) {
2020 return -1; 2070 return -1;
2021 } 2071 }
2022 } 2072 }
2023 if (NULL != gmmain.fMissingExpectationsPath) { 2073 if (NULL != gmmain.fMissingExpectationsPath) {
2024 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUse FileHierarchy, 2074 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.fUse FileHierarchy,
2025 configs)) { 2075 configs)) {
2026 return -1; 2076 return -1;
2027 } 2077 }
2028 } 2078 }
2029 2079
2030 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) {
2031 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range. ");
2032 }
2033
2034 Iter iter; 2080 Iter iter;
2035 GM* gm; 2081 GM* gm;
2036 while ((gm = iter.next()) != NULL) { 2082 while ((gm = iter.next()) != NULL) {
2037 SkAutoTDelete<GM> adgm(gm); 2083 SkAutoTDelete<GM> adgm(gm);
2038 ++gmIndex; 2084 ++gmIndex;
2039 if (moduloRemainder >= 0) { 2085 if (moduloRemainder >= 0) {
2040 if ((gmIndex % moduloDivisor) != moduloRemainder) { 2086 if ((gmIndex % moduloDivisor) != moduloRemainder) {
2041 continue; 2087 continue;
2042 } 2088 }
2043 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); 2089 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor);
2044 } 2090 }
2045 2091
2046 const char* shortName = gm->shortName(); 2092 const char* shortName = gm->shortName();
2047 2093
2048 SkTDArray<const char*> matchStrs;
2049 for (int i = 0; i < FLAGS_match.count(); ++i) {
2050 matchStrs.push(FLAGS_match[i]);
2051 }
2052 if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) { 2094 if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) {
2053 continue; 2095 continue;
2054 } 2096 }
2055 2097
2056 gmsRun++; 2098 gmsRun++;
2057 SkISize size = gm->getISize(); 2099 SkISize size = gm->getISize();
2058 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name, 2100 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short Name,
2059 size.width(), size.height()); 2101 size.width(), size.height());
2060 2102
2061 run_multiple_configs(gmmain, gm, configs, grFactory); 2103 run_multiple_configs(gmmain, gm, configs, grFactory);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 if (FLAGS_forceBWtext) { 2177 if (FLAGS_forceBWtext) {
2136 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2178 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2137 } 2179 }
2138 } 2180 }
2139 2181
2140 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2182 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2141 int main(int argc, char * const argv[]) { 2183 int main(int argc, char * const argv[]) {
2142 return tool_main(argc, (char**) argv); 2184 return tool_main(argc, (char**) argv);
2143 } 2185 }
2144 #endif 2186 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698