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 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 if (i > 0) { | 1633 if (i > 0) { |
1634 total.append(", "); | 1634 total.append(", "); |
1635 } | 1635 } |
1636 total.append("\""); | 1636 total.append("\""); |
1637 total.append(gRec[configs[i]].fName); | 1637 total.append(gRec[configs[i]].fName); |
1638 total.append("\""); | 1638 total.append("\""); |
1639 } | 1639 } |
1640 return total; | 1640 return total; |
1641 } | 1641 } |
1642 | 1642 |
| 1643 bool prepare_subdirectories(const char *root, bool useFileHierarchy, |
| 1644 const SkTDArray<size_t> &configs); |
| 1645 bool prepare_subdirectories(const char *root, bool useFileHierarchy, |
| 1646 const SkTDArray<size_t> &configs) { |
| 1647 if (!sk_mkdir(root)) { |
| 1648 return false; |
| 1649 } |
| 1650 if (useFileHierarchy) { |
| 1651 for (int i = 0; i < configs.count(); i++) { |
| 1652 ConfigData config = gRec[configs[i]]; |
| 1653 SkString subdir; |
| 1654 subdir.appendf("%s%c%s", root, SkPATH_SEPARATOR, config.fName); |
| 1655 if (!sk_mkdir(subdir.c_str())) { |
| 1656 return false; |
| 1657 } |
| 1658 } |
| 1659 } |
| 1660 return true; |
| 1661 } |
| 1662 |
1643 int tool_main(int argc, char** argv); | 1663 int tool_main(int argc, char** argv); |
1644 int tool_main(int argc, char** argv) { | 1664 int tool_main(int argc, char** argv) { |
1645 | 1665 |
1646 #if SK_ENABLE_INST_COUNT | 1666 #if SK_ENABLE_INST_COUNT |
1647 gPrintInstCount = true; | 1667 gPrintInstCount = true; |
1648 #endif | 1668 #endif |
1649 | 1669 |
1650 SkGraphics::Init(); | 1670 SkGraphics::Init(); |
1651 // we don't need to see this during a run | 1671 // we don't need to see this during a run |
1652 gSkSuppressFontCachePurgeSpew = true; | 1672 gSkSuppressFontCachePurgeSpew = true; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 gm_fprintf(stdout, "reading expectations from JSON summary file
%s\n", readPath); | 1864 gm_fprintf(stdout, "reading expectations from JSON summary file
%s\n", readPath); |
1845 } | 1865 } |
1846 gmmain.fExpectationsSource.reset(SkNEW_ARGS( | 1866 gmmain.fExpectationsSource.reset(SkNEW_ARGS( |
1847 JsonExpectationsSource, (readPath))); | 1867 JsonExpectationsSource, (readPath))); |
1848 } | 1868 } |
1849 } | 1869 } |
1850 if (FLAGS_verbose) { | 1870 if (FLAGS_verbose) { |
1851 if (FLAGS_writePath.count() == 1) { | 1871 if (FLAGS_writePath.count() == 1) { |
1852 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]); | 1872 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]); |
1853 } | 1873 } |
| 1874 if (NULL != gmmain.fMismatchPath) { |
| 1875 gm_fprintf(stdout, "writing mismatches to %s\n", gmmain.fMismatchPat
h); |
| 1876 } |
1854 if (FLAGS_writePicturePath.count() == 1) { | 1877 if (FLAGS_writePicturePath.count() == 1) { |
1855 gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePat
h[0]); | 1878 gm_fprintf(stdout, "writing pictures to %s\n", FLAGS_writePicturePat
h[0]); |
1856 } | 1879 } |
1857 if (FLAGS_resourcePath.count() == 1) { | 1880 if (FLAGS_resourcePath.count() == 1) { |
1858 gm_fprintf(stdout, "reading resources from %s\n", FLAGS_resourcePath
[0]); | 1881 gm_fprintf(stdout, "reading resources from %s\n", FLAGS_resourcePath
[0]); |
1859 } | 1882 } |
1860 } | 1883 } |
1861 | 1884 |
1862 if (moduloDivisor <= 0) { | 1885 if (moduloDivisor <= 0) { |
1863 moduloRemainder = -1; | 1886 moduloRemainder = -1; |
1864 } | 1887 } |
1865 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) { | 1888 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) { |
1866 moduloRemainder = -1; | 1889 moduloRemainder = -1; |
1867 } | 1890 } |
1868 | 1891 |
1869 int gmsRun = 0; | 1892 int gmsRun = 0; |
1870 int gmIndex = -1; | 1893 int gmIndex = -1; |
1871 SkString moduloStr; | 1894 SkString moduloStr; |
1872 | 1895 |
1873 // If we will be writing out files, prepare subdirectories. | 1896 // If we will be writing out files, prepare subdirectories. |
1874 if (FLAGS_writePath.count() == 1) { | 1897 if (FLAGS_writePath.count() == 1) { |
1875 if (!sk_mkdir(FLAGS_writePath[0])) { | 1898 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy
, configs)) { |
1876 return -1; | 1899 return -1; |
1877 } | 1900 } |
1878 if (gmmain.fUseFileHierarchy) { | 1901 } |
1879 for (int i = 0; i < configs.count(); i++) { | 1902 if (NULL != gmmain.fMismatchPath) { |
1880 ConfigData config = gRec[configs[i]]; | 1903 if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHierarc
hy, configs)) { |
1881 SkString subdir; | 1904 return -1; |
1882 subdir.appendf("%s%c%s", FLAGS_writePath[0], SkPATH_SEPARATOR, | |
1883 config.fName); | |
1884 if (!sk_mkdir(subdir.c_str())) { | |
1885 return -1; | |
1886 } | |
1887 } | |
1888 } | 1905 } |
1889 } | 1906 } |
1890 | 1907 |
1891 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { | 1908 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { |
1892 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range.
"); | 1909 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range.
"); |
1893 } | 1910 } |
1894 | 1911 |
1895 Iter iter; | 1912 Iter iter; |
1896 GM* gm; | 1913 GM* gm; |
1897 while ((gm = iter.next()) != NULL) { | 1914 while ((gm = iter.next()) != NULL) { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 if (FLAGS_forceBWtext) { | 2008 if (FLAGS_forceBWtext) { |
1992 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2009 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
1993 } | 2010 } |
1994 } | 2011 } |
1995 | 2012 |
1996 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2013 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1997 int main(int argc, char * const argv[]) { | 2014 int main(int argc, char * const argv[]) { |
1998 return tool_main(argc, (char**) argv); | 2015 return tool_main(argc, (char**) argv); |
1999 } | 2016 } |
2000 #endif | 2017 #endif |
OLD | NEW |