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

Unified Diff: include/effects/SkMergeImageFilter.h

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To 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 | « include/core/SkImageFilter.h ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkMergeImageFilter.h
diff --git a/include/effects/SkMergeImageFilter.h b/include/effects/SkMergeImageFilter.h
index 3bf649d97ded9c0e8412f905d6f773f955eb528f..e85cc1f97fd45a8aadd134b28f0b482a1ff9a56a 100644
--- a/include/effects/SkMergeImageFilter.h
+++ b/include/effects/SkMergeImageFilter.h
@@ -16,30 +16,51 @@ class SK_API SkMergeImageFilter : public SkImageFilter {
public:
~SkMergeImageFilter() override;
- static SkImageFilter* Create(SkImageFilter* first, SkImageFilter* second,
- SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
- const CropRect* cropRect = NULL) {
- SkImageFilter* inputs[2] = { first, second };
+ static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> first, sk_sp<SkImageFilter> second,
+ SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+ const CropRect* cropRect = nullptr) {
+ sk_sp<SkImageFilter> inputs[2] = { first, second };
SkXfermode::Mode modes[2] = { mode, mode };
- return new SkMergeImageFilter(inputs, 2, modes, cropRect);
+ return sk_sp<SkImageFilter>(new SkMergeImageFilter(inputs, 2, modes, cropRect));
}
- static SkImageFilter* Create(SkImageFilter* filters[], int count,
- const SkXfermode::Mode modes[] = NULL,
- const CropRect* cropRect = NULL) {
- return new SkMergeImageFilter(filters, count, modes, cropRect);
+ static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> filters[],
+ int count,
+ const SkXfermode::Mode modes[] = nullptr,
+ const CropRect* cropRect = nullptr) {
+ return sk_sp<SkImageFilter>(new SkMergeImageFilter(filters, count, modes, cropRect));
}
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
+ static SkImageFilter* Create(SkImageFilter* first, SkImageFilter* second,
+ SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
+ const CropRect* cropRect = nullptr) {
+ return Make(sk_ref_sp<SkImageFilter>(first),
+ sk_ref_sp<SkImageFilter>(second),
+ mode, cropRect).release();
+ }
+
+ static SkImageFilter* Create(SkImageFilter* filters[], int count,
+ const SkXfermode::Mode modes[] = nullptr,
+ const CropRect* cropRect = nullptr) {
+ SkAutoTDeleteArray<sk_sp<SkImageFilter>> temp(new sk_sp<SkImageFilter>[count]);
+ for (int i = 0; i < count; ++i) {
+ temp[i] = sk_ref_sp<SkImageFilter>(filters[i]);
+ }
+ return Make(temp.get(), count, modes, cropRect).release();
+ }
+#endif
+
protected:
void flatten(SkWriteBuffer&) const override;
sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
SkIPoint* offset) const override;
private:
- SkMergeImageFilter(SkImageFilter* filters[], int count, const SkXfermode::Mode modes[],
+ SkMergeImageFilter(sk_sp<SkImageFilter> filters[], int count, const SkXfermode::Mode modes[],
const CropRect* cropRect);
uint8_t* fModes; // SkXfermode::Mode
« no previous file with comments | « include/core/SkImageFilter.h ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698