| 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 if (fMismatchPath) { | 842 if (fMismatchPath) { |
| 843 SkString path = make_bitmap_filename(fMismatchPath, shortName, c
onfigName, | 843 SkString path = make_bitmap_filename(fMismatchPath, shortName, c
onfigName, |
| 844 renderModeDescriptor, | 844 renderModeDescriptor, |
| 845 actualBitmapAndDigest.fDige
st); | 845 actualBitmapAndDigest.fDige
st); |
| 846 write_bitmap(path, actualBitmapAndDigest.fBitmap); | 846 write_bitmap(path, actualBitmapAndDigest.fBitmap); |
| 847 } | 847 } |
| 848 | 848 |
| 849 // If we have access to a single expected bitmap, log more | 849 // If we have access to a single expected bitmap, log more |
| 850 // detail about the mismatch. | 850 // detail about the mismatch. |
| 851 const SkBitmap *expectedBitmapPtr = expectations.asBitmap(); | 851 const SkBitmap *expectedBitmapPtr = expectations.asBitmap(); |
| 852 if (NULL != expectedBitmapPtr) { | 852 if (expectedBitmapPtr) { |
| 853 report_bitmap_diffs(*expectedBitmapPtr, actualBitmapAndDigest.fB
itmap, | 853 report_bitmap_diffs(*expectedBitmapPtr, actualBitmapAndDigest.fB
itmap, |
| 854 completeName); | 854 completeName); |
| 855 } | 855 } |
| 856 } | 856 } |
| 857 | 857 |
| 858 if (addToJsonSummary) { | 858 if (addToJsonSummary) { |
| 859 add_actual_results_to_json_summary(completeName, actualBitmapAndDige
st.fDigest, errors, | 859 add_actual_results_to_json_summary(completeName, actualBitmapAndDige
st.fDigest, errors, |
| 860 expectations.ignoreFailure()); | 860 expectations.ignoreFailure()); |
| 861 add_expected_results_to_json_summary(completeName, expectations); | 861 add_expected_results_to_json_summary(completeName, expectations); |
| 862 } | 862 } |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 bool grSuccess = false; | 1755 bool grSuccess = false; |
| 1756 if (gr) { | 1756 if (gr) { |
| 1757 // create a render target to back the device | 1757 // create a render target to back the device |
| 1758 GrTextureDesc desc; | 1758 GrTextureDesc desc; |
| 1759 desc.fConfig = kSkia8888_GrPixelConfig; | 1759 desc.fConfig = kSkia8888_GrPixelConfig; |
| 1760 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 1760 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
| 1761 desc.fWidth = gm->getISize().width(); | 1761 desc.fWidth = gm->getISize().width(); |
| 1762 desc.fHeight = gm->getISize().height(); | 1762 desc.fHeight = gm->getISize().height(); |
| 1763 desc.fSampleCnt = config.fSampleCnt; | 1763 desc.fSampleCnt = config.fSampleCnt; |
| 1764 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); | 1764 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); |
| 1765 if (NULL != auGpuTarget) { | 1765 if (auGpuTarget) { |
| 1766 gpuTarget = auGpuTarget; | 1766 gpuTarget = auGpuTarget; |
| 1767 grSuccess = true; | 1767 grSuccess = true; |
| 1768 // Set the user specified cache limits if non-default. | 1768 // Set the user specified cache limits if non-default. |
| 1769 size_t bytes; | 1769 size_t bytes; |
| 1770 int count; | 1770 int count; |
| 1771 gr->getResourceCacheLimits(&count, &bytes); | 1771 gr->getResourceCacheLimits(&count, &bytes); |
| 1772 if (DEFAULT_CACHE_VALUE != gGpuCacheSizeBytes) { | 1772 if (DEFAULT_CACHE_VALUE != gGpuCacheSizeBytes) { |
| 1773 bytes = static_cast<size_t>(gGpuCacheSizeBytes); | 1773 bytes = static_cast<size_t>(gGpuCacheSizeBytes); |
| 1774 } | 1774 } |
| 1775 if (DEFAULT_CACHE_VALUE != gGpuCacheSizeCount) { | 1775 if (DEFAULT_CACHE_VALUE != gGpuCacheSizeCount) { |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2290 !parse_flags_configs(&configs, grFactory, gpuAPI) || | 2290 !parse_flags_configs(&configs, grFactory, gpuAPI) || |
| 2291 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || | 2291 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || |
| 2292 !parse_flags_gmmain_paths(&gmmain)) { | 2292 !parse_flags_gmmain_paths(&gmmain)) { |
| 2293 return -1; | 2293 return -1; |
| 2294 } | 2294 } |
| 2295 | 2295 |
| 2296 if (FLAGS_verbose) { | 2296 if (FLAGS_verbose) { |
| 2297 if (FLAGS_writePath.count() == 1) { | 2297 if (FLAGS_writePath.count() == 1) { |
| 2298 SkDebugf("writing to %s\n", FLAGS_writePath[0]); | 2298 SkDebugf("writing to %s\n", FLAGS_writePath[0]); |
| 2299 } | 2299 } |
| 2300 if (NULL != gmmain.fMismatchPath) { | 2300 if (gmmain.fMismatchPath) { |
| 2301 SkDebugf("writing mismatches to %s\n", gmmain.fMismatchPath); | 2301 SkDebugf("writing mismatches to %s\n", gmmain.fMismatchPath); |
| 2302 } | 2302 } |
| 2303 if (NULL != gmmain.fMissingExpectationsPath) { | 2303 if (gmmain.fMissingExpectationsPath) { |
| 2304 SkDebugf("writing images without expectations to %s\n", | 2304 SkDebugf("writing images without expectations to %s\n", |
| 2305 gmmain.fMissingExpectationsPath); | 2305 gmmain.fMissingExpectationsPath); |
| 2306 } | 2306 } |
| 2307 if (FLAGS_writePicturePath.count() == 1) { | 2307 if (FLAGS_writePicturePath.count() == 1) { |
| 2308 SkDebugf("writing pictures to %s\n", FLAGS_writePicturePath[0]); | 2308 SkDebugf("writing pictures to %s\n", FLAGS_writePicturePath[0]); |
| 2309 } | 2309 } |
| 2310 if (!GetResourcePath().isEmpty()) { | 2310 if (!GetResourcePath().isEmpty()) { |
| 2311 SkDebugf("reading resources from %s\n", GetResourcePath().c_str()); | 2311 SkDebugf("reading resources from %s\n", GetResourcePath().c_str()); |
| 2312 } | 2312 } |
| 2313 } | 2313 } |
| 2314 | 2314 |
| 2315 int gmsRun = 0; | 2315 int gmsRun = 0; |
| 2316 int gmIndex = -1; | 2316 int gmIndex = -1; |
| 2317 SkString moduloStr; | 2317 SkString moduloStr; |
| 2318 | 2318 |
| 2319 if (!FLAGS_dryRun) { | 2319 if (!FLAGS_dryRun) { |
| 2320 // If we will be writing out files, prepare subdirectories. | 2320 // If we will be writing out files, prepare subdirectories. |
| 2321 if (FLAGS_writePath.count() == 1) { | 2321 if (FLAGS_writePath.count() == 1) { |
| 2322 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHiera
rchy, | 2322 if (!prepare_subdirectories(FLAGS_writePath[0], gmmain.fUseFileHiera
rchy, |
| 2323 configs, pdfRasterizers)) { | 2323 configs, pdfRasterizers)) { |
| 2324 return -1; | 2324 return -1; |
| 2325 } | 2325 } |
| 2326 } | 2326 } |
| 2327 if (NULL != gmmain.fMismatchPath) { | 2327 if (gmmain.fMismatchPath) { |
| 2328 if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHie
rarchy, | 2328 if (!prepare_subdirectories(gmmain.fMismatchPath, gmmain.fUseFileHie
rarchy, |
| 2329 configs, pdfRasterizers)) { | 2329 configs, pdfRasterizers)) { |
| 2330 return -1; | 2330 return -1; |
| 2331 } | 2331 } |
| 2332 } | 2332 } |
| 2333 if (NULL != gmmain.fMissingExpectationsPath) { | 2333 if (gmmain.fMissingExpectationsPath) { |
| 2334 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.
fUseFileHierarchy, | 2334 if (!prepare_subdirectories(gmmain.fMissingExpectationsPath, gmmain.
fUseFileHierarchy, |
| 2335 configs, pdfRasterizers)) { | 2335 configs, pdfRasterizers)) { |
| 2336 return -1; | 2336 return -1; |
| 2337 } | 2337 } |
| 2338 } | 2338 } |
| 2339 } | 2339 } |
| 2340 Iter iter; | 2340 Iter iter; |
| 2341 GM* gm; | 2341 GM* gm; |
| 2342 while ((gm = iter.next()) != NULL) { | 2342 while ((gm = iter.next()) != NULL) { |
| 2343 if (FLAGS_forcePerspectiveMatrix) { | 2343 if (FLAGS_forcePerspectiveMatrix) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 if (FLAGS_forceBWtext) { | 2479 if (FLAGS_forceBWtext) { |
| 2480 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2480 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2481 } | 2481 } |
| 2482 } | 2482 } |
| 2483 | 2483 |
| 2484 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2484 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2485 int main(int argc, char * const argv[]) { | 2485 int main(int argc, char * const argv[]) { |
| 2486 return tool_main(argc, (char**) argv); | 2486 return tool_main(argc, (char**) argv); |
| 2487 } | 2487 } |
| 2488 #endif | 2488 #endif |
| OLD | NEW |