From bdf5433ab49b00df7c0f9185a68fc39f74cda409 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 15 May 2018 14:12:14 -0400 Subject: 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 Commit-Queue: Ben Wagner --- include/core/SkData.h | 3 --- include/core/SkImageGenerator.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'include/core') 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 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 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 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; } -- cgit v1.2.3