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 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 } else { | 2086 } else { |
2087 if (FLAGS_verbose) { | 2087 if (FLAGS_verbose) { |
2088 gm_fprintf(stdout, "reading expectations from JSON summary file
%s\n", readPath); | 2088 gm_fprintf(stdout, "reading expectations from JSON summary file
%s\n", readPath); |
2089 } | 2089 } |
2090 gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource,
(readPath))); | 2090 gmmain->fExpectationsSource.reset(SkNEW_ARGS(JsonExpectationsSource,
(readPath))); |
2091 } | 2091 } |
2092 } | 2092 } |
2093 return true; | 2093 return true; |
2094 } | 2094 } |
2095 | 2095 |
2096 static bool parse_flags_match_strs(SkTDArray<const char*>* matchStrs) { | |
2097 for (int i = 0; i < FLAGS_match.count(); ++i) { | |
2098 matchStrs->push(FLAGS_match[i]); | |
2099 } | |
2100 return true; | |
2101 } | |
2102 | |
2103 static bool parse_flags_resource_path() { | 2096 static bool parse_flags_resource_path() { |
2104 if (FLAGS_resourcePath.count() == 1) { | 2097 if (FLAGS_resourcePath.count() == 1) { |
2105 GM::SetResourcePath(FLAGS_resourcePath[0]); | 2098 GM::SetResourcePath(FLAGS_resourcePath[0]); |
2106 } | 2099 } |
2107 return true; | 2100 return true; |
2108 } | 2101 } |
2109 | 2102 |
2110 static bool parse_flags_jpeg_quality() { | 2103 static bool parse_flags_jpeg_quality() { |
2111 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { | 2104 if (FLAGS_pdfJpegQuality < -1 || FLAGS_pdfJpegQuality > 100) { |
2112 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range.
"); | 2105 gm_fprintf(stderr, "%s\n", "pdfJpegQuality must be in [-1 .. 100] range.
"); |
(...skipping 25 matching lines...) Expand all Loading... |
2138 | 2131 |
2139 int moduloRemainder = -1; | 2132 int moduloRemainder = -1; |
2140 int moduloDivisor = -1; | 2133 int moduloDivisor = -1; |
2141 SkTDArray<const PDFRasterizerData*> pdfRasterizers; | 2134 SkTDArray<const PDFRasterizerData*> pdfRasterizers; |
2142 SkTDArray<SkScalar> tileGridReplayScales; | 2135 SkTDArray<SkScalar> tileGridReplayScales; |
2143 #if SK_SUPPORT_GPU | 2136 #if SK_SUPPORT_GPU |
2144 GrContextFactory* grFactory = new GrContextFactory; | 2137 GrContextFactory* grFactory = new GrContextFactory; |
2145 #else | 2138 #else |
2146 GrContextFactory* grFactory = NULL; | 2139 GrContextFactory* grFactory = NULL; |
2147 #endif | 2140 #endif |
2148 SkTDArray<const char*> matchStrs; | |
2149 | 2141 |
2150 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || | 2142 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || |
2151 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || | 2143 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || |
2152 #if SK_SUPPORT_GPU | 2144 #if SK_SUPPORT_GPU |
2153 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || | 2145 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || |
2154 #endif | 2146 #endif |
2155 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || | 2147 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || |
2156 !parse_flags_resource_path() || | 2148 !parse_flags_resource_path() || |
2157 !parse_flags_match_strs(&matchStrs) || | |
2158 !parse_flags_jpeg_quality() || | 2149 !parse_flags_jpeg_quality() || |
2159 !parse_flags_configs(&configs, grFactory) || | 2150 !parse_flags_configs(&configs, grFactory) || |
2160 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || | 2151 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || |
2161 !parse_flags_gmmain_paths(&gmmain)) { | 2152 !parse_flags_gmmain_paths(&gmmain)) { |
2162 return -1; | 2153 return -1; |
2163 } | 2154 } |
2164 | 2155 |
2165 if (FLAGS_verbose) { | 2156 if (FLAGS_verbose) { |
2166 if (FLAGS_writePath.count() == 1) { | 2157 if (FLAGS_writePath.count() == 1) { |
2167 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]); | 2158 gm_fprintf(stdout, "writing to %s\n", FLAGS_writePath[0]); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 ++gmIndex; | 2203 ++gmIndex; |
2213 if (moduloRemainder >= 0) { | 2204 if (moduloRemainder >= 0) { |
2214 if ((gmIndex % moduloDivisor) != moduloRemainder) { | 2205 if ((gmIndex % moduloDivisor) != moduloRemainder) { |
2215 continue; | 2206 continue; |
2216 } | 2207 } |
2217 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); | 2208 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); |
2218 } | 2209 } |
2219 | 2210 |
2220 const char* shortName = gm->shortName(); | 2211 const char* shortName = gm->shortName(); |
2221 | 2212 |
2222 if (SkCommandLineFlags::ShouldSkip(matchStrs, shortName)) { | 2213 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { |
2223 continue; | 2214 continue; |
2224 } | 2215 } |
2225 | 2216 |
2226 gmsRun++; | 2217 gmsRun++; |
2227 SkISize size = gm->getISize(); | 2218 SkISize size = gm->getISize(); |
2228 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, | 2219 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, |
2229 size.width(), size.height()); | 2220 size.width(), size.height()); |
2230 | 2221 |
2231 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, grFactory); | 2222 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, grFactory); |
2232 | 2223 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 if (FLAGS_forceBWtext) { | 2296 if (FLAGS_forceBWtext) { |
2306 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2297 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2307 } | 2298 } |
2308 } | 2299 } |
2309 | 2300 |
2310 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2301 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2311 int main(int argc, char * const argv[]) { | 2302 int main(int argc, char * const argv[]) { |
2312 return tool_main(argc, (char**) argv); | 2303 return tool_main(argc, (char**) argv); |
2313 } | 2304 } |
2314 #endif | 2305 #endif |
OLD | NEW |