Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "LazyDecodeBitmap.h" | 8 #include "LazyDecodeBitmap.h" |
| 9 #include "CopyTilesRenderer.h" | 9 #include "CopyTilesRenderer.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| 11 #include "SkDevice.h" | 11 #include "SkDevice.h" |
| 12 #include "SkCommandLineFlags.h" | 12 #include "SkCommandLineFlags.h" |
| 13 #include "SkGraphics.h" | 13 #include "SkGraphics.h" |
| 14 #include "SkImageDecoder.h" | 14 #include "SkImageDecoder.h" |
| 15 #include "SkImageEncoder.h" | 15 #include "SkImageEncoder.h" |
| 16 #include "SkMath.h" | 16 #include "SkMath.h" |
| 17 #include "SkOSFile.h" | 17 #include "SkOSFile.h" |
| 18 #include "SkPicture.h" | 18 #include "SkPicture.h" |
| 19 #include "SkPictureRecorder.h" | 19 #include "SkPictureRecorder.h" |
| 20 #include "SkStream.h" | 20 #include "SkStream.h" |
| 21 #include "SkString.h" | 21 #include "SkString.h" |
| 22 | 22 |
| 23 #include "image_expectations.h" | 23 #include "image_expectations.h" |
| 24 #include "PictureRenderer.h" | 24 #include "PictureRenderer.h" |
| 25 #include "PictureRenderingFlags.h" | 25 #include "PictureRenderingFlags.h" |
| 26 #include "picture_utils.h" | 26 #include "picture_utils.h" |
| 27 | 27 |
| 28 // Flags used by this file, alphabetically: | 28 // Flags used by this file, alphabetically: |
| 29 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi ng the picture."); | |
|
epoger
2014/08/14 06:18:01
reordered these to be alphabetical
| |
| 29 DECLARE_bool(deferImageDecoding); | 30 DECLARE_bool(deferImageDecoding); |
| 31 DEFINE_string(descriptions, "", "one or more key=value pairs to add to the descr iptions section " | |
| 32 "of the JSON summary."); | |
| 30 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo nents that differ " | 33 DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo nents that differ " |
| 31 "by more than this amount are considered errors, though all diffs a re reported. " | 34 "by more than this amount are considered errors, though all diffs a re reported. " |
| 32 "Requires --validate."); | 35 "Requires --validate."); |
| 33 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " | 36 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " |
| 34 "pixel mismatches into this directory."); | 37 "pixel mismatches into this directory."); |
| 38 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b efore rendering."); | |
| 35 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro m."); | 39 DEFINE_string(readJsonSummaryPath, "", "JSON file to read image expectations fro m."); |
| 36 DECLARE_string(readPath); | 40 DECLARE_string(readPath); |
| 37 DEFINE_bool(writeChecksumBasedFilenames, false, | 41 DEFINE_bool(writeChecksumBasedFilenames, false, |
| 38 "When writing out images, use checksum-based filenames."); | 42 "When writing out images, use checksum-based filenames."); |
| 39 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima ge, write it to a " | 43 DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded ima ge, write it to a " |
| 40 "file rather than decoding it. Requires writePath to be set. Skips d rawing the full " | 44 "file rather than decoding it. Requires writePath to be set. Skips d rawing the full " |
| 41 "skp to a file. Not compatible with deferImageDecoding."); | 45 "skp to a file. Not compatible with deferImageDecoding."); |
| 42 DEFINE_string(writeJsonSummaryPath, "", "File to write a JSON summary of image r esults to."); | 46 DEFINE_string(writeJsonSummaryPath, "", "File to write a JSON summary of image r esults to."); |
| 43 DEFINE_string2(writePath, w, "", "Directory to write the rendered images into.") ; | 47 DEFINE_string2(writePath, w, "", "Directory to write the rendered images into.") ; |
| 44 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima ge to a " | 48 DEFINE_bool(writeWholeImage, false, "In tile mode, write the entire rendered ima ge to a " |
| 45 "file, instead of an image for each tile."); | 49 "file, instead of an image for each tile."); |
| 46 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p ixels as " | 50 DEFINE_bool(validate, false, "Verify that the rendered image contains the same p ixels as " |
| 47 "the picture rendered in simple mode. When used in conjunction with --bbh, results " | 51 "the picture rendered in simple mode. When used in conjunction with --bbh, results " |
| 48 "are validated against the picture rendered in the same mode, but wi thout the bbh."); | 52 "are validated against the picture rendered in the same mode, but wi thout the bbh."); |
| 49 | 53 |
| 50 DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi ng the picture."); | |
| 51 | |
| 52 DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing b efore rendering."); | |
| 53 | |
| 54 //////////////////////////////////////////////////////////////////////////////// //////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// //////////////////// |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Table for translating from format of data to a suffix. | 57 * Table for translating from format of data to a suffix. |
| 58 */ | 58 */ |
| 59 struct Format { | 59 struct Format { |
| 60 SkImageDecoder::Format fFormat; | 60 SkImageDecoder::Format fFormat; |
| 61 const char* fSuffix; | 61 const char* fSuffix; |
| 62 }; | 62 }; |
| 63 static const Format gFormats[] = { | 63 static const Format gFormats[] = { |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 if (renderer->isUsingGpuDevice()) { | 479 if (renderer->isUsingGpuDevice()) { |
| 480 GrContext* ctx = renderer->getGrContext(); | 480 GrContext* ctx = renderer->getGrContext(); |
| 481 ctx->printCacheStats(); | 481 ctx->printCacheStats(); |
| 482 #ifdef SK_DEVELOPER | 482 #ifdef SK_DEVELOPER |
| 483 ctx->dumpFontCache(); | 483 ctx->dumpFontCache(); |
| 484 #endif | 484 #endif |
| 485 } | 485 } |
| 486 #endif | 486 #endif |
| 487 #endif | 487 #endif |
| 488 if (FLAGS_writeJsonSummaryPath.count() == 1) { | 488 if (FLAGS_writeJsonSummaryPath.count() == 1) { |
| 489 // If there were any descriptions on the command line, insert them now. | |
| 490 for (int i=0; i<FLAGS_descriptions.count(); i++) { | |
| 491 SkTArray<SkString> tokens; | |
| 492 SkStrSplit(FLAGS_descriptions[i], "=", &tokens); | |
| 493 SkASSERT(tokens.count() == 2); | |
| 494 jsonSummary.addDescription(tokens[0].c_str(), tokens[1].c_str()); | |
| 495 } | |
| 489 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); | 496 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); |
| 490 } | 497 } |
| 491 return 0; | 498 return 0; |
| 492 } | 499 } |
| 493 | 500 |
| 494 #if !defined SK_BUILD_FOR_IOS | 501 #if !defined SK_BUILD_FOR_IOS |
| 495 int main(int argc, char * const argv[]) { | 502 int main(int argc, char * const argv[]) { |
| 496 return tool_main(argc, (char**) argv); | 503 return tool_main(argc, (char**) argv); |
| 497 } | 504 } |
| 498 #endif | 505 #endif |
| OLD | NEW |