Lines Matching refs:gm
9 * Code for the "gm" (Golden Master) rendering comparison tool.
11 * If you make changes to this, re-run the self-tests at gm/tests/run.sh
16 #include "gm.h"
79 // stop writing out XPS-format image baselines in gm.
101 GM* next() {
125 // image files read/written by GM use this file extension.
144 /* Write GM images if a write path is provided. */
146 /* Read reference GM images if a read path is provided. */
445 * Prepare an SkBitmap to render a GM into.
447 * After you've rendered the GM into the SkBitmap, you must call
464 * we have rendered the GM into it.
469 * https://code.google.com/p/skia/source/browse/trunk/gm/gmmain.cpp?r=7289#305 .
477 * http://code.google.com/p/skia/issues/detail?id=1079 ('gm generating
524 static void invokeGM(GM* gm, SkCanvas* canvas, bool isPDF, bool isDeferred) {
528 canvas->concat(gm->getInitialTransform());
531 gm->setCanvasIsDeferred(isDeferred);
532 gm->draw(canvas);
536 static ErrorCombination generate_image(GM* gm, const ConfigData& gRec,
540 SkISize size (gm->getISize());
552 invokeGM(gm, canvas, false, deferred);
563 invokeGM(gm, canvas, false, deferred);
576 static void generate_image_from_picture(GM* gm, const ConfigData& gRec,
580 SkISize size = gm->getISize();
625 static bool generate_pdf(GM* gm, SkDynamicMemoryWStream& pdf) {
627 SkMatrix initialTransform = gm->getInitialTransform();
629 SkISize pageISize = gm->getISize();
644 invokeGM(gm, canvas, true, false);
648 SkISize pageSize = gm->getISize();
667 invokeGM(gm, &c, true, false);
676 static void generate_xps(GM* gm, SkDynamicMemoryWStream& xps) {
678 SkISize size = gm->getISize();
694 invokeGM(gm, &c, false, false);
862 // image hash digest, but that gm test doesn't actually
864 // because gm only looks at expectations that correspond
865 // to gm tests that were actually run.
891 * @param gm which test generated the actualBitmap
898 GM* gm, const ConfigData& gRec, const char* configName,
901 SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(), configName);
915 // GM result images not available for download from Google Storage')
942 gm->shortName(), configName, "", true));
987 static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t recordFlags,
991 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().width()), scale));
992 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().height()), scale));
1008 invokeGM(gm, cv, false, false);
1038 ErrorCombination test_drawing(GM* gm, const ConfigData& gRec,
1050 errors.add(generate_image(gm, gRec, gpuTarget, bitmap, false));
1059 gm, gRec, gRec.fName, &bitmapAndDigest));
1062 path = make_bitmap_filename(writePath, gm->shortName(), gRec.fName,
1067 if (!generate_pdf(gm, document)) {
1072 path = make_filename(writePath, gm->shortName(), gRec.fName, "", "pdf");
1076 if (!(gm->getFlags() & GM::kSkipPDFRasterization_Flag)) {
1084 gm->shortName(),
1095 gm, gRec, configName.c_str(), &bitmapAndDigest));
1098 path = make_bitmap_filename(writePath, gm->shortName(),
1109 generate_xps(gm, document);
1113 gm, gRec, gRec.fName, NULL));
1116 path = make_filename(writePath, gm->shortName(), gRec.fName, "", "xps");
1125 ErrorCombination test_deferred_drawing(GM* gm,
1135 ErrorCombination errors = generate_image(gm, gRec, gpuTarget, &bitmap, true);
1145 // ('image-surface gm test is failing in "deferred" mode,
1146 // and gm is not reporting the failure')
1153 gm->shortName(), gRec.fName, renderModeDescriptor, bitmap, &referenceBitmap);
1158 ErrorCombination test_pipe_playback(GM* gm, const ConfigData& gRec,
1160 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(),
1167 if (gm->getFlags() & GM::kSkipPipe_Flag
1169 && gm->getFlags() & GM::kSkipPipeCrossProcess_Flag)) {
1175 SkISize size = gm
1179 // Pass a decoding function so the factory GM (which has an SkBitmap
1187 invokeGM(gm, pipeCanvas, false, false);
1192 gm->shortName(), gRec.fName, renderModeDescriptor.c_str(), bitmap,
1202 ErrorCombination test_tiled_pipe_playback(GM* gm, const ConfigData& gRec,
1204 const SkString shortNamePlusConfig = make_shortname_plus_config(gm->shortName(),
1211 if ((gm->getFlags() & GM::kSkipPipe_Flag) ||
1212 (gm->getFlags() & GM::kSkipTiled_Flag)) {
1218 SkISize size = gm->getISize();
1227 invokeGM(gm, pipeCanvas, false, false);
1230 errors.add(compare_test_results_to_reference_bitmap(gm->shortName(), gRec.fName,
1445 DEFINE_bool(resetGpuContext, false, "Reset the GrContext prior to running each GM.");
1538 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
1542 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm,
1548 uint32_t gmFlags = gm->getFlags();
1552 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->shortName(),
1556 // If any of these were skipped on a per-GM basis, record them as
1559 if (gmFlags & GM::kSkipPDF_Flag) {
1566 if ((gmFlags & GM::kSkip565_Flag) &&
1574 if (((gmFlags & GM::kSkipGPU_Flag) && kGPU_Backend == config.fBackend) ||
1575 ((gmFlags & GM::kGPUOnly_Flag) && kGPU_Backend != config.fBackend)) {
1599 desc.fWidth = gm->getISize().width();
1600 desc.fHeight = gm->getISize().height();
1635 errorsForThisConfig.add(gmmain.test_drawing(gm, config, pdfRasterizers,
1643 errorsForThisConfig.add(gmmain.test_deferred_drawing(gm, config, comparisonBitmap,
1659 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compareConfig,
1662 ErrorCombination run_multiple_modes(GMMain &gmmain, GM *gm, const ConfigData &compareConfig,
1666 uint32_t gmFlags = gm->getFlags();
1667 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(gm->shortName(),
1670 SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0);
1674 if (gmFlags & GM::kSkipPicture_Flag) {
1680 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
1682 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
1689 if (gmFlags & GM::kSkipPicture_Flag) {
1697 gmmain.generate_image_from_picture(gm, compareConfig, repict, &bitmap);
1699 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
1705 !(gmFlags & GM::kSkipPicture_Flag)) {
1714 SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->shortName(),
1722 if (gmFlags & GM::kSkipPicture_Flag) {
1728 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_RecordingFlag);
1731 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap);
1733 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitmap,
1747 if ((gmFlags & GM::kSkipPicture_Flag) ||
1748 ((gmFlags & GM::kSkipScaledReplay_Flag) && replayScale != 1)) {
1757 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_RecordingFlag,
1764 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap,
1767 gm->shortName(), compareConfig.fName, renderModeDescriptor.c_str(), bitmap,
1773 // run the pipe centric GM steps
1775 errorsForAllModes.add(gmmain.test_pipe_playback(gm, compareConfig, comparisonBitmap,
1778 errorsForAllModes.add(gmmain.test_tiled_pipe_playback(gm, compareConfig,
2168 GM::SetResourcePath(FLAGS_resourcePath[0]);
2271 GM* gm;
2272 while ((gm = iter.next()) != NULL) {
2280 gm->setStarterMatrix(perspective);
2282 SkAutoTDelete<GM> adgm(gm);
2291 const char* shortName = gm->shortName();
2298 SkISize size = gm->getISize();
2302 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, grFactory);
2307 gmmain.generate_image(gm, compareConfig, NULL, &comparisonBitmap, false);
2311 run_multiple_modes(gmmain, gm, compareConfig, comparisonBitmap, tileGridReplayScales);
2334 // ('GM is unexpectedly skipping tests on Android')