Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: gm/gmmain.cpp

Issue 17365002: GM: add --writeChecksumBasedFilenames option (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: complete Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 }; 181 };
182 182
183 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect); 183 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect);
184 184
185 const static ErrorCombination kDefaultIgnorableErrorTypes = ErrorCombination() 185 const static ErrorCombination kDefaultIgnorableErrorTypes = ErrorCombination()
186 .plus(kMissingExpectations_ErrorType) 186 .plus(kMissingExpectations_ErrorType)
187 .plus(kIntentionallySkipped_ErrorType); 187 .plus(kIntentionallySkipped_ErrorType);
188 188
189 class GMMain { 189 class GMMain {
190 public: 190 public:
191 GMMain() : fUseFileHierarchy(false), fIgnorableErrorTypes(kDefaultIgnorableE rrorTypes), 191 GMMain() : fUseFileHierarchy(false), fWriteChecksumBasedFilenames(false),
192 fIgnorableErrorTypes(kDefaultIgnorableErrorTypes),
192 fMismatchPath(NULL), fTestsRun(0), fRenderModesEncountered(1) {} 193 fMismatchPath(NULL), fTestsRun(0), fRenderModesEncountered(1) {}
193 194
194 /** 195 /**
195 * Assemble shortNamePlusConfig from (surprise!) shortName and configName. 196 * Assemble shortNamePlusConfig from (surprise!) shortName and configName.
196 * 197 *
197 * The method for doing so depends on whether we are using hierarchical nami ng. 198 * The method for doing so depends on whether we are using hierarchical nami ng.
198 * For example, shortName "selftest1" and configName "8888" could be assembl ed into 199 * For example, shortName "selftest1" and configName "8888" could be assembl ed into
199 * either "selftest1_8888" or "8888/selftest1". 200 * either "selftest1_8888" or "8888/selftest1".
200 */ 201 */
201 SkString make_shortname_plus_config(const char *shortName, const char *confi gName) { 202 SkString make_shortname_plus_config(const char *shortName, const char *confi gName) {
(...skipping 16 matching lines...) Expand all
218 const char *configName, 219 const char *configName,
219 const char *renderModeDescriptor, 220 const char *renderModeDescriptor,
220 const char *suffix) { 221 const char *suffix) {
221 SkString filename = make_shortname_plus_config(shortName, configName); 222 SkString filename = make_shortname_plus_config(shortName, configName);
222 filename.append(renderModeDescriptor); 223 filename.append(renderModeDescriptor);
223 filename.appendUnichar('.'); 224 filename.appendUnichar('.');
224 filename.append(suffix); 225 filename.append(suffix);
225 return SkOSPath::SkPathJoin(path, filename.c_str()); 226 return SkOSPath::SkPathJoin(path, filename.c_str());
226 } 227 }
227 228
229 /**
230 * Assemble filename suitable for writing out an SkBitmap.
231 */
232 SkString make_bitmap_filename(const char *path,
233 const char *shortName,
234 const char *configName,
235 const char *renderModeDescriptor,
236 const GmResultDigest &bitmapDigest) {
237 if (fWriteChecksumBasedFilenames) {
238 SkString filename;
239 filename.append(bitmapDigest.getHashType());
240 filename.appendUnichar('_');
epoger 2013/06/18 07:21:03 In patchset 4, I decided that it will be easier ac
241 filename.append(shortName);
242 filename.appendUnichar('_');
243 filename.append(bitmapDigest.getDigestValue());
244 filename.appendUnichar('.');
245 filename.append(kPNG_FileExtension);
246 return SkOSPath::SkPathJoin(path, filename.c_str());
247 } else {
248 return make_filename(path, shortName, configName, renderModeDescript or,
249 kPNG_FileExtension);
250 }
251 }
252
228 /* since PNG insists on unpremultiplying our alpha, we take no 253 /* since PNG insists on unpremultiplying our alpha, we take no
229 precision chances and force all pixels to be 100% opaque, 254 precision chances and force all pixels to be 100% opaque,
230 otherwise on compare we may not get a perfect match. 255 otherwise on compare we may not get a perfect match.
231 */ 256 */
232 static void force_all_opaque(const SkBitmap& bitmap) { 257 static void force_all_opaque(const SkBitmap& bitmap) {
233 SkBitmap::Config config = bitmap.config(); 258 SkBitmap::Config config = bitmap.config();
234 switch (config) { 259 switch (config) {
235 case SkBitmap::kARGB_8888_Config: 260 case SkBitmap::kARGB_8888_Config:
236 force_all_opaque_8888(bitmap); 261 force_all_opaque_8888(bitmap);
237 break; 262 break;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 invokeGM(gm, &c, false, false); 653 invokeGM(gm, &c, false, false);
629 dev->endSheet(); 654 dev->endSheet();
630 dev->endPortfolio(); 655 dev->endPortfolio();
631 656
632 #endif 657 #endif
633 } 658 }
634 659
635 ErrorCombination write_reference_image(const ConfigData& gRec, const char wr itePath [], 660 ErrorCombination write_reference_image(const ConfigData& gRec, const char wr itePath [],
636 const char renderModeDescriptor [], 661 const char renderModeDescriptor [],
637 const char *shortName, SkBitmap& bitm ap, 662 const char *shortName, SkBitmap& bitm ap,
663 GmResultDigest& bitmapDigest,
638 SkDynamicMemoryWStream* document) { 664 SkDynamicMemoryWStream* document) {
639 SkString path; 665 SkString path;
640 bool success = false; 666 bool success = false;
641 if (gRec.fBackend == kRaster_Backend || 667 if (gRec.fBackend == kRaster_Backend ||
642 gRec.fBackend == kGPU_Backend || 668 gRec.fBackend == kGPU_Backend ||
643 (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) { 669 (gRec.fBackend == kPDF_Backend && CAN_IMAGE_PDF)) {
644 670
645 path = make_filename(writePath, shortName, gRec.fName, renderModeDes criptor, 671 path = make_bitmap_filename(writePath, shortName, gRec.fName, render ModeDescriptor,
646 kPNG_FileExtension); 672 bitmapDigest);
647 success = write_bitmap(path, bitmap); 673 success = write_bitmap(path, bitmap);
648 } 674 }
649 if (kPDF_Backend == gRec.fBackend) { 675 if (kPDF_Backend == gRec.fBackend) {
650 path = make_filename(writePath, shortName, gRec.fName, renderModeDes criptor, 676 path = make_filename(writePath, shortName, gRec.fName, renderModeDes criptor,
651 "pdf"); 677 "pdf");
652 success = write_document(path, *document); 678 success = write_document(path, *document);
653 } 679 }
654 if (kXPS_Backend == gRec.fBackend) { 680 if (kXPS_Backend == gRec.fBackend) {
655 path = make_filename(writePath, shortName, gRec.fName, renderModeDes criptor, 681 path = make_filename(writePath, shortName, gRec.fName, renderModeDes criptor,
656 "xps"); 682 "xps");
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 760
735 /** 761 /**
736 * Compares actual hash digest to expectations, returning the set of errors 762 * Compares actual hash digest to expectations, returning the set of errors
737 * (if any) that we saw along the way. 763 * (if any) that we saw along the way.
738 * 764 *
739 * If fMismatchPath has been set, and there are pixel diffs, then the 765 * If fMismatchPath has been set, and there are pixel diffs, then the
740 * actual bitmap will be written out to a file within fMismatchPath. 766 * actual bitmap will be written out to a file within fMismatchPath.
741 * 767 *
742 * @param expectations what expectations to compare actualBitmap against 768 * @param expectations what expectations to compare actualBitmap against
743 * @param actualBitmap the image we actually generated 769 * @param actualBitmap the image we actually generated
770 * @param actualResultDigest GmResultDigest of actualBitmap
744 * @param shortName name of test, e.g. "selftest1" 771 * @param shortName name of test, e.g. "selftest1"
745 * @param configName name of config, e.g. "8888" 772 * @param configName name of config, e.g. "8888"
746 * @param renderModeDescriptor e.g., "-rtree", "-deferred" 773 * @param renderModeDescriptor e.g., "-rtree", "-deferred"
747 * @param addToJsonSummary whether to add these results (both actual and 774 * @param addToJsonSummary whether to add these results (both actual and
748 * expected) to the JSON summary. Regardless of this setting, if 775 * expected) to the JSON summary. Regardless of this setting, if
749 * we find an image mismatch in this test, we will write these 776 * we find an image mismatch in this test, we will write these
750 * results to the JSON summary. (This is so that we will always 777 * results to the JSON summary. (This is so that we will always
751 * report errors across rendering modes, such as pipe vs tiled. 778 * report errors across rendering modes, such as pipe vs tiled.
752 * See https://codereview.chromium.org/13650002/ ) 779 * See https://codereview.chromium.org/13650002/ )
753 */ 780 */
754 ErrorCombination compare_to_expectations(Expectations expectations, 781 ErrorCombination compare_to_expectations(Expectations expectations,
755 const SkBitmap& actualBitmap, 782 const SkBitmap& actualBitmap,
783 const GmResultDigest& actualResultD igest,
scroggo 2013/06/19 14:55:46 I ran into this earlier when I was modifying skima
epoger 2013/06/19 15:02:16 As discussed live... I will change the code to jus
epoger 2013/06/19 15:44:08 Heck, it's just as easy to write it now.
756 const char *shortName, const char * configName, 784 const char *shortName, const char * configName,
757 const char *renderModeDescriptor, 785 const char *renderModeDescriptor,
758 bool addToJsonSummary) { 786 bool addToJsonSummary) {
759 ErrorCombination errors; 787 ErrorCombination errors;
760 GmResultDigest actualResultDigest(actualBitmap);
761 SkString shortNamePlusConfig = make_shortname_plus_config(shortName, con figName); 788 SkString shortNamePlusConfig = make_shortname_plus_config(shortName, con figName);
762 SkString completeNameString(shortNamePlusConfig); 789 SkString completeNameString(shortNamePlusConfig);
763 completeNameString.append(renderModeDescriptor); 790 completeNameString.append(renderModeDescriptor);
764 completeNameString.append("."); 791 completeNameString.append(".");
765 completeNameString.append(kPNG_FileExtension); 792 completeNameString.append(kPNG_FileExtension);
766 const char* completeName = completeNameString.c_str(); 793 const char* completeName = completeNameString.c_str();
767 794
768 if (expectations.empty()) { 795 if (expectations.empty()) {
769 errors.add(kMissingExpectations_ErrorType); 796 errors.add(kMissingExpectations_ErrorType);
770 } else if (!expectations.match(actualResultDigest)) { 797 } else if (!expectations.match(actualResultDigest)) {
771 addToJsonSummary = true; 798 addToJsonSummary = true;
772 // The error mode we record depends on whether this was running 799 // The error mode we record depends on whether this was running
773 // in a non-standard renderMode. 800 // in a non-standard renderMode.
774 if ('\0' == *renderModeDescriptor) { 801 if ('\0' == *renderModeDescriptor) {
775 errors.add(kExpectationsMismatch_ErrorType); 802 errors.add(kExpectationsMismatch_ErrorType);
776 } else { 803 } else {
777 errors.add(kRenderModeMismatch_ErrorType); 804 errors.add(kRenderModeMismatch_ErrorType);
778 } 805 }
779 806
780 // Write out the "actuals" for any mismatches, if we have 807 // Write out the "actuals" for any mismatches, if we have
781 // been directed to do so. 808 // been directed to do so.
782 if (fMismatchPath) { 809 if (fMismatchPath) {
783 SkString path = 810 SkString path = make_bitmap_filename(fMismatchPath, shortName, c onfigName,
784 make_filename(fMismatchPath, shortName, configName, renderMo deDescriptor, 811 renderModeDescriptor, actua lResultDigest);
785 kPNG_FileExtension);
786 write_bitmap(path, actualBitmap); 812 write_bitmap(path, actualBitmap);
787 } 813 }
788 814
789 // If we have access to a single expected bitmap, log more 815 // If we have access to a single expected bitmap, log more
790 // detail about the mismatch. 816 // detail about the mismatch.
791 const SkBitmap *expectedBitmapPtr = expectations.asBitmap(); 817 const SkBitmap *expectedBitmapPtr = expectations.asBitmap();
792 if (NULL != expectedBitmapPtr) { 818 if (NULL != expectedBitmapPtr) {
793 report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeNa me); 819 report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeNa me);
794 } 820 }
795 } 821 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 * @param gRec 890 * @param gRec
865 * @param writePath unless this is NULL, write out actual images into this 891 * @param writePath unless this is NULL, write out actual images into this
866 * directory 892 * directory
867 * @param actualBitmap bitmap generated by this run 893 * @param actualBitmap bitmap generated by this run
868 * @param pdf 894 * @param pdf
869 */ 895 */
870 ErrorCombination compare_test_results_to_stored_expectations( 896 ErrorCombination compare_test_results_to_stored_expectations(
871 GM* gm, const ConfigData& gRec, const char writePath[], 897 GM* gm, const ConfigData& gRec, const char writePath[],
872 SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) { 898 SkBitmap& actualBitmap, SkDynamicMemoryWStream* pdf) {
873 899
900 GmResultDigest actualResultDigest(actualBitmap);
874 SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName( ), gRec.fName); 901 SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName( ), gRec.fName);
875 SkString nameWithExtension(shortNamePlusConfig); 902 SkString nameWithExtension(shortNamePlusConfig);
876 nameWithExtension.append("."); 903 nameWithExtension.append(".");
877 nameWithExtension.append(kPNG_FileExtension); 904 nameWithExtension.append(kPNG_FileExtension);
878 905
879 ErrorCombination errors; 906 ErrorCombination errors;
880 ExpectationsSource *expectationsSource = this->fExpectationsSource.get() ; 907 ExpectationsSource *expectationsSource = this->fExpectationsSource.get() ;
881 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) { 908 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) {
882 /* 909 /*
883 * Get the expected results for this test, as one or more allowed 910 * Get the expected results for this test, as one or more allowed
884 * hash digests. The current implementation of expectationsSource 911 * hash digests. The current implementation of expectationsSource
885 * get this by computing the hash digest of a single PNG file on dis k. 912 * get this by computing the hash digest of a single PNG file on dis k.
886 * 913 *
887 * TODO(epoger): This relies on the fact that 914 * TODO(epoger): This relies on the fact that
888 * force_all_opaque() was called on the bitmap before it 915 * force_all_opaque() was called on the bitmap before it
889 * was written to disk as a PNG in the first place. If 916 * was written to disk as a PNG in the first place. If
890 * not, the hash digest returned here may not match the 917 * not, the hash digest returned here may not match the
891 * hash digest of actualBitmap, which *has* been run through 918 * hash digest of actualBitmap, which *has* been run through
892 * force_all_opaque(). 919 * force_all_opaque().
893 * See comments above complete_bitmap() for more detail. 920 * See comments above complete_bitmap() for more detail.
894 */ 921 */
895 Expectations expectations = expectationsSource->get(nameWithExtensio n.c_str()); 922 Expectations expectations = expectationsSource->get(nameWithExtensio n.c_str());
896 errors.add(compare_to_expectations(expectations, actualBitmap, 923 errors.add(compare_to_expectations(expectations, actualBitmap, actua lResultDigest,
897 gm->shortName(), gRec.fName, "", true)); 924 gm->shortName(), gRec.fName, "", true));
898 } else { 925 } else {
899 // If we are running without expectations, we still want to 926 // If we are running without expectations, we still want to
900 // record the actual results. 927 // record the actual results.
901 GmResultDigest actualResultDigest(actualBitmap);
902 add_actual_results_to_json_summary(nameWithExtension.c_str(), actual ResultDigest, 928 add_actual_results_to_json_summary(nameWithExtension.c_str(), actual ResultDigest,
903 ErrorCombination(kMissingExpectat ions_ErrorType), 929 ErrorCombination(kMissingExpectat ions_ErrorType),
904 false); 930 false);
905 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType), 931 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType),
906 shortNamePlusConfig, ""); 932 shortNamePlusConfig, "");
907 } 933 }
908 934
909 // TODO: Consider moving this into compare_to_expectations(), 935 // TODO: Consider moving this into compare_to_expectations(),
910 // similar to fMismatchPath... for now, we don't do that, because 936 // similar to fMismatchPath... for now, we don't do that, because
911 // we don't want to write out the actual bitmaps for all 937 // we don't want to write out the actual bitmaps for all
912 // renderModes of all tests! That would be a lot of files. 938 // renderModes of all tests! That would be a lot of files.
913 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { 939 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
914 errors.add(write_reference_image(gRec, writePath, "", gm->shortName( ), 940 errors.add(write_reference_image(gRec, writePath, "", gm->shortName( ),
915 actualBitmap, pdf)); 941 actualBitmap, actualResultDigest, p df));
916 } 942 }
917 943
918 return errors; 944 return errors;
919 } 945 }
920 946
921 /** 947 /**
922 * Compare actualBitmap to referenceBitmap. 948 * Compare actualBitmap to referenceBitmap.
923 * 949 *
924 * @param shortName test name, e.g. "selftest1" 950 * @param shortName test name, e.g. "selftest1"
925 * @param configName configuration name, e.g. "8888" 951 * @param configName configuration name, e.g. "8888"
926 * @param renderModeDescriptor 952 * @param renderModeDescriptor
927 * @param actualBitmap actual bitmap generated by this run 953 * @param actualBitmap actual bitmap generated by this run
928 * @param referenceBitmap bitmap we expected to be generated 954 * @param referenceBitmap bitmap we expected to be generated
929 */ 955 */
930 ErrorCombination compare_test_results_to_reference_bitmap( 956 ErrorCombination compare_test_results_to_reference_bitmap(
931 const char *shortName, const char *configName, const char *renderModeDes criptor, 957 const char *shortName, const char *configName, const char *renderModeDes criptor,
932 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) { 958 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) {
933 959
934 SkASSERT(referenceBitmap); 960 SkASSERT(referenceBitmap);
935 Expectations expectations(*referenceBitmap); 961 Expectations expectations(*referenceBitmap);
936 return compare_to_expectations(expectations, actualBitmap, shortName, 962 GmResultDigest actualResultDigest(actualBitmap);
963 return compare_to_expectations(expectations, actualBitmap, actualResultD igest, shortName,
937 configName, renderModeDescriptor, false); 964 configName, renderModeDescriptor, false);
938 } 965 }
939 966
940 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags, 967 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags,
941 SkScalar scale = SK_Scalar1) { 968 SkScalar scale = SK_Scalar1) {
942 // Pictures are refcounted so must be on heap 969 // Pictures are refcounted so must be on heap
943 SkPicture* pict; 970 SkPicture* pict;
944 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale)); 971 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale));
945 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale)); 972 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale));
946 973
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1163 }
1137 } 1164 }
1138 return errors; 1165 return errors;
1139 } 1166 }
1140 1167
1141 // 1168 //
1142 // member variables. 1169 // member variables.
1143 // They are public for now, to allow easier setting by tool_main(). 1170 // They are public for now, to allow easier setting by tool_main().
1144 // 1171 //
1145 1172
1146 bool fUseFileHierarchy; 1173 bool fUseFileHierarchy, fWriteChecksumBasedFilenames;
1147 ErrorCombination fIgnorableErrorTypes; 1174 ErrorCombination fIgnorableErrorTypes;
1148 1175
1149 const char* fMismatchPath; 1176 const char* fMismatchPath;
1150 1177
1151 // collection of tests that have failed with each ErrorType 1178 // collection of tests that have failed with each ErrorType
1152 SkTArray<SkString> fFailedTests[kLast_ErrorType+1]; 1179 SkTArray<SkString> fFailedTests[kLast_ErrorType+1];
1153 int fTestsRun; 1180 int fTestsRun;
1154 SkTDict<int> fRenderModesEncountered; 1181 SkTDict<int> fRenderModesEncountered;
1155 1182
1156 // Where to read expectations (expected image hash digests, etc.) from. 1183 // Where to read expectations (expected image hash digests, etc.) from.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 "any differences between those and the newly generated ones."); 1323 "any differences between those and the newly generated ones.");
1297 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass."); 1324 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass.");
1298 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources."); 1325 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources.");
1299 DEFINE_bool(rtree, true, "Exercise the R-Tree variant of SkPicture test pass."); 1326 DEFINE_bool(rtree, true, "Exercise the R-Tree variant of SkPicture test pass.");
1300 DEFINE_bool(serialize, true, "Exercise the SkPicture serialization & deserializa tion test pass."); 1327 DEFINE_bool(serialize, true, "Exercise the SkPicture serialization & deserializa tion test pass.");
1301 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only."); 1328 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only.");
1302 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay."); 1329 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay.");
1303 DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture."); 1330 DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture.");
1304 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale " 1331 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale "
1305 "factors to be used for tileGrid playback testing. Default value: 1.0"); 1332 "factors to be used for tileGrid playback testing. Default value: 1.0");
1306 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file.");
1307 DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i nfo about " 1333 DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i nfo about "
1308 "each test)."); 1334 "each test).");
1335 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
1336 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage");
1337 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file.");
1309 DEFINE_string2(writePath, w, "", "Write rendered images into this directory."); 1338 DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
1310 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ; 1339 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ;
1311 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " 1340 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, "
1312 "which can be in range 0-100). N = -1 will disable JPEG compression . " 1341 "which can be in range 0-100). N = -1 will disable JPEG compression . "
1313 "Default is N = 100, maximum quality."); 1342 "Default is N = 100, maximum quality.");
1314 1343
1315 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect) { 1344 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect) {
1316 // Filter output of warnings that JPEG is not available for the image. 1345 // Filter output of warnings that JPEG is not available for the image.
1317 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false; 1346 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false;
1318 if (FLAGS_pdfJpegQuality == -1) return false; 1347 if (FLAGS_pdfJpegQuality == -1) return false;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 SkTDArray<size_t> configs; 1784 SkTDArray<size_t> configs;
1756 SkTDArray<size_t> excludeConfigs; 1785 SkTDArray<size_t> excludeConfigs;
1757 bool userConfig = false; 1786 bool userConfig = false;
1758 1787
1759 SkString usage; 1788 SkString usage;
1760 usage.printf("Run the golden master tests.\n"); 1789 usage.printf("Run the golden master tests.\n");
1761 SkCommandLineFlags::SetUsage(usage.c_str()); 1790 SkCommandLineFlags::SetUsage(usage.c_str());
1762 SkCommandLineFlags::Parse(argc, argv); 1791 SkCommandLineFlags::Parse(argc, argv);
1763 1792
1764 gmmain.fUseFileHierarchy = FLAGS_hierarchy; 1793 gmmain.fUseFileHierarchy = FLAGS_hierarchy;
1794 gmmain.fWriteChecksumBasedFilenames = FLAGS_writeChecksumBasedFilenames;
1765 if (FLAGS_mismatchPath.count() == 1) { 1795 if (FLAGS_mismatchPath.count() == 1) {
1766 gmmain.fMismatchPath = FLAGS_mismatchPath[0]; 1796 gmmain.fMismatchPath = FLAGS_mismatchPath[0];
1767 } 1797 }
1768 1798
1769 for (int i = 0; i < FLAGS_config.count(); i++) { 1799 for (int i = 0; i < FLAGS_config.count(); i++) {
1770 const char* config = FLAGS_config[i]; 1800 const char* config = FLAGS_config[i];
1771 userConfig = true; 1801 userConfig = true;
1772 bool exclude = false; 1802 bool exclude = false;
1773 if (*config == kExcludeConfigChar) { 1803 if (*config == kExcludeConfigChar) {
1774 exclude = true; 1804 exclude = true;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 if (FLAGS_forceBWtext) { 2116 if (FLAGS_forceBWtext) {
2087 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2117 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2088 } 2118 }
2089 } 2119 }
2090 2120
2091 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2121 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2092 int main(int argc, char * const argv[]) { 2122 int main(int argc, char * const argv[]) {
2093 return tool_main(argc, (char**) argv); 2123 return tool_main(argc, (char**) argv);
2094 } 2124 }
2095 #endif 2125 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698