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 --- src/image/SkImage_Base.h | 4 ++++ src/image/SkImage_Lazy.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/image') diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h index c74a7b97e0..ba89585cf4 100644 --- a/src/image/SkImage_Base.h +++ b/src/image/SkImage_Base.h @@ -76,7 +76,11 @@ public: virtual sk_sp onMakeSubset(const SkIRect&) const = 0; +#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE virtual SkData* onRefEncoded() const { return nullptr; } +#else + virtual sk_sp onRefEncoded() const { return nullptr; } +#endif virtual bool onAsLegacyBitmap(SkBitmap*) const; diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index 9ca9d0d782..c627f2224e 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -85,7 +85,11 @@ public: sk_sp*, SkScalar scaleAdjust[2]) const override; #endif +#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE SkData* onRefEncoded() const override; +#else + sk_sp onRefEncoded() const override; +#endif sk_sp onMakeSubset(const SkIRect&) const override; bool getROPixels(SkBitmap*, SkColorSpace* dstColorSpace, CachingHint) const override; bool onIsLazyGenerated() const override { return true; } @@ -568,10 +572,17 @@ bool SkImage_Lazy::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, siz return false; } +#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE SkData* SkImage_Lazy::onRefEncoded() const { ScopedGenerator generator(fSharedGenerator); return generator->refEncodedData(); } +#else +sk_sp SkImage_Lazy::onRefEncoded() const { + ScopedGenerator generator(fSharedGenerator); + return generator->refEncodedData(); +} +#endif bool SkImage_Lazy::getROPixels(SkBitmap* bitmap, SkColorSpace* dstColorSpace, CachingHint chint) const { -- cgit v1.2.3