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

Side by Side Diff: gm/gmmain.cpp

Issue 239703006: Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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
« no previous file with comments | « dm/DMReplayTask.cpp ('k') | gyp/core.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 #include "SkDrawFilter.h" 27 #include "SkDrawFilter.h"
28 #include "SkForceLinking.h" 28 #include "SkForceLinking.h"
29 #include "SkGPipe.h" 29 #include "SkGPipe.h"
30 #include "SkGraphics.h" 30 #include "SkGraphics.h"
31 #include "SkImageDecoder.h" 31 #include "SkImageDecoder.h"
32 #include "SkImageEncoder.h" 32 #include "SkImageEncoder.h"
33 #include "SkJSONCPP.h" 33 #include "SkJSONCPP.h"
34 #include "SkOSFile.h" 34 #include "SkOSFile.h"
35 #include "SkPDFRasterizer.h" 35 #include "SkPDFRasterizer.h"
36 #include "SkPicture.h" 36 #include "SkPicture.h"
37 #include "SkQuadTreePicture.h"
37 #include "SkRefCnt.h" 38 #include "SkRefCnt.h"
39 #include "SkRTreePicture.h"
38 #include "SkScalar.h" 40 #include "SkScalar.h"
39 #include "SkStream.h" 41 #include "SkStream.h"
40 #include "SkString.h" 42 #include "SkString.h"
41 #include "SkSurface.h" 43 #include "SkSurface.h"
42 #include "SkTArray.h" 44 #include "SkTArray.h"
43 #include "SkTDict.h" 45 #include "SkTDict.h"
44 #include "SkTileGridPicture.h" 46 #include "SkTileGridPicture.h"
45 #include "SamplePipeControllers.h" 47 #include "SamplePipeControllers.h"
46 48
47 #ifdef SK_DEBUG 49 #ifdef SK_DEBUG
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 kRaster_Backend, 134 kRaster_Backend,
133 kGPU_Backend, 135 kGPU_Backend,
134 kPDF_Backend, 136 kPDF_Backend,
135 kXPS_Backend, 137 kXPS_Backend,
136 }; 138 };
137 139
138 enum BbhType { 140 enum BbhType {
139 kNone_BbhType, 141 kNone_BbhType,
140 kRTree_BbhType, 142 kRTree_BbhType,
141 kTileGrid_BbhType, 143 kTileGrid_BbhType,
144 kQuadTree_BbhType
142 }; 145 };
143 146
144 enum ConfigFlags { 147 enum ConfigFlags {
145 kNone_ConfigFlag = 0x0, 148 kNone_ConfigFlag = 0x0,
146 /* Write GM images if a write path is provided. */ 149 /* Write GM images if a write path is provided. */
147 kWrite_ConfigFlag = 0x1, 150 kWrite_ConfigFlag = 0x1,
148 /* Read reference GM images if a read path is provided. */ 151 /* Read reference GM images if a read path is provided. */
149 kRead_ConfigFlag = 0x2, 152 kRead_ConfigFlag = 0x2,
150 kRW_ConfigFlag = (kWrite_ConfigFlag | kRead_ConfigFlag), 153 kRW_ConfigFlag = (kWrite_ConfigFlag | kRead_ConfigFlag),
151 }; 154 };
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale)); 1014 int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().w idth()), scale));
1012 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale)); 1015 int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize(). height()), scale));
1013 1016
1014 SkAutoTUnref<SkPictureFactory> factory; 1017 SkAutoTUnref<SkPictureFactory> factory;
1015 if (kTileGrid_BbhType == bbhType) { 1018 if (kTileGrid_BbhType == bbhType) {
1016 SkTileGridPicture::TileGridInfo info; 1019 SkTileGridPicture::TileGridInfo info;
1017 info.fMargin.setEmpty(); 1020 info.fMargin.setEmpty();
1018 info.fOffset.setZero(); 1021 info.fOffset.setZero();
1019 info.fTileInterval.set(16, 16); 1022 info.fTileInterval.set(16, 16);
1020 factory.reset(SkNEW_ARGS(SkTileGridPictureFactory, (info))); 1023 factory.reset(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
1021 } 1024 } else if (kQuadTree_BbhType == bbhType) {
1022 if (kNone_BbhType != bbhType) { 1025 factory.reset(SkNEW(SkQuadTreePictureFactory));
1023 recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag; 1026 } else if (kRTree_BbhType == bbhType) {
1027 factory.reset(SkNEW(SkRTreePictureFactory));
1024 } 1028 }
1025 SkPictureRecorder recorder(factory); 1029 SkPictureRecorder recorder(factory);
1026 SkCanvas* cv = recorder.beginRecording(width, height, recordFlags); 1030 SkCanvas* cv = recorder.beginRecording(width, height, recordFlags);
1027 cv->scale(scale, scale); 1031 cv->scale(scale, scale);
1028 invokeGM(gm, cv, false, false); 1032 invokeGM(gm, cv, false, false);
1029 return recorder.endRecording(); 1033 return recorder.endRecording();
1030 } 1034 }
1031 1035
1032 static SkPicture* stream_to_new_picture(const SkPicture& src) { 1036 static SkPicture* stream_to_new_picture(const SkPicture& src) {
1033 SkDynamicMemoryWStream storage; 1037 SkDynamicMemoryWStream storage;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 "^ and $ requires an exact match\n" 1446 "^ and $ requires an exact match\n"
1443 "If a test does not match any list entry,\n" 1447 "If a test does not match any list entry,\n"
1444 "it is skipped unless some list entry starts with ~"); 1448 "it is skipped unless some list entry starts with ~");
1445 DEFINE_string(missingExpectationsPath, "", "Write images for tests without expec tations " 1449 DEFINE_string(missingExpectationsPath, "", "Write images for tests without expec tations "
1446 "into this directory."); 1450 "into this directory.");
1447 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to " 1451 DEFINE_string(mismatchPath, "", "Write images for tests that failed due to "
1448 "pixel mismatches into this directory."); 1452 "pixel mismatches into this directory.");
1449 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which " 1453 DEFINE_string(modulo, "", "[--modulo <remainder> <divisor>]: only run tests for which "
1450 "testIndex %% divisor == remainder."); 1454 "testIndex %% divisor == remainder.");
1451 DEFINE_bool(pipe, false, "Exercise the SkGPipe replay test pass."); 1455 DEFINE_bool(pipe, false, "Exercise the SkGPipe replay test pass.");
1456 DEFINE_bool(quadtree, false, "Exercise the QuadTree variant of SkPicture test pa ss.");
1452 DEFINE_string2(readPath, r, "", "Read reference images from this dir, and report " 1457 DEFINE_string2(readPath, r, "", "Read reference images from this dir, and report "
1453 "any differences between those and the newly generated ones."); 1458 "any differences between those and the newly generated ones.");
1454 DEFINE_bool(replay, false, "Exercise the SkPicture replay test pass."); 1459 DEFINE_bool(replay, false, "Exercise the SkPicture replay test pass.");
1455 #if SK_SUPPORT_GPU 1460 #if SK_SUPPORT_GPU
1456 DEFINE_bool(resetGpuContext, false, "Reset the GrContext prior to running each G M."); 1461 DEFINE_bool(resetGpuContext, false, "Reset the GrContext prior to running each G M.");
1457 #endif 1462 #endif
1458 DEFINE_string2(resourcePath, i, "resources", "Directory that stores image resour ces."); 1463 DEFINE_string2(resourcePath, i, "resources", "Directory that stores image resour ces.");
1459 DEFINE_bool(rtree, false, "Exercise the R-Tree variant of SkPicture test pass.") ; 1464 DEFINE_bool(rtree, false, "Exercise the R-Tree variant of SkPicture test pass.") ;
1460 DEFINE_bool(serialize, false, "Exercise the SkPicture serialization & deserializ ation test pass."); 1465 DEFINE_bool(serialize, false, "Exercise the SkPicture serialization & deserializ ation test pass.");
1461 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only."); 1466 DEFINE_bool(simulatePipePlaybackFailure, false, "Simulate a rendering failure in pipe mode only.");
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 // overwriting each other. But we should make sure it doesn't 1605 // overwriting each other. But we should make sure it doesn't
1601 // break anybody. 1606 // break anybody.
1602 SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->getN ame(), 1607 SkString path = gmmain.make_filename(FLAGS_writePicturePath[0], gm->getN ame(),
1603 compareConfig.fName, "", pictureSuf fix); 1608 compareConfig.fName, "", pictureSuf fix);
1604 SkFILEWStream stream(path.c_str()); 1609 SkFILEWStream stream(path.c_str());
1605 pict->serialize(&stream); 1610 pict->serialize(&stream);
1606 } 1611 }
1607 1612
1608 if (FLAGS_rtree) { 1613 if (FLAGS_rtree) {
1609 const char renderModeDescriptor[] = "-rtree"; 1614 const char renderModeDescriptor[] = "-rtree";
1610 if ((gmFlags & GM::kSkipPicture_Flag) || 1615 if ((gmFlags & GM::kSkipPicture_Flag) || (gmFlags & GM::kSkipTiled_Flag) ) {
1611 (gmFlags & GM::kSkipTiled_Flag)) {
1612 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP lusConfig, 1616 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP lusConfig,
1613 renderModeDescriptor); 1617 renderModeDescriptor);
1614 errorsForAllModes.add(kIntentionallySkipped_ErrorType); 1618 errorsForAllModes.add(kIntentionallySkipped_ErrorType);
1615 } else { 1619 } else {
1616 SkPicture* pict = gmmain.generate_new_picture( 1620 SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType, 0) ;
1617 gm, kRTree_BbhType, SkPicture::kOptimizeForClippedPlayback_Recor dingFlag);
1618 SkAutoUnref aur(pict); 1621 SkAutoUnref aur(pict);
1619 SkBitmap bitmap; 1622 SkBitmap bitmap;
1620 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap) ; 1623 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap) ;
1621 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma p( 1624 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma p(
1622 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap , 1625 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap ,
1623 &comparisonBitmap)); 1626 &comparisonBitmap));
1624 } 1627 }
1625 } 1628 }
1626 1629
1630 if (FLAGS_quadtree) {
1631 const char renderModeDescriptor[] = "-quadtree";
1632 if ((gmFlags & GM::kSkipPicture_Flag) || (gmFlags & GM::kSkipTiled_Flag) ) {
1633 gmmain.RecordTestResults(kIntentionallySkipped_ErrorType, shortNameP lusConfig,
1634 renderModeDescriptor);
1635 errorsForAllModes.add(kIntentionallySkipped_ErrorType);
1636 } else {
1637 SkPicture* pict = gmmain.generate_new_picture(gm, kQuadTree_BbhType, 0);
1638 SkAutoUnref aur(pict);
1639 SkBitmap bitmap;
1640 gmmain.generate_image_from_picture(gm, compareConfig, pict, &bitmap) ;
1641 errorsForAllModes.add(gmmain.compare_test_results_to_reference_bitma p(
1642 gm->getName(), compareConfig.fName, renderModeDescriptor, bitmap ,
1643 &comparisonBitmap));
1644 }
1645 }
1646
1627 if (FLAGS_tileGrid) { 1647 if (FLAGS_tileGrid) {
1628 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca leIndex) { 1648 for(int scaleIndex = 0; scaleIndex < tileGridReplayScales.count(); ++sca leIndex) {
1629 SkScalar replayScale = tileGridReplayScales[scaleIndex]; 1649 SkScalar replayScale = tileGridReplayScales[scaleIndex];
1630 SkString renderModeDescriptor("-tilegrid"); 1650 SkString renderModeDescriptor("-tilegrid");
1631 if (SK_Scalar1 != replayScale) { 1651 if (SK_Scalar1 != replayScale) {
1632 renderModeDescriptor += "-scale-"; 1652 renderModeDescriptor += "-scale-";
1633 renderModeDescriptor.appendScalar(replayScale); 1653 renderModeDescriptor.appendScalar(replayScale);
1634 } 1654 }
1635 1655
1636 if ((gmFlags & GM::kSkipPicture_Flag) || 1656 if ((gmFlags & GM::kSkipPicture_Flag) ||
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 if (FLAGS_forceBWtext) { 2457 if (FLAGS_forceBWtext) {
2438 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); 2458 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref();
2439 } 2459 }
2440 } 2460 }
2441 2461
2442 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 2462 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
2443 int main(int argc, char * const argv[]) { 2463 int main(int argc, char * const argv[]) {
2444 return tool_main(argc, (char**) argv); 2464 return tool_main(argc, (char**) argv);
2445 } 2465 }
2446 #endif 2466 #endif
OLDNEW
« no previous file with comments | « dm/DMReplayTask.cpp ('k') | gyp/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698