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

Unified Diff: include/effects/SkImageSource.h

Issue 1842243002: Update SkImageSource to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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 | « gm/xfermodeimagefilter.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkImageSource.h
diff --git a/include/effects/SkImageSource.h b/include/effects/SkImageSource.h
index c18e2e57b5e579f817f04b2ab1638578d206b8e2..0b4fecd776e365f6889ae2b4078a972afa24bf4d 100644
--- a/include/effects/SkImageSource.h
+++ b/include/effects/SkImageSource.h
@@ -13,17 +13,43 @@
class SK_API SkImageSource : public SkImageFilter {
public:
- static SkImageFilter* Create(SkImage*);
- static SkImageFilter* Create(SkImage*,
- const SkRect& srcRect,
- const SkRect& dstRect,
- SkFilterQuality);
+ static sk_sp<SkImageFilter> Make(sk_sp<SkImage> image) {
+ if (!image) {
+ return nullptr;
+ }
+
+ return sk_sp<SkImageFilter>(new SkImageSource(std::move(image)));
+ }
+ static sk_sp<SkImageFilter> Make(sk_sp<SkImage> image,
+ const SkRect& srcRect,
+ const SkRect& dstRect,
+ SkFilterQuality filterQuality) {
+ if (!image) {
+ return nullptr;
+ }
+
+ return sk_sp<SkImageFilter>(new SkImageSource(std::move(image),
+ srcRect, dstRect,
+ filterQuality));
+ }
SkRect computeFastBounds(const SkRect& src) const override;
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageSource)
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
+ static SkImageFilter* Create(SkImage* image) {
+ return Make(sk_ref_sp<SkImage>(image)).release();
+ }
+ static SkImageFilter* Create(SkImage* image,
+ const SkRect& srcRect,
+ const SkRect& dstRect,
+ SkFilterQuality filterQuality) {
+ return Make(sk_ref_sp<SkImage>(image), srcRect, dstRect, filterQuality).release();
+ }
+#endif
+
protected:
void flatten(SkWriteBuffer&) const override;
@@ -31,8 +57,8 @@ protected:
SkIPoint* offset) const override;
private:
- explicit SkImageSource(SkImage*);
- SkImageSource(SkImage*,
+ explicit SkImageSource(sk_sp<SkImage>);
+ SkImageSource(sk_sp<SkImage>,
const SkRect& srcRect,
const SkRect& dstRect,
SkFilterQuality);
« no previous file with comments | « gm/xfermodeimagefilter.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698