diff options
author | 2018-05-15 14:12:14 -0400 | |
---|---|---|
committer | 2018-05-16 18:53:12 +0000 | |
commit | bdf5433ab49b00df7c0f9185a68fc39f74cda409 (patch) | |
tree | fec7980683ba47019b3100161c95185bb6ba4294 /include/core | |
parent | 94f585ed091e252cd3cc741b19c8a226fe4a5eec (diff) |
SkImage::onRefEncoded to return sk_sp.
This changes SkImage::onRefEncoded and downstack calls to return sk_sp.
All of the values returned are already sk_sp, so this just updates the
API. This change is currently behind the new flag
SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE so that Chromium can be updated.
Change-Id: Ic53a88ae23fa8b3b41b84c4abdc4b74e9879da38
Reviewed-on: https://skia-review.googlesource.com/128311
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkData.h | 3 | ||||
-rw-r--r-- | include/core/SkImageGenerator.h | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/core/SkData.h b/include/core/SkData.h index 0622c9f0fa..8eca45095f 100644 --- a/include/core/SkData.h +++ b/include/core/SkData.h @@ -171,9 +171,6 @@ private: // Ensure the unsized delete is called. void operator delete(void* p) { ::operator delete(p); } - // Called the first time someone calls NewEmpty to initialize the singleton. - friend SkData* sk_new_empty_data(); - // shared internal factory static sk_sp<SkData> PrivateNewWithCopy(const void* srcOrNull, size_t length); diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h index 2763ef9c33..6a9919ce1a 100644 --- a/include/core/SkImageGenerator.h +++ b/include/core/SkImageGenerator.h @@ -41,9 +41,15 @@ public: * If non-NULL is returned, the caller is responsible for calling * unref() on the data when it is finished. */ +#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE SkData* refEncodedData() { return this->onRefEncodedData(); } +#else + sk_sp<SkData> refEncodedData() { + return this->onRefEncodedData(); + } +#endif /** * Return the ImageInfo associated with this generator. @@ -174,7 +180,11 @@ protected: SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageUniqueID); +#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE virtual SkData* onRefEncodedData() { return nullptr; } +#else + virtual sk_sp<SkData> onRefEncodedData() { return nullptr; } +#endif virtual bool onGetPixels(const SkImageInfo&, void*, size_t, const Options&) { return false; } virtual bool onIsValid(GrContext*) const { return true; } virtual bool onQueryYUV8(SkYUVSizeInfo*, SkYUVColorSpace*) const { return false; } |