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 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 if (!sk_mkdir(subdir.c_str())) { | 1800 if (!sk_mkdir(subdir.c_str())) { |
1801 return -1; | 1801 return -1; |
1802 } | 1802 } |
1803 } | 1803 } |
1804 } | 1804 } |
1805 } | 1805 } |
1806 | 1806 |
1807 Iter iter; | 1807 Iter iter; |
1808 GM* gm; | 1808 GM* gm; |
1809 while ((gm = iter.next()) != NULL) { | 1809 while ((gm = iter.next()) != NULL) { |
1810 | 1810 SkAutoTDelete<GM> adgm(gm); |
1811 ++gmIndex; | 1811 ++gmIndex; |
1812 if (moduloRemainder >= 0) { | 1812 if (moduloRemainder >= 0) { |
1813 if ((gmIndex % moduloDivisor) != moduloRemainder) { | 1813 if ((gmIndex % moduloDivisor) != moduloRemainder) { |
1814 continue; | 1814 continue; |
1815 } | 1815 } |
1816 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); | 1816 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); |
1817 } | 1817 } |
1818 | 1818 |
1819 const char* shortName = gm->shortName(); | 1819 const char* shortName = gm->shortName(); |
1820 if (skip_name(FLAGS_match, shortName)) { | 1820 if (skip_name(FLAGS_match, shortName)) { |
1821 SkDELETE(gm); | |
1822 continue; | 1821 continue; |
1823 } | 1822 } |
1824 | 1823 |
1825 gmsRun++; | 1824 gmsRun++; |
1826 SkISize size = gm->getISize(); | 1825 SkISize size = gm->getISize(); |
1827 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, | 1826 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, |
1828 size.width(), size.height()); | 1827 size.width(), size.height()); |
1829 | 1828 |
1830 run_multiple_configs(gmmain, gm, configs, grFactory); | 1829 run_multiple_configs(gmmain, gm, configs, grFactory); |
1831 | 1830 |
1832 SkBitmap comparisonBitmap; | 1831 SkBitmap comparisonBitmap; |
1833 const ConfigData compareConfig = | 1832 const ConfigData compareConfig = |
1834 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextT
ype, 0, kRW_ConfigFlag, "comparison", false }; | 1833 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextT
ype, 0, kRW_ConfigFlag, "comparison", false }; |
1835 gmmain.generate_image(gm, compareConfig, NULL, &comparisonBitmap, false)
; | 1834 gmmain.generate_image(gm, compareConfig, NULL, &comparisonBitmap, false)
; |
1836 | 1835 |
1837 // TODO(epoger): only run this if gmmain.generate_image() succeeded? | 1836 // TODO(epoger): only run this if gmmain.generate_image() succeeded? |
1838 // Otherwise, what are we comparing against? | 1837 // Otherwise, what are we comparing against? |
1839 run_multiple_modes(gmmain, gm, compareConfig, comparisonBitmap, tileGrid
ReplayScales); | 1838 run_multiple_modes(gmmain, gm, compareConfig, comparisonBitmap, tileGrid
ReplayScales); |
1840 | |
1841 SkDELETE(gm); | |
1842 } | 1839 } |
1843 | 1840 |
1844 SkTArray<SkString> modes; | 1841 SkTArray<SkString> modes; |
1845 gmmain.GetRenderModesEncountered(modes); | 1842 gmmain.GetRenderModesEncountered(modes); |
1846 bool reportError = false; | 1843 bool reportError = false; |
1847 if (gmmain.NumSignificantErrors() > 0) { | 1844 if (gmmain.NumSignificantErrors() > 0) { |
1848 reportError = true; | 1845 reportError = true; |
1849 } | 1846 } |
1850 int expectedNumberOfTests = gmsRun * (configs.count() + modes.count()); | 1847 int expectedNumberOfTests = gmsRun * (configs.count() + modes.count()); |
1851 | 1848 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 if (FLAGS_forceBWtext) { | 1911 if (FLAGS_forceBWtext) { |
1915 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 1912 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
1916 } | 1913 } |
1917 } | 1914 } |
1918 | 1915 |
1919 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1916 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1920 int main(int argc, char * const argv[]) { | 1917 int main(int argc, char * const argv[]) { |
1921 return tool_main(argc, (char**) argv); | 1918 return tool_main(argc, (char**) argv); |
1922 } | 1919 } |
1923 #endif | 1920 #endif |
OLD | NEW |