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 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->shor
tName(), |
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 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, | 1615 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP
lusConfig, |
1615 renderModeDescriptor); | 1616 renderModeDescriptor); |
1616 errorsForAllModes.add(kIntentionallySkipped_ErrorType); | 1617 errorsForAllModes.add(kIntentionallySkipped_ErrorType); |
1617 } else { | 1618 } else { |
1618 SkPicture* pict = gmmain.generate_new_picture( | 1619 SkPicture* pict = gmmain.generate_new_picture( |
1619 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_Recor
dingFlag); | 1620 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_Recor
dingFlag); |
1620 SkAutoUnref aur(pict); | 1621 SkAutoUnref aur(pict); |
1621 SkBitmap bitmap; | 1622 SkBitmap bitmap; |
1622 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; | 1623 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap)
; |
1623 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( | 1624 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma
p( |
1624 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitm
ap, | 1625 gm->shortName(), compareConfig.fName, renderModeDescriptor, bitm
ap, |
1625 &comparisonBitmap)); | 1626 &comparisonBitmap)); |
1626 } | 1627 } |
1627 } | 1628 } |
1628 | 1629 |
1629 if (FLAGS_tileGrid) { | 1630 if (FLAGS_tileGrid) { |
1630 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca
leIndex) { | 1631 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca
leIndex) { |
1631 SkScalar replayScale = tileGridReplayScales[scaleIndex]; | 1632 SkScalar replayScale = tileGridReplayScales[scaleIndex]; |
1632 SkString renderModeDescriptor("-tilegrid"); | 1633 SkString renderModeDescriptor("-tilegrid"); |
1633 if (SK_Scalar1 != replayScale) { | 1634 if (SK_Scalar1 != replayScale) { |
1634 renderModeDescriptor += "-scale-"; | 1635 renderModeDescriptor += "-scale-"; |
1635 renderModeDescriptor.appendScalar(replayScale); | 1636 renderModeDescriptor.appendScalar(replayScale); |
1636 } | 1637 } |
1637 | 1638 |
1638 if ((gmFlags & GM::kSkipPicture_Flag) || | 1639 if ((gmFlags & GM::kSkipPicture_Flag) || |
| 1640 (gmFlags & GM::kSkipTiled_Flag) || |
1639 ((gmFlags & GM::kSkipScaledReplay_Flag) && replayScale != 1)) { | 1641 ((gmFlags & GM::kSkipScaledReplay_Flag) && replayScale != 1)) { |
1640 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortN
amePlusConfig, | 1642 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortN
amePlusConfig, |
1641 renderModeDescriptor.c_str()); | 1643 renderModeDescriptor.c_str()); |
1642 errorsForAllModes.add(kIntentionallySkipped_ErrorType); | 1644 errorsForAllModes.add(kIntentionallySkipped_ErrorType); |
1643 } else { | 1645 } else { |
1644 // We record with the reciprocal scale to obtain a replay | 1646 // We record with the reciprocal scale to obtain a replay |
1645 // result that can be validated against comparisonBitmap. | 1647 // result that can be validated against comparisonBitmap. |
1646 SkScalar recordScale = SkScalarInvert(replayScale); | 1648 SkScalar recordScale = SkScalarInvert(replayScale); |
1647 SkPicture* pict = gmmain.generate_new_picture( | 1649 SkPicture* pict = gmmain.generate_new_picture( |
1648 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Reco
rdingFlag, | 1650 gm, kTileGrid_BbhType, SkPicture::kUsePathBoundsForClip_Reco
rdingFlag, |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 if (FLAGS_forceBWtext) { | 2420 if (FLAGS_forceBWtext) { |
2419 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2421 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2420 } | 2422 } |
2421 } | 2423 } |
2422 | 2424 |
2423 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2425 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2424 int main(int argc, char * const argv[]) { | 2426 int main(int argc, char * const argv[]) { |
2425 return tool_main(argc, (char**) argv); | 2427 return tool_main(argc, (char**) argv); |
2426 } | 2428 } |
2427 #endif | 2429 #endif |
OLD | NEW |