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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 errors.add(ErrorCombination(kIntentionallySkipped_ErrorType)); | 931 errors.add(ErrorCombination(kIntentionallySkipped_ErrorType)); |
932 } else if (!(gRec.fFlags & kWrite_ConfigFlag)) { | 932 } else if (!(gRec.fFlags & kWrite_ConfigFlag)) { |
933 // We don't record the results for this test or compare them | 933 // We don't record the results for this test or compare them |
934 // against any expectations, because the output image isn't | 934 // against any expectations, because the output image isn't |
935 // meaningful. | 935 // meaningful. |
936 // See https://code.google.com/p/skia/issues/detail?id=1410 ('some | 936 // See https://code.google.com/p/skia/issues/detail?id=1410 ('some |
937 // GM result images not available for download from Google Storage') | 937 // GM result images not available for download from Google Storage') |
938 errors.add(ErrorCombination(kIntentionallySkipped_ErrorType)); | 938 errors.add(ErrorCombination(kIntentionallySkipped_ErrorType)); |
939 } else { | 939 } else { |
940 ExpectationsSource *expectationsSource = this->fExpectationsSource.g
et(); | 940 ExpectationsSource *expectationsSource = this->fExpectationsSource.g
et(); |
941 SkString nameWithExtension = make_shortname_plus_config(gm->shortNam
e(), configName); | 941 SkString nameWithExtension = make_shortname_plus_config(gm->getName(
), configName); |
942 nameWithExtension.append("."); | 942 nameWithExtension.append("."); |
943 nameWithExtension.append(kPNG_FileExtension); | 943 nameWithExtension.append(kPNG_FileExtension); |
944 | 944 |
945 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) { | 945 if (expectationsSource && (gRec.fFlags & kRead_ConfigFlag)) { |
946 /* | 946 /* |
947 * Get the expected results for this test, as one or more allowe
d | 947 * Get the expected results for this test, as one or more allowe
d |
948 * hash digests. The current implementation of expectationsSourc
e | 948 * hash digests. The current implementation of expectationsSourc
e |
949 * get this by computing the hash digest of a single PNG file on
disk. | 949 * get this by computing the hash digest of a single PNG file on
disk. |
950 * | 950 * |
951 * TODO(epoger): This relies on the fact that | 951 * TODO(epoger): This relies on the fact that |
952 * force_all_opaque() was called on the bitmap before it | 952 * force_all_opaque() was called on the bitmap before it |
953 * was written to disk as a PNG in the first place. If | 953 * was written to disk as a PNG in the first place. If |
954 * not, the hash digest returned here may not match the | 954 * not, the hash digest returned here may not match the |
955 * hash digest of actualBitmap, which *has* been run through | 955 * hash digest of actualBitmap, which *has* been run through |
956 * force_all_opaque(). | 956 * force_all_opaque(). |
957 * See comments above complete_bitmap() for more detail. | 957 * See comments above complete_bitmap() for more detail. |
958 */ | 958 */ |
959 Expectations expectations = expectationsSource->get(nameWithExte
nsion.c_str()); | 959 Expectations expectations = expectationsSource->get(nameWithExte
nsion.c_str()); |
960 if (this->ShouldIgnoreTest(gm->shortName())) { | 960 if (this->ShouldIgnoreTest(gm->getName())) { |
961 expectations.setIgnoreFailure(true); | 961 expectations.setIgnoreFailure(true); |
962 } | 962 } |
963 errors.add(compare_to_expectations(expectations, *actualBitmapAn
dDigest, | 963 errors.add(compare_to_expectations(expectations, *actualBitmapAn
dDigest, |
964 gm->shortName(), configName,
"", true)); | 964 gm->getName(), configName, ""
, true)); |
965 } else { | 965 } else { |
966 // If we are running without expectations, we still want to | 966 // If we are running without expectations, we still want to |
967 // record the actual results. | 967 // record the actual results. |
968 add_actual_results_to_json_summary(nameWithExtension.c_str(), | 968 add_actual_results_to_json_summary(nameWithExtension.c_str(), |
969 actualBitmapAndDigest->fDiges
t, | 969 actualBitmapAndDigest->fDiges
t, |
970 ErrorCombination(kMissingExpe
ctations_ErrorType), | 970 ErrorCombination(kMissingExpe
ctations_ErrorType), |
971 false); | 971 false); |
972 errors.add(ErrorCombination(kMissingExpectations_ErrorType)); | 972 errors.add(ErrorCombination(kMissingExpectations_ErrorType)); |
973 } | 973 } |
974 } | 974 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 // TODO: Add a test to exercise what the stdout and | 1062 // TODO: Add a test to exercise what the stdout and |
1063 // JSON look like if we get an "early error" while | 1063 // JSON look like if we get an "early error" while |
1064 // trying to generate the image. | 1064 // trying to generate the image. |
1065 return errors; | 1065 return errors; |
1066 } | 1066 } |
1067 BitmapAndDigest bitmapAndDigest(*bitmap); | 1067 BitmapAndDigest bitmapAndDigest(*bitmap); |
1068 errors.add(compare_test_results_to_stored_expectations( | 1068 errors.add(compare_test_results_to_stored_expectations( |
1069 gm, gRec, gRec.fName, &bitmapAndDigest)); | 1069 gm, gRec, gRec.fName, &bitmapAndDigest)); |
1070 | 1070 |
1071 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { | 1071 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { |
1072 path = make_bitmap_filename(writePath, gm->shortName(), gRec.fNa
me, | 1072 path = make_bitmap_filename(writePath, gm->getName(), gRec.fName
, |
1073 "", bitmapAndDigest.fDigest); | 1073 "", bitmapAndDigest.fDigest); |
1074 errors.add(write_bitmap(path, bitmapAndDigest.fBitmap)); | 1074 errors.add(write_bitmap(path, bitmapAndDigest.fBitmap)); |
1075 } | 1075 } |
1076 } else if (gRec.fBackend == kPDF_Backend) { | 1076 } else if (gRec.fBackend == kPDF_Backend) { |
1077 if (!generate_pdf(gm, document)) { | 1077 if (!generate_pdf(gm, document)) { |
1078 errors.add(kGeneratePdfFailed_ErrorType); | 1078 errors.add(kGeneratePdfFailed_ErrorType); |
1079 } else { | 1079 } else { |
1080 SkAutoTUnref<SkStreamAsset> documentStream(document.detachAsStre
am()); | 1080 SkAutoTUnref<SkStreamAsset> documentStream(document.detachAsStre
am()); |
1081 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { | 1081 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { |
1082 path = make_filename(writePath, gm->shortName(), gRec.fName,
"", "pdf"); | 1082 path = make_filename(writePath, gm->getName(), gRec.fName, "
", "pdf"); |
1083 errors.add(write_document(path, documentStream)); | 1083 errors.add(write_document(path, documentStream)); |
1084 } | 1084 } |
1085 | 1085 |
1086 if (!(gm->getFlags() & GM::kSkipPDFRasterization_Flag)) { | 1086 if (!(gm->getFlags() & GM::kSkipPDFRasterization_Flag)) { |
1087 for (int i = 0; i < pdfRasterizers.count(); i++) { | 1087 for (int i = 0; i < pdfRasterizers.count(); i++) { |
1088 SkBitmap pdfBitmap; | 1088 SkBitmap pdfBitmap; |
1089 documentStream->rewind(); | 1089 documentStream->rewind(); |
1090 bool success = (*pdfRasterizers[i]->fRasterizerFunction)
( | 1090 bool success = (*pdfRasterizers[i]->fRasterizerFunction)
( |
1091 documentStream.get(), &pdfBitmap); | 1091 documentStream.get(), &pdfBitmap); |
1092 if (!success) { | 1092 if (!success) { |
1093 gm_fprintf(stderr, "FAILED to render PDF for %s usin
g renderer %s\n", | 1093 gm_fprintf(stderr, "FAILED to render PDF for %s usin
g renderer %s\n", |
1094 gm->shortName(), | 1094 gm->getName(), |
1095 pdfRasterizers[i]->fName); | 1095 pdfRasterizers[i]->fName); |
1096 continue; | 1096 continue; |
1097 } | 1097 } |
1098 | 1098 |
1099 SkString configName(gRec.fName); | 1099 SkString configName(gRec.fName); |
1100 configName.append("-"); | 1100 configName.append("-"); |
1101 configName.append(pdfRasterizers[i]->fName); | 1101 configName.append(pdfRasterizers[i]->fName); |
1102 | 1102 |
1103 BitmapAndDigest bitmapAndDigest(pdfBitmap); | 1103 BitmapAndDigest bitmapAndDigest(pdfBitmap); |
1104 errors.add(compare_test_results_to_stored_expectations( | 1104 errors.add(compare_test_results_to_stored_expectations( |
1105 gm, gRec, configName.c_str(), &bitmapAndDiges
t)); | 1105 gm, gRec, configName.c_str(), &bitmapAndDiges
t)); |
1106 | 1106 |
1107 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { | 1107 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { |
1108 path = make_bitmap_filename(writePath, gm->shortName
(), | 1108 path = make_bitmap_filename(writePath, gm->getName()
, |
1109 configName.c_str(), | 1109 configName.c_str(), |
1110 "", bitmapAndDigest.fDig
est); | 1110 "", bitmapAndDigest.fDig
est); |
1111 errors.add(write_bitmap(path, bitmapAndDigest.fBitma
p)); | 1111 errors.add(write_bitmap(path, bitmapAndDigest.fBitma
p)); |
1112 } | 1112 } |
1113 } | 1113 } |
1114 } else { | 1114 } else { |
1115 errors.add(kIntentionallySkipped_ErrorType); | 1115 errors.add(kIntentionallySkipped_ErrorType); |
1116 } | 1116 } |
1117 } | 1117 } |
1118 } else if (gRec.fBackend == kXPS_Backend) { | 1118 } else if (gRec.fBackend == kXPS_Backend) { |
1119 generate_xps(gm, document); | 1119 generate_xps(gm, document); |
1120 SkAutoTUnref<SkStreamAsset> documentStream(document.detachAsStream()
); | 1120 SkAutoTUnref<SkStreamAsset> documentStream(document.detachAsStream()
); |
1121 | 1121 |
1122 errors.add(compare_test_results_to_stored_expectations( | 1122 errors.add(compare_test_results_to_stored_expectations( |
1123 gm, gRec, gRec.fName, NULL)); | 1123 gm, gRec, gRec.fName, NULL)); |
1124 | 1124 |
1125 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { | 1125 if (writePath && (gRec.fFlags & kWrite_ConfigFlag)) { |
1126 path = make_filename(writePath, gm->shortName(), gRec.fName, "",
"xps"); | 1126 path = make_filename(writePath, gm->getName(), gRec.fName, "", "
xps"); |
1127 errors.add(write_document(path, documentStream)); | 1127 errors.add(write_document(path, documentStream)); |
1128 } | 1128 } |
1129 } else { | 1129 } else { |
1130 SkASSERT(false); | 1130 SkASSERT(false); |
1131 } | 1131 } |
1132 return errors; | 1132 return errors; |
1133 } | 1133 } |
1134 | 1134 |
1135 ErrorCombination test_deferred_drawing(GM* gm, | 1135 ErrorCombination test_deferred_drawing(GM* gm, |
1136 const ConfigData& gRec, | 1136 const ConfigData& gRec, |
(...skipping 16 matching lines...) Expand all Loading... |
1153 // | 1153 // |
1154 // Filed as https://code.google.com/p/skia/issues/detail?id=1180 | 1154 // Filed as https://code.google.com/p/skia/issues/detail?id=1180 |
1155 // ('image-surface gm test is failing in "deferred" mode, | 1155 // ('image-surface gm test is failing in "deferred" mode, |
1156 // and gm is not reporting the failure') | 1156 // and gm is not reporting the failure') |
1157 if (errors.isEmpty()) { | 1157 if (errors.isEmpty()) { |
1158 // TODO(epoger): Report this as a new ErrorType, | 1158 // TODO(epoger): Report this as a new ErrorType, |
1159 // something like kImageGeneration_ErrorType? | 1159 // something like kImageGeneration_ErrorType? |
1160 return kEmpty_ErrorCombination; | 1160 return kEmpty_ErrorCombination; |
1161 } | 1161 } |
1162 return compare_test_results_to_reference_bitmap( | 1162 return compare_test_results_to_reference_bitmap( |
1163 gm->shortName(), gRec.fName, renderModeDescriptor, bitmap, &refe
renceBitmap); | 1163 gm->getName(), gRec.fName, renderModeDescriptor, bitmap, &refere
nceBitmap); |
1164 } | 1164 } |
1165 return kEmpty_ErrorCombination; | 1165 return kEmpty_ErrorCombination; |
1166 } | 1166 } |
1167 | 1167 |
1168 ErrorCombination test_pipe_playback(GM* gm, const ConfigData& gRec, | 1168 ErrorCombination test_pipe_playback(GM* gm, const ConfigData& gRec, |
1169 const SkBitmap& referenceBitmap, bool si
mulateFailure) { | 1169 const SkBitmap& referenceBitmap, bool si
mulateFailure) { |
1170 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shor
tName(), | 1170 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->getN
ame(), |
1171 gRec.fNa
me); | 1171 gRec.fNa
me); |
1172 ErrorCombination errors; | 1172 ErrorCombination errors; |
1173 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { | 1173 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { |
1174 SkString renderModeDescriptor("-pipe"); | 1174 SkString renderModeDescriptor("-pipe"); |
1175 renderModeDescriptor.append(gPipeWritingFlagCombos[i].name); | 1175 renderModeDescriptor.append(gPipeWritingFlagCombos[i].name); |
1176 | 1176 |
1177 if (gm->getFlags() & GM::kSkipPipe_Flag | 1177 if (gm->getFlags() & GM::kSkipPipe_Flag |
1178 || (gPipeWritingFlagCombos[i].flags == SkGPipeWriter::kCrossProc
ess_Flag | 1178 || (gPipeWritingFlagCombos[i].flags == SkGPipeWriter::kCrossProc
ess_Flag |
1179 && gm->getFlags() & GM::kSkipPipeCrossProcess_Flag)) { | 1179 && gm->getFlags() & GM::kSkipPipeCrossProcess_Flag)) { |
1180 RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlus
Config, | 1180 RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlus
Config, |
(...skipping 11 matching lines...) Expand all Loading... |
1192 SkGPipeWriter writer; | 1192 SkGPipeWriter writer; |
1193 SkCanvas* pipeCanvas = writer.startRecording(&pipeController, | 1193 SkCanvas* pipeCanvas = writer.startRecording(&pipeController, |
1194 gPipeWritingFlagCom
bos[i].flags, | 1194 gPipeWritingFlagCom
bos[i].flags, |
1195 size.width(), size.
height()); | 1195 size.width(), size.
height()); |
1196 if (!simulateFailure) { | 1196 if (!simulateFailure) { |
1197 invokeGM(gm, pipeCanvas, false, false); | 1197 invokeGM(gm, pipeCanvas, false, false); |
1198 } | 1198 } |
1199 complete_bitmap(&bitmap); | 1199 complete_bitmap(&bitmap); |
1200 writer.endRecording(); | 1200 writer.endRecording(); |
1201 errors.add(compare_test_results_to_reference_bitmap( | 1201 errors.add(compare_test_results_to_reference_bitmap( |
1202 gm->shortName(), gRec.fName, renderModeDescriptor.c_str(), b
itmap, | 1202 gm->getName(), gRec.fName, renderModeDescriptor.c_str(), bit
map, |
1203 &referenceBitmap)); | 1203 &referenceBitmap)); |
1204 if (!errors.isEmpty()) { | 1204 if (!errors.isEmpty()) { |
1205 break; | 1205 break; |
1206 } | 1206 } |
1207 } | 1207 } |
1208 } | 1208 } |
1209 return errors; | 1209 return errors; |
1210 } | 1210 } |
1211 | 1211 |
1212 ErrorCombination test_tiled_pipe_playback(GM* gm, const ConfigData& gRec, | 1212 ErrorCombination test_tiled_pipe_playback(GM* gm, const ConfigData& gRec, |
1213 const SkBitmap& referenceBitmap) { | 1213 const SkBitmap& referenceBitmap) { |
1214 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shor
tName(), | 1214 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->getN
ame(), |
1215 gRec.fNa
me); | 1215 gRec.fNa
me); |
1216 ErrorCombination errors; | 1216 ErrorCombination errors; |
1217 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { | 1217 for (size_t i = 0; i < SK_ARRAY_COUNT(gPipeWritingFlagCombos); ++i) { |
1218 SkString renderModeDescriptor("-tiled pipe"); | 1218 SkString renderModeDescriptor("-tiled pipe"); |
1219 renderModeDescriptor.append(gPipeWritingFlagCombos[i].name); | 1219 renderModeDescriptor.append(gPipeWritingFlagCombos[i].name); |
1220 | 1220 |
1221 if ((gm->getFlags() & GM::kSkipPipe_Flag) || | 1221 if ((gm->getFlags() & GM::kSkipPipe_Flag) || |
1222 (gm->getFlags() & GM::kSkipTiled_Flag)) { | 1222 (gm->getFlags() & GM::kSkipTiled_Flag)) { |
1223 RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlus
Config, | 1223 RecordTestResults(kIntentionallySkipped_ErrorType, shortNamePlus
Config, |
1224 renderModeDescriptor.c_str()); | 1224 renderModeDescriptor.c_str()); |
1225 errors.add(kIntentionallySkipped_ErrorType); | 1225 errors.add(kIntentionallySkipped_ErrorType); |
1226 } else { | 1226 } else { |
1227 SkBitmap bitmap; | 1227 SkBitmap bitmap; |
1228 SkISize size = gm->getISize(); | 1228 SkISize size = gm->getISize(); |
1229 setup_bitmap(gRec, size, &bitmap); | 1229 setup_bitmap(gRec, size, &bitmap); |
1230 SkCanvas canvas(bitmap); | 1230 SkCanvas canvas(bitmap); |
1231 installFilter(&canvas); | 1231 installFilter(&canvas); |
1232 TiledPipeController pipeController(bitmap, &SkImageDecoder::Deco
deMemory); | 1232 TiledPipeController pipeController(bitmap, &SkImageDecoder::Deco
deMemory); |
1233 SkGPipeWriter writer; | 1233 SkGPipeWriter writer; |
1234 SkCanvas* pipeCanvas = writer.startRecording(&pipeController, | 1234 SkCanvas* pipeCanvas = writer.startRecording(&pipeController, |
1235 gPipeWritingFlagCom
bos[i].flags, | 1235 gPipeWritingFlagCom
bos[i].flags, |
1236 size.width(), size.
height()); | 1236 size.width(), size.
height()); |
1237 invokeGM(gm, pipeCanvas, false, false); | 1237 invokeGM(gm, pipeCanvas, false, false); |
1238 complete_bitmap(&bitmap); | 1238 complete_bitmap(&bitmap); |
1239 writer.endRecording(); | 1239 writer.endRecording(); |
1240 errors.add(compare_test_results_to_reference_bitmap(gm->shortNam
e(), gRec.fName, | 1240 errors.add(compare_test_results_to_reference_bitmap(gm->getName(
), gRec.fName, |
1241 renderModeDe
scriptor.c_str(), | 1241 renderModeDe
scriptor.c_str(), |
1242 bitmap, &ref
erenceBitmap)); | 1242 bitmap, &ref
erenceBitmap)); |
1243 if (!errors.isEmpty()) { | 1243 if (!errors.isEmpty()) { |
1244 break; | 1244 break; |
1245 } | 1245 } |
1246 } | 1246 } |
1247 } | 1247 } |
1248 return errors; | 1248 return errors; |
1249 } | 1249 } |
1250 | 1250 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 * Returns all errors encountered while doing so. | 1548 * Returns all errors encountered while doing so. |
1549 */ | 1549 */ |
1550 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
mpareConfig, | 1550 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
mpareConfig, |
1551 const SkBitmap &comparisonBitmap, | 1551 const SkBitmap &comparisonBitmap, |
1552 const SkTDArray<SkScalar> &tileGridReplaySca
les); | 1552 const SkTDArray<SkScalar> &tileGridReplaySca
les); |
1553 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
mpareConfig, | 1553 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &co
mpareConfig, |
1554 const SkBitmap &comparisonBitmap, | 1554 const SkBitmap &comparisonBitmap, |
1555 const SkTDArray<SkScalar> &tileGridReplaySca
les) { | 1555 const SkTDArray<SkScalar> &tileGridReplaySca
les) { |
1556 ErrorCombination errorsForAllModes; | 1556 ErrorCombination errorsForAllModes; |
1557 uint32_t gmFlags = gm->getFlags(); | 1557 uint32_t gmFlags = gm->getFlags(); |
1558 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->s
hortName(), | 1558 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->g
etName(), |
1559 compa
reConfig.fName); | 1559 compa
reConfig.fName); |
1560 | 1560 |
1561 SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0); | 1561 SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0); |
1562 SkAutoUnref aur(pict); | 1562 SkAutoUnref aur(pict); |
1563 if (FLAGS_replay) { | 1563 if (FLAGS_replay) { |
1564 const char renderModeDescriptor[] = "-replay"; | 1564 const char renderModeDescriptor[] = "-replay"; |
1565 if (gmFlags & GM::kSkipPicture_Flag) { | 1565 if (gmFlags & GM::kSkipPicture_Flag) { |
1566 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, | 1566 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, |
1567 renderModeDescriptor); | 1567 renderModeDescriptor); |
1568 errorsForAllModes.add(kIntentionallySkipped_ErrorType); | 1568 errorsForAllModes.add(kIntentionallySkipped_ErrorType); |
1569 } else { | 1569 } else { |
1570 SkBitmap bitmap; | 1570 SkBitmap bitmap; |
1571 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; | 1571 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; |
1572 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( | 1572 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( |
1573 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitm
ap, | 1573 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap
, |
1574 &comparisonBitmap)); | 1574 &comparisonBitmap)); |
1575 } | 1575 } |
1576 } | 1576 } |
1577 | 1577 |
1578 if (FLAGS_serialize) { | 1578 if (FLAGS_serialize) { |
1579 const char renderModeDescriptor[] = "-serialize"; | 1579 const char renderModeDescriptor[] = "-serialize"; |
1580 if (gmFlags & GM::kSkipPicture_Flag) { | 1580 if (gmFlags & GM::kSkipPicture_Flag) { |
1581 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, | 1581 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, |
1582 renderModeDescriptor); | 1582 renderModeDescriptor); |
1583 errorsForAllModes.add(kIntentionallySkipped_ErrorType); | 1583 errorsForAllModes.add(kIntentionallySkipped_ErrorType); |
1584 } else { | 1584 } else { |
1585 SkPicture* repict = gmmain.stream_to_new_picture(*pict); | 1585 SkPicture* repict = gmmain.stream_to_new_picture(*pict); |
1586 SkAutoUnref aurr(repict); | 1586 SkAutoUnref aurr(repict); |
1587 SkBitmap bitmap; | 1587 SkBitmap bitmap; |
1588 gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitma
p); | 1588 gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitma
p); |
1589 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( | 1589 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( |
1590 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitm
ap, | 1590 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap
, |
1591 &comparisonBitmap)); | 1591 &comparisonBitmap)); |
1592 } | 1592 } |
1593 } | 1593 } |
1594 | 1594 |
1595 if ((1 == FLAGS_writePicturePath.count()) && | 1595 if ((1 == FLAGS_writePicturePath.count()) && |
1596 !(gmFlags & GM::kSkipPicture_Flag)) { | 1596 !(gmFlags & GM::kSkipPicture_Flag)) { |
1597 const char* pictureSuffix = "skp"; | 1597 const char* pictureSuffix = "skp"; |
1598 // TODO(epoger): Make sure this still works even though the | 1598 // TODO(epoger): Make sure this still works even though the |
1599 // filename now contains the config name (it used to contain | 1599 // filename now contains the config name (it used to contain |
1600 // just the shortName). I think this is actually an | 1600 // just the shortName). I think this is actually an |
1601 // *improvement*, because now runs with different configs will | 1601 // *improvement*, because now runs with different configs will |
1602 // write out their SkPictures to separate files rather than | 1602 // write out their SkPictures to separate files rather than |
1603 // overwriting each other. But we should make sure it doesn't | 1603 // overwriting each other. But we should make sure it doesn't |
1604 // break anybody. | 1604 // break anybody. |
1605 SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->shor
tName(), | 1605 SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->getN
ame(), |
1606 compareConfig.fName, "", pictureSuf
fix); | 1606 compareConfig.fName, "", pictureSuf
fix); |
1607 SkFILEWStream stream(path.c_str()); | 1607 SkFILEWStream stream(path.c_str()); |
1608 pict->serialize(&stream); | 1608 pict->serialize(&stream); |
1609 } | 1609 } |
1610 | 1610 |
1611 if (FLAGS_rtree) { | 1611 if (FLAGS_rtree) { |
1612 const char renderModeDescriptor[] = "-rtree"; | 1612 const char renderModeDescriptor[] = "-rtree"; |
1613 if ((gmFlags & GM::kSkipPicture_Flag) || | 1613 if ((gmFlags & GM::kSkipPicture_Flag) || |
1614 (gmFlags & GM::kSkipTiled_Flag)) { | 1614 (gmFlags & GM::kSkipTiled_Flag)) { |
1615 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, | 1615 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, |
1616 renderModeDescriptor); | 1616 renderModeDescriptor); |
1617 errorsForAllModes.add(kIntentionallySkipped_ErrorType); | 1617 errorsForAllModes.add(kIntentionallySkipped_ErrorType); |
1618 } else { | 1618 } else { |
1619 SkPicture* pict = gmmain.generate_new_picture( | 1619 SkPicture* pict = gmmain.generate_new_picture( |
1620 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_Recor
dingFlag); | 1620 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_Recor
dingFlag); |
1621 SkAutoUnref aur(pict); | 1621 SkAutoUnref aur(pict); |
1622 SkBitmap bitmap; | 1622 SkBitmap bitmap; |
1623 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; | 1623 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; |
1624 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( | 1624 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( |
1625 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitm
ap, | 1625 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap
, |
1626 &comparisonBitmap)); | 1626 &comparisonBitmap)); |
1627 } | 1627 } |
1628 } | 1628 } |
1629 | 1629 |
1630 if (FLAGS_tileGrid) { | 1630 if (FLAGS_tileGrid) { |
1631 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca
leIndex) { | 1631 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca
leIndex) { |
1632 SkScalar replayScale = tileGridReplayScales[scaleIndex]; | 1632 SkScalar replayScale = tileGridReplayScales[scaleIndex]; |
1633 SkString renderModeDescriptor("-tilegrid"); | 1633 SkString renderModeDescriptor("-tilegrid"); |
1634 if (SK_Scalar1 != replayScale) { | 1634 if (SK_Scalar1 != replayScale) { |
1635 renderModeDescriptor += "-scale-"; | 1635 renderModeDescriptor += "-scale-"; |
(...skipping 14 matching lines...) Expand all Loading... |
1650 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Reco
rdingFlag, | 1650 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Reco
rdingFlag, |
1651 recordScale); | 1651 recordScale); |
1652 SkAutoUnref aur(pict); | 1652 SkAutoUnref aur(pict); |
1653 SkBitmap bitmap; | 1653 SkBitmap bitmap; |
1654 // We cannot yet pass 'true' to generate_image_from_picture to | 1654 // We cannot yet pass 'true' to generate_image_from_picture to |
1655 // perform actual tiled rendering (see Issue 1198 - | 1655 // perform actual tiled rendering (see Issue 1198 - |
1656 // https://code.google.com/p/skia/issues/detail?id=1198) | 1656 // https://code.google.com/p/skia/issues/detail?id=1198) |
1657 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bit
map, | 1657 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bit
map, |
1658 replayScale /*, true */); | 1658 replayScale /*, true */); |
1659 errorsForAllModes.add(gmmain.compare_test_results_to_reference_b
itmap( | 1659 errorsForAllModes.add(gmmain.compare_test_results_to_reference_b
itmap( |
1660 gm->shortName(), compareConfig.fName, renderModeDescriptor.c
_str(), bitmap, | 1660 gm->getName(), compareConfig.fName, renderModeDescriptor.c_s
tr(), bitmap, |
1661 &comparisonBitmap)); | 1661 &comparisonBitmap)); |
1662 } | 1662 } |
1663 } | 1663 } |
1664 } | 1664 } |
1665 | 1665 |
1666 // run the pipe centric GM steps | 1666 // run the pipe centric GM steps |
1667 if (FLAGS_pipe) { | 1667 if (FLAGS_pipe) { |
1668 errorsForAllModes.add(gmmain.test_pipe_playback(gm, compareConfig, compa
risonBitmap, | 1668 errorsForAllModes.add(gmmain.test_pipe_playback(gm, compareConfig, compa
risonBitmap, |
1669 FLAGS_simulatePipePlayba
ckFailure)); | 1669 FLAGS_simulatePipePlayba
ckFailure)); |
1670 if (FLAGS_tiledPipe) { | 1670 if (FLAGS_tiledPipe) { |
(...skipping 21 matching lines...) Expand all Loading... |
1692 const SkTDArray<size_t> &configs, | 1692 const SkTDArray<size_t> &configs, |
1693 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, | 1693 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, |
1694 const SkTDArray<SkScalar> &tileGridReplayS
cales, | 1694 const SkTDArray<SkScalar> &tileGridReplayS
cales, |
1695 GrContextFactory *grFactory) { | 1695 GrContextFactory *grFactory) { |
1696 const char renderModeDescriptor[] = ""; | 1696 const char renderModeDescriptor[] = ""; |
1697 ErrorCombination errorsForAllConfigs; | 1697 ErrorCombination errorsForAllConfigs; |
1698 uint32_t gmFlags = gm->getFlags(); | 1698 uint32_t gmFlags = gm->getFlags(); |
1699 | 1699 |
1700 for (int i = 0; i < configs.count(); i++) { | 1700 for (int i = 0; i < configs.count(); i++) { |
1701 ConfigData config = gRec[configs[i]]; | 1701 ConfigData config = gRec[configs[i]]; |
1702 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->shortName(), | 1702 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->getName(), |
1703 c
onfig.fName); | 1703 c
onfig.fName); |
1704 | 1704 |
1705 // Skip any tests that we don't even need to try. | 1705 // Skip any tests that we don't even need to try. |
1706 // If any of these were skipped on a per-GM basis, record them as | 1706 // If any of these were skipped on a per-GM basis, record them as |
1707 // kIntentionallySkipped. | 1707 // kIntentionallySkipped. |
1708 if (kPDF_Backend == config.fBackend) { | 1708 if (kPDF_Backend == config.fBackend) { |
1709 if (gmFlags & GM::kSkipPDF_Flag) { | 1709 if (gmFlags & GM::kSkipPDF_Flag) { |
1710 gmmain.RecordSkippedTest(shortNamePlusConfig, | 1710 gmmain.RecordSkippedTest(shortNamePlusConfig, |
1711 renderModeDescriptor, | 1711 renderModeDescriptor, |
1712 config.fBackend); | 1712 config.fBackend); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 } | 2309 } |
2310 SkAutoTDelete<GM> adgm(gm); | 2310 SkAutoTDelete<GM> adgm(gm); |
2311 ++gmIndex; | 2311 ++gmIndex; |
2312 if (moduloRemainder >= 0) { | 2312 if (moduloRemainder >= 0) { |
2313 if ((gmIndex % moduloDivisor) != moduloRemainder) { | 2313 if ((gmIndex % moduloDivisor) != moduloRemainder) { |
2314 continue; | 2314 continue; |
2315 } | 2315 } |
2316 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); | 2316 moduloStr.printf("[%d.%d] ", gmIndex, moduloDivisor); |
2317 } | 2317 } |
2318 | 2318 |
2319 const char* shortName = gm->shortName(); | 2319 const char* shortName = gm->getName(); |
2320 | 2320 |
2321 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { | 2321 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { |
2322 continue; | 2322 continue; |
2323 } | 2323 } |
2324 | 2324 |
2325 gmsRun++; | 2325 gmsRun++; |
2326 SkISize size = gm->getISize(); | 2326 SkISize size = gm->getISize(); |
2327 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, | 2327 gm_fprintf(stdout, "%sdrawing... %s [%d %d]\n", moduloStr.c_str(), short
Name, |
2328 size.width(), size.height()); | 2328 size.width(), size.height()); |
2329 | 2329 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 if (FLAGS_forceBWtext) { | 2420 if (FLAGS_forceBWtext) { |
2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2422 } | 2422 } |
2423 } | 2423 } |
2424 | 2424 |
2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2426 int main(int argc, char * const argv[]) { | 2426 int main(int argc, char * const argv[]) { |
2427 return tool_main(argc, (char**) argv); | 2427 return tool_main(argc, (char**) argv); |
2428 } | 2428 } |
2429 #endif | 2429 #endif |
OLD | NEW |