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

Unified Diff: include/core/SkPictureRecorder.h

Issue 2106843004: Experiment: add flag for finish-recording to return null (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments from #21 Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPictureRecorder.h
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index 3f0cbcc801690be21002327e8d8ac380ad08dd49..419c01bc881b0ba996b8923dfb46137e8b1a6002 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -33,11 +33,15 @@ public:
enum RecordFlags {
// This flag indicates that, if some BHH is being computed, saveLayer
// information should also be extracted at the same time.
- kComputeSaveLayerInfo_RecordFlag = 0x01,
+ kComputeSaveLayerInfo_RecordFlag = 1 << 0,
// If you call drawPicture() or drawDrawable() on the recording canvas, this flag forces
// that object to playback its contents immediately rather than reffing the object.
- kPlaybackDrawPicture_RecordFlag = 0x02,
+ kPlaybackDrawPicture_RecordFlag = 1 << 1,
liyuqian 2016/07/06 15:39:03 Just curious: is 1 << 1 faster than 0x02? (In case
+ };
+
+ enum FinishFlags {
+ kReturnNullForEmpty_FinishFlag = 1 << 0, // no draw-ops will return nullptr
};
/** Returns the canvas that records the drawing commands.
@@ -72,7 +76,7 @@ public:
* reflect their current state, but will not contain a live reference to the drawables
* themselves.
*/
- sk_sp<SkPicture> finishRecordingAsPicture();
+ sk_sp<SkPicture> finishRecordingAsPicture(uint32_t endFlags = 0);
/**
* Signal that the caller is done recording, and update the cull rect to use for bounding
@@ -83,7 +87,8 @@ public:
* and subsequent culling operations.
* @return the picture containing the recorded content.
*/
- sk_sp<SkPicture> finishRecordingAsPictureWithCull(const SkRect& cullRect);
+ sk_sp<SkPicture> finishRecordingAsPictureWithCull(const SkRect& cullRect,
+ uint32_t endFlags = 0);
/**
* Signal that the caller is done recording. This invalidates the canvas returned by
@@ -95,7 +100,7 @@ public:
* and therefore this drawable will reflect the current state of those nested drawables anytime
* it is drawn or a new picture is snapped from it (by calling drawable->newPictureSnapshot()).
*/
- sk_sp<SkDrawable> finishRecordingAsDrawable();
+ sk_sp<SkDrawable> finishRecordingAsDrawable(uint32_t endFlags = 0);
#ifdef SK_SUPPORT_LEGACY_PICTURE_PTR
SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture() {
« no previous file with comments | « no previous file | src/core/SkPictureRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698