aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-05-15 14:12:14 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-16 18:53:12 +0000
commitbdf5433ab49b00df7c0f9185a68fc39f74cda409 (patch)
treefec7980683ba47019b3100161c95185bb6ba4294 /src/image
parent94f585ed091e252cd3cc741b19c8a226fe4a5eec (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 'src/image')
-rw-r--r--src/image/SkImage_Base.h4
-rw-r--r--src/image/SkImage_Lazy.cpp11
2 files changed, 15 insertions, 0 deletions
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<SkImage> onMakeSubset(const SkIRect&) const = 0;
+#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE
virtual SkData* onRefEncoded() const { return nullptr; }
+#else
+ virtual sk_sp<SkData> 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<SkColorSpace>*,
SkScalar scaleAdjust[2]) const override;
#endif
+#if SK_IGNORE_SKIMAGE_ONREFENCODED_CHANGE
SkData* onRefEncoded() const override;
+#else
+ sk_sp<SkData> onRefEncoded() const override;
+#endif
sk_sp<SkImage> 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<SkData> SkImage_Lazy::onRefEncoded() const {
+ ScopedGenerator generator(fSharedGenerator);
+ return generator->refEncodedData();
+}
+#endif
bool SkImage_Lazy::getROPixels(SkBitmap* bitmap, SkColorSpace* dstColorSpace,
CachingHint chint) const {