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

Unified Diff: src/effects/SkMagnifierImageFilter.cpp

Issue 1864843002: Update MagnifierImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« fuzz/FilterFuzz.cpp ('K') | « samplecode/SampleFilterFuzz.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMagnifierImageFilter.cpp
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index dfd7f04f6a88231eebf3a5644f009980e9948e72..616aaafcac07ac1abd727b734a939e3217b7ba33 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -232,8 +232,8 @@ void GrMagnifierEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
////////////////////////////////////////////////////////////////////////////////
-SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar inset,
- SkImageFilter* input) {
+sk_sp<SkImageFilter> SkMagnifierImageFilter::Make(const SkRect& srcRect, SkScalar inset,
+ sk_sp<SkImageFilter> input) {
if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
return nullptr;
@@ -242,13 +242,15 @@ SkImageFilter* SkMagnifierImageFilter::Create(const SkRect& srcRect, SkScalar in
if (srcRect.fLeft < 0 || srcRect.fTop < 0) {
return nullptr;
}
- return new SkMagnifierImageFilter(srcRect, inset, input);
+ return sk_sp<SkImageFilter>(new SkMagnifierImageFilter(srcRect, inset, std::move(input)));
}
SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset,
- SkImageFilter* input)
- : INHERITED(1, &input), fSrcRect(srcRect), fInset(inset) {
+ sk_sp<SkImageFilter> input)
+ : INHERITED(&input, 1, nullptr)
+ , fSrcRect(srcRect)
+ , fInset(inset) {
SkASSERT(srcRect.x() >= 0 && srcRect.y() >= 0 && inset >= 0);
}
@@ -285,7 +287,7 @@ sk_sp<SkFlattenable> SkMagnifierImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
SkRect src;
buffer.readRect(&src);
- return sk_sp<SkFlattenable>(Create(src, buffer.readScalar(), common.getInput(0).get()));
+ return Make(src, buffer.readScalar(), common.getInput(0));
}
void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const {
« fuzz/FilterFuzz.cpp ('K') | « samplecode/SampleFilterFuzz.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698