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

Unified Diff: include/core/SkPictureRecorder.h

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
Index: include/core/SkPictureRecorder.h
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index 6f95860b70afbdacbebc9507de1d9798676b2fb4..3f0cbcc801690be21002327e8d8ac380ad08dd49 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -72,7 +72,7 @@ public:
* reflect their current state, but will not contain a live reference to the drawables
* themselves.
*/
- SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture();
+ sk_sp<SkPicture> finishRecordingAsPicture();
/**
* Signal that the caller is done recording, and update the cull rect to use for bounding
@@ -83,7 +83,7 @@ public:
* and subsequent culling operations.
* @return the picture containing the recorded content.
*/
- SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRect);
+ sk_sp<SkPicture> finishRecordingAsPictureWithCull(const SkRect& cullRect);
/**
* Signal that the caller is done recording. This invalidates the canvas returned by
@@ -95,10 +95,20 @@ 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()).
*/
- SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable();
+ sk_sp<SkDrawable> finishRecordingAsDrawable();
- // Legacy API -- use endRecordingAsPicture instead.
+#ifdef SK_SUPPORT_LEGACY_PICTURE_PTR
+ SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture() {
+ return this->finishRecordingAsPicture().release();
+ }
+ SkPicture* SK_WARN_UNUSED_RESULT endRecordingAsPicture(const SkRect& cullRect) {
+ return this->finishRecordingAsPictureWithCull(cullRect).release();
+ }
+ SkDrawable* SK_WARN_UNUSED_RESULT endRecordingAsDrawable() {
+ return this->finishRecordingAsDrawable().release();
+ }
SkPicture* SK_WARN_UNUSED_RESULT endRecording() { return this->endRecordingAsPicture(); }
+#endif
private:
void reset();

Powered by Google App Engine
This is Rietveld 408576698