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