diff options
author | 2013-01-16 18:43:36 +0000 | |
---|---|---|
committer | 2013-01-16 18:43:36 +0000 | |
commit | 20bd04e365ca8f5cdb37068fedd696e783d1a775 (patch) | |
tree | 86a23ba9176b9b42e819046061df071ba97039a7 /gm/gmmain.cpp | |
parent | ca1b3ff63427396c01005f37255fb8c9eb17f910 (diff) |
Turn on the kUsePathBoundsForClip_RecordingFlag in bench, gm and tools that use class PictureRenderer
Chrome uses this flag for recording to skpicture in order to improve performance.
Therefore, skai benchmarks should run with this flag enabled, and we need
gm and render_pictures test coverage to validate it. In gm, the vanilla
SkPicture test step will still run without the flag to ensure that case still gets test
coverage, while the SkPicture test steps that use rtree and tileGrid will now run with
the flag enabled.
Review URL: https://codereview.appspot.com/7111043
git-svn-id: http://skia.googlecode.com/svn/trunk@7234 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/gmmain.cpp')
-rw-r--r-- | gm/gmmain.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp index 573c9dce78..3b8ae5bc5c 100644 --- a/gm/gmmain.cpp +++ b/gm/gmmain.cpp @@ -617,7 +617,8 @@ public: return retval; } - static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, SkScalar scale = SK_Scalar1) { + static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t recordFlags, + SkScalar scale = SK_Scalar1) { // Pictures are refcounted so must be on heap SkPicture* pict; int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().width()), scale)); @@ -628,8 +629,9 @@ public: } else { pict = new SkPicture; } - uint32_t recordFlags = (kNone_BbhType == bbhType) ? - 0 : SkPicture::kOptimizeForClippedPlayback_RecordingFlag; + if (kNone_BbhType != bbhType) { + recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag; + } SkCanvas* cv = pict->beginRecording(width, height, recordFlags); cv->scale(scale, scale); invokeGM(gm, cv, false, false); @@ -1344,7 +1346,7 @@ int tool_main(int argc, char** argv) { ErrorBitfield pictErrors = ERROR_NONE; //SkAutoTUnref<SkPicture> pict(generate_new_picture(gm)); - SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType); + SkPicture* pict = gmmain.generate_new_picture(gm, kNone_BbhType, 0); SkAutoUnref aur(pict); if ((ERROR_NONE == testErrors) && doReplay) { @@ -1387,7 +1389,8 @@ int tool_main(int argc, char** argv) { } if (!(gmFlags & GM::kSkipPicture_Flag) && doRTree) { - SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType); + SkPicture* pict = gmmain.generate_new_picture(gm, kRTree_BbhType, + SkPicture::kUsePathBoundsForClip_RecordingFlag); SkAutoUnref aur(pict); SkBitmap bitmap; gmmain.generate_image_from_picture(gm, compareConfig, pict, @@ -1407,7 +1410,8 @@ int tool_main(int argc, char** argv) { // We record with the reciprocal scale to obtain a replay // result that can be validated against comparisonBitmap. SkScalar recordScale = SkScalarInvert(replayScale); - SkPicture* pict = gmmain.generate_new_picture(gm, kTileGrid_BbhType, recordScale); + SkPicture* pict = gmmain.generate_new_picture(gm, kTileGrid_BbhType, + SkPicture::kUsePathBoundsForClip_RecordingFlag, recordScale); SkAutoUnref aur(pict); SkBitmap bitmap; gmmain.generate_image_from_picture(gm, compareConfig, pict, |