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

Side by Side Diff: gm/gmmain.cpp

Issue 17365002: GM: add --writeChecksumBasedFilenames option (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: add_BitmapAndDigest 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('_');
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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 dev->beginSheet(unitsPerMeter, pixelsPerMeter, trimSize); 652 dev->beginSheet(unitsPerMeter, pixelsPerMeter, trimSize);
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,
663 const BitmapAndDigest& bitmapAndDiges t,
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 bitmapAndDigest.fDigest);
647 success = write_bitmap(path, bitmap); 673 success = write_bitmap(path, bitmapAndDigest.fBitmap);
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");
657 success = write_document(path, *document); 683 success = write_document(path, *document);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 } 759 }
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 actualBitmapAndDigest the SkBitmap we actually generated, and its GmResultDigest
744 * @param shortName name of test, e.g. "selftest1" 770 * @param shortName name of test, e.g. "selftest1"
745 * @param configName name of config, e.g. "8888" 771 * @param configName name of config, e.g. "8888"
746 * @param renderModeDescriptor e.g., "-rtree", "-deferred" 772 * @param renderModeDescriptor e.g., "-rtree", "-deferred"
747 * @param addToJsonSummary whether to add these results (both actual and 773 * @param addToJsonSummary whether to add these results (both actual and
748 * expected) to the JSON summary. Regardless of this setting, if 774 * expected) to the JSON summary. Regardless of this setting, if
749 * we find an image mismatch in this test, we will write these 775 * 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 776 * results to the JSON summary. (This is so that we will always
751 * report errors across rendering modes, such as pipe vs tiled. 777 * report errors across rendering modes, such as pipe vs tiled.
752 * See https://codereview.chromium.org/13650002/ ) 778 * See https://codereview.chromium.org/13650002/ )
753 */ 779 */
754 ErrorCombination compare_to_expectations(Expectations expectations, 780 ErrorCombination compare_to_expectations(Expectations expectations,
755 const SkBitmap& actualBitmap, 781 const BitmapAndDigest& actualBitmap AndDigest,
756 const char *shortName, const char * configName, 782 const char *shortName, const char * configName,
757 const char *renderModeDescriptor, 783 const char *renderModeDescriptor,
758 bool addToJsonSummary) { 784 bool addToJsonSummary) {
759 ErrorCombination errors; 785 ErrorCombination errors;
760 GmResultDigest actualResultDigest(actualBitmap);
761 SkString shortNamePlusConfig = make_shortname_plus_config(shortName, con figName); 786 SkString shortNamePlusConfig = make_shortname_plus_config(shortName, con figName);
762 SkString completeNameString(shortNamePlusConfig); 787 SkString completeNameString(shortNamePlusConfig);
763 completeNameString.append(renderModeDescriptor); 788 completeNameString.append(renderModeDescriptor);
764 completeNameString.append("."); 789 completeNameString.append(".");
765 completeNameString.append(kPNG_FileExtension); 790 completeNameString.append(kPNG_FileExtension);
766 const char* completeName = completeNameString.c_str(); 791 const char* completeName = completeNameString.c_str();
767 792
768 if (expectations.empty()) { 793 if (expectations.empty()) {
769 errors.add(kMissingExpectations_ErrorType); 794 errors.add(kMissingExpectations_ErrorType);
770 } else if (!expectations.match(actualResultDigest)) { 795 } else if (!expectations.match(actualBitmapAndDigest.fDigest)) {
771 addToJsonSummary = true; 796 addToJsonSummary = true;
772 // The error mode we record depends on whether this was running 797 // The error mode we record depends on whether this was running
773 // in a non-standard renderMode. 798 // in a non-standard renderMode.
774 if ('\0' == *renderModeDescriptor) { 799 if ('\0' == *renderModeDescriptor) {
775 errors.add(kExpectationsMismatch_ErrorType); 800 errors.add(kExpectationsMismatch_ErrorType);
776 } else { 801 } else {
777 errors.add(kRenderModeMismatch_ErrorType); 802 errors.add(kRenderModeMismatch_ErrorType);
778 } 803 }
779 804
780 // Write out the "actuals" for any mismatches, if we have 805 // Write out the "actuals" for any mismatches, if we have
781 // been directed to do so. 806 // been directed to do so.
782 if (fMismatchPath) { 807 if (fMismatchPath) {
783 SkString path = 808 SkString path = make_bitmap_filename(fMismatchPath, shortName, c onfigName,
784 make_filename(fMismatchPath, shortName, configName, renderMo deDescriptor, 809 renderModeDescriptor,
785 kPNG_FileExtension); 810 actualBitmapAndDigest.fDige st);
786 write_bitmap(path, actualBitmap); 811 write_bitmap(path, actualBitmapAndDigest.fBitmap);
787 } 812 }
788 813
789 // If we have access to a single expected bitmap, log more 814 // If we have access to a single expected bitmap, log more
790 // detail about the mismatch. 815 // detail about the mismatch.
791 const SkBitmap *expectedBitmapPtr = expectations.asBitmap(); 816 const SkBitmap *expectedBitmapPtr = expectations.asBitmap();
792 if (NULL != expectedBitmapPtr) { 817 if (NULL != expectedBitmapPtr) {
793 report_bitmap_diffs(*expectedBitmapPtr, actualBitmap, completeNa me); 818 report_bitmap_diffs(*expectedBitmapPtr, actualBitmapAndDigest.fB itmap,
819 completeName);
794 } 820 }
795 } 821 }
796 RecordTestResults(errors, shortNamePlusConfig, renderModeDescriptor); 822 RecordTestResults(errors, shortNamePlusConfig, renderModeDescriptor);
797 823
798 if (addToJsonSummary) { 824 if (addToJsonSummary) {
799 add_actual_results_to_json_summary(completeName, actualResultDigest, errors, 825 add_actual_results_to_json_summary(completeName, actualBitmapAndDige st.fDigest, errors,
800 expectations.ignoreFailure()); 826 expectations.ignoreFailure());
801 add_expected_results_to_json_summary(completeName, expectations); 827 add_expected_results_to_json_summary(completeName, expectations);
802 } 828 }
803 829
804 return errors; 830 return errors;
805 } 831 }
806 832
807 /** 833 /**
808 * Add this result to the appropriate JSON collection of actual results, 834 * Add this result to the appropriate JSON collection of actual results,
809 * depending on errors encountered. 835 * depending on errors encountered.
(...skipping 54 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 BitmapAndDigest actualBitmapAndDigest(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, actualBitmapAndDige st,
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); 928 add_actual_results_to_json_summary(nameWithExtension.c_str(),
902 add_actual_results_to_json_summary(nameWithExtension.c_str(), actual ResultDigest, 929 actualBitmapAndDigest.fDigest,
903 ErrorCombination(kMissingExpectat ions_ErrorType), 930 ErrorCombination(kMissingExpectat ions_ErrorType),
904 false); 931 false);
905 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType), 932 RecordTestResults(ErrorCombination(kMissingExpectations_ErrorType),
906 shortNamePlusConfig, ""); 933 shortNamePlusConfig, "");
907 } 934 }
908 935
909 // TODO: Consider moving this into compare_to_expectations(), 936 // TODO: Consider moving this into compare_to_expectations(),
910 // similar to fMismatchPath... for now, we don't do that, because 937 // similar to fMismatchPath... for now, we don't do that, because
911 // we don't want to write out the actual bitmaps for all 938 // we don't want to write out the actual bitmaps for all
912 // renderModes of all tests! That would be a lot of files. 939 // renderModes of all tests! That would be a lot of files.
913 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { 940 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) {
914 errors.add(write_reference_image(gRec, writePath, "", gm->shortName( ), 941 errors.add(write_reference_image(gRec, writePath, "", gm->shortName( ),
915 actualBitmap, pdf)); 942 actualBitmapAndDigest, pdf));
916 } 943 }
917 944
918 return errors; 945 return errors;
919 } 946 }
920 947
921 /** 948 /**
922 * Compare actualBitmap to referenceBitmap. 949 * Compare actualBitmap to referenceBitmap.
923 * 950 *
924 * @param shortName test name, e.g. "selftest1" 951 * @param shortName test name, e.g. "selftest1"
925 * @param configName configuration name, e.g. "8888" 952 * @param configName configuration name, e.g. "8888"
926 * @param renderModeDescriptor 953 * @param renderModeDescriptor
927 * @param actualBitmap actual bitmap generated by this run 954 * @param actualBitmap actual bitmap generated by this run
928 * @param referenceBitmap bitmap we expected to be generated 955 * @param referenceBitmap bitmap we expected to be generated
929 */ 956 */
930 ErrorCombination compare_test_results_to_reference_bitmap( 957 ErrorCombination compare_test_results_to_reference_bitmap(
931 const char *shortName, const char *configName, const char *renderModeDes criptor, 958 const char *shortName, const char *configName, const char *renderModeDes criptor,
932 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) { 959 SkBitmap& actualBitmap, const SkBitmap* referenceBitmap) {
933 960
934 SkASSERT(referenceBitmap); 961 SkASSERT(referenceBitmap);
935 Expectations expectations(*referenceBitmap); 962 Expectations expectations(*referenceBitmap);
936 return compare_to_expectations(expectations, actualBitmap, shortName, 963 BitmapAndDigest actualBitmapAndDigest(actualBitmap);
964 return compare_to_expectations(expectations, actualBitmapAndDigest, shor tName,
937 configName, renderModeDescriptor, false); 965 configName, renderModeDescriptor, false);
938 } 966 }
939 967
940 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags, 968 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t rec ordFlags,
941 SkScalar scale = SK_Scalar1) { 969 SkScalar scale = SK_Scalar1) {
942 // Pictures are refcounted so must be on heap 970 // Pictures are refcounted so must be on heap
943 SkPicture* pict; 971 SkPicture* pict;
944 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale)); 972 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale));
945 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale)); 973 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale));
946 974
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } 1164 }
1137 } 1165 }
1138 return errors; 1166 return errors;
1139 } 1167 }
1140 1168
1141 // 1169 //
1142 // member variables. 1170 // member variables.
1143 // They are public for now, to allow easier setting by tool_main(). 1171 // They are public for now, to allow easier setting by tool_main().
1144 // 1172 //
1145 1173
1146 bool fUseFileHierarchy; 1174 bool fUseFileHierarchy, fWriteChecksumBasedFilenames;
1147 ErrorCombination fIgnorableErrorTypes; 1175 ErrorCombination fIgnorableErrorTypes;
1148 1176
1149 const char* fMismatchPath; 1177 const char* fMismatchPath;
1150 1178
1151 // collection of tests that have failed with each ErrorType 1179 // collection of tests that have failed with each ErrorType
1152 SkTArray<SkString> fFailedTests[kLast_ErrorType+1]; 1180 SkTArray<SkString> fFailedTests[kLast_ErrorType+1];
1153 int fTestsRun; 1181 int fTestsRun;
1154 SkTDict<int> fRenderModesEncountered; 1182 SkTDict<int> fRenderModesEncountered;
1155 1183
1156 // Where to read expectations (expected image hash digests, etc.) from. 1184 // 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."); 1324 "any differences between those and the newly generated ones.");
1297 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass."); 1325 DEFINE_bool(replay, true, "Exercise the SkPicture replay test pass.");
1298 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources."); 1326 DEFINE_string2(resourcePath, i, "", "Directory that stores image resources.");
1299 DEFINE_bool(rtree, true, "Exercise the R-Tree variant of SkPicture test pass."); 1327 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."); 1328 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."); 1329 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only.");
1302 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay."); 1330 DEFINE_bool(tiledPipe, false, "Exercise tiled SkGPipe replay.");
1303 DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture."); 1331 DEFINE_bool(tileGrid, true, "Exercise the tile grid variant of SkPicture.");
1304 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale " 1332 DEFINE_string(tileGridReplayScales, "", "Space separated list of floating-point scale "
1305 "factors to be used for tileGrid playback testing. Default value: 1.0"); 1333 "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 " 1334 DEFINE_bool2(verbose, v, false, "Give more detail (e.g. list all GMs run, more i nfo about "
1308 "each test)."); 1335 "each test).");
1336 DEFINE_bool(writeChecksumBasedFilenames, false, "When writing out actual images, use checksum-"
1337 "based filenames, as rebaseline.py will use when downloading them fr om Google Storage");
1338 DEFINE_string(writeJsonSummaryPath, "", "Write a JSON-formatted result summary t o this file.");
1309 DEFINE_string2(writePath, w, "", "Write rendered images into this directory."); 1339 DEFINE_string2(writePath, w, "", "Write rendered images into this directory.");
1310 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ; 1340 DEFINE_string2(writePicturePath, p, "", "Write .skp files into this directory.") ;
1311 DEFINE_int32(pdfJpegQuality, -1, "Encodes images in JPEG at quality level N, " 1341 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 . " 1342 "which can be in range 0-100). N = -1 will disable JPEG compression . "
1313 "Default is N = 100, maximum quality."); 1343 "Default is N = 100, maximum quality.");
1314 1344
1315 static bool encode_to_dct_stream(SkWStream* stream, const SkBitmap& bitmap, cons t SkIRect& rect) { 1345 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. 1346 // Filter output of warnings that JPEG is not available for the image.
1317 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false; 1347 if (bitmap.width() >= 65500 || bitmap.height() >= 65500) return false;
1318 if (FLAGS_pdfJpegQuality == -1) return false; 1348 if (FLAGS_pdfJpegQuality == -1) return false;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 SkTDArray<size_t> configs; 1785 SkTDArray<size_t> configs;
1756 SkTDArray<size_t> excludeConfigs; 1786 SkTDArray<size_t> excludeConfigs;
1757 bool userConfig = false; 1787 bool userConfig = false;
1758 1788
1759 SkString usage; 1789 SkString usage;
1760 usage.printf("Run the golden master tests.\n"); 1790 usage.printf("Run the golden master tests.\n");
1761 SkCommandLineFlags::SetUsage(usage.c_str()); 1791 SkCommandLineFlags::SetUsage(usage.c_str());
1762 SkCommandLineFlags::Parse(argc, argv); 1792 SkCommandLineFlags::Parse(argc, argv);
1763 1793
1764 gmmain.fUseFileHierarchy = FLAGS_hierarchy; 1794 gmmain.fUseFileHierarchy = FLAGS_hierarchy;
1795 gmmain.fWriteChecksumBasedFilenames = FLAGS_writeChecksumBasedFilenames;
1765 if (FLAGS_mismatchPath.count() == 1) { 1796 if (FLAGS_mismatchPath.count() == 1) {
1766 gmmain.fMismatchPath = FLAGS_mismatchPath[0]; 1797 gmmain.fMismatchPath = FLAGS_mismatchPath[0];
1767 } 1798 }
1768 1799
1769 for (int i = 0; i < FLAGS_config.count(); i++) { 1800 for (int i = 0; i < FLAGS_config.count(); i++) {
1770 const char* config = FLAGS_config[i]; 1801 const char* config = FLAGS_config[i];
1771 userConfig = true; 1802 userConfig = true;
1772 bool exclude = false; 1803 bool exclude = false;
1773 if (*config == kExcludeConfigChar) { 1804 if (*config == kExcludeConfigChar) {
1774 exclude = true; 1805 exclude = true;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 if (FLAGS_forceBWtext) { 2117 if (FLAGS_forceBWtext) {
2087 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2118 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2088 } 2119 }
2089 } 2120 }
2090 2121
2091 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2122 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2092 int main(int argc, char * const argv[]) { 2123 int main(int argc, char * const argv[]) {
2093 return tool_main(argc, (char**) argv); 2124 return tool_main(argc, (char**) argv);
2094 } 2125 }
2095 #endif 2126 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698