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

Unified Diff: include/core/SkPicture.h

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder 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
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkPictureRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPicture.h
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 36f531023030d28900408b911e6368add21fc03c..6c0dda0d3e700938d426832b9539ad88a6ba5d56 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -24,6 +24,8 @@ class SkTypefacePlayback;
class SkWStream;
struct SkPictInfo;
+#define SK_SUPPORT_LEGACY_PICTURE_PTR
+
/** \class SkPicture
An SkPicture records drawing commands made to a canvas to be played back at a later time.
@@ -54,7 +56,7 @@ public:
* @return A new SkPicture representing the serialized data, or NULL if the stream is
* invalid.
*/
- static SkPicture* CreateFromStream(SkStream*, InstallPixelRefProc proc);
+ static sk_sp<SkPicture> MakeFromStream(SkStream*, InstallPixelRefProc proc);
/**
* Recreate a picture that was serialized into a stream.
@@ -66,7 +68,7 @@ public:
* @return A new SkPicture representing the serialized data, or NULL if the stream is
* invalid.
*/
- static SkPicture* CreateFromStream(SkStream*);
+ static sk_sp<SkPicture> MakeFromStream(SkStream*);
/**
* Recreate a picture that was serialized into a buffer. If the creation requires bitmap
@@ -76,7 +78,7 @@ public:
* @return A new SkPicture representing the serialized data, or NULL if the buffer is
* invalid.
*/
- static SkPicture* CreateFromBuffer(SkReadBuffer&);
+ static sk_sp<SkPicture> MakeFromBuffer(SkReadBuffer&);
/**
* Subclasses of this can be passed to playback(). During the playback
@@ -167,6 +169,18 @@ public:
static void SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set);
static bool PictureIOSecurityPrecautionsEnabled();
+#ifdef SK_SUPPORT_LEGACY_PICTURE_PTR
+ static SkPicture* CreateFromStream(SkStream* stream, InstallPixelRefProc proc) {
+ return MakeFromStream(stream, proc).release();
+ }
+ static SkPicture* CreateFromStream(SkStream* stream) {
+ return MakeFromStream(stream).release();
+ }
+ static SkPicture* CreateFromBuffer(SkReadBuffer& rbuf) {
+ return MakeFromBuffer(rbuf).release();
+ }
+#endif
+
private:
// Subclass whitelist.
SkPicture();
@@ -175,9 +189,7 @@ private:
template <typename> friend class SkMiniPicture;
void serialize(SkWStream*, SkPixelSerializer*, SkRefCntSet* typefaces) const;
- static SkPicture* CreateFromStream(SkStream*,
- InstallPixelRefProc proc,
- SkTypefacePlayback*);
+ static sk_sp<SkPicture> MakeFromStream(SkStream*, InstallPixelRefProc, SkTypefacePlayback*);
friend class SkPictureData;
virtual int numSlowPaths() const = 0;
@@ -208,7 +220,7 @@ private:
"Remove SkBitmapSourceDeserializer.");
static bool IsValidPictInfo(const SkPictInfo& info);
- static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*);
+ static sk_sp<SkPicture> Forwardport(const SkPictInfo&, const SkPictureData*);
SkPictInfo createHeader() const;
SkPictureData* backport() const;
« no previous file with comments | « include/core/SkCanvas.h ('k') | include/core/SkPictureRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698