Chromium Code Reviews| 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, | |
|
epoger
2013/05/02 16:23:31
All patchset 2 does is extract prepare_subdirector
| |
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1865 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) { | 1885 if (moduloRemainder < 0 || moduloRemainder >= moduloDivisor) { |
| 1866 moduloRemainder = -1; | 1886 moduloRemainder = -1; |
| 1867 } | 1887 } |
| 1868 | 1888 |
| 1869 int gmsRun = 0; | 1889 int gmsRun = 0; |
| 1870 int gmIndex = -1; | 1890 int gmIndex = -1; |
| 1871 SkString moduloStr; | 1891 SkString moduloStr; |
| 1872 | 1892 |
| 1873 // If we will be writing out files, prepare subdirectories. | 1893 // If we will be writing out files, prepare subdirectories. |
| 1874 if (FLAGS_writePath.count() == 1) { | 1894 if (FLAGS_writePath.count() == 1) { |
| 1875 if (!sk_mkdir(FLAGS_writePath[0])) { | 1895 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHierarchy , configs)) { |
| 1876 return -1; | 1896 return -1; |
| 1877 } | 1897 } |
| 1878 if (gmmain.fUseFileHierarchy) { | |
| 1879 for (int i = 0; i < configs.count(); i++) { | |
| 1880 ConfigData config = gRec[configs[i]]; | |
| 1881 SkString subdir; | |
| 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 } | |
| 1889 } | 1898 } |
| 1890 | 1899 |
| 1891 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { | 1900 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { |
| 1892 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range. "); | 1901 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range. "); |
| 1893 } | 1902 } |
| 1894 | 1903 |
| 1895 Iter iter; | 1904 Iter iter; |
| 1896 GM* gm; | 1905 GM* gm; |
| 1897 while ((gm = iter.next()) != NULL) { | 1906 while ((gm = iter.next()) != NULL) { |
| 1898 SkAutoTDelete<GM> adgm(gm); | 1907 SkAutoTDelete<GM> adgm(gm); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1991 if (FLAGS_forceBWtext) { | 2000 if (FLAGS_forceBWtext) { |
| 1992 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2001 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 1993 } | 2002 } |
| 1994 } | 2003 } |
| 1995 | 2004 |
| 1996 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2005 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 1997 int main(int argc, char * const argv[]) { | 2006 int main(int argc, char * const argv[]) { |
| 1998 return tool_main(argc, (char**) argv); | 2007 return tool_main(argc, (char**) argv); |
| 1999 } | 2008 } |
| 2000 #endif | 2009 #endif |
| OLD | NEW |