Update DisplacementMapEffect to sk_sp
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1877783003
Committed: https://skia.googlesource.com/skia/+/a53011ef44705a091a8e24f7ea289a3f9ad759f2
Review URL: https://codereview.chromium.org/1877783003
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index aee15ef..b715f6a 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -163,27 +163,29 @@
///////////////////////////////////////////////////////////////////////////////
-SkImageFilter* SkDisplacementMapEffect::Create(ChannelSelectorType xChannelSelector,
- ChannelSelectorType yChannelSelector,
- SkScalar scale,
- SkImageFilter* displacement,
- SkImageFilter* color,
- const CropRect* cropRect) {
+sk_sp<SkImageFilter> SkDisplacementMapEffect::Make(ChannelSelectorType xChannelSelector,
+ ChannelSelectorType yChannelSelector,
+ SkScalar scale,
+ sk_sp<SkImageFilter> displacement,
+ sk_sp<SkImageFilter> color,
+ const CropRect* cropRect) {
if (!channel_selector_type_is_valid(xChannelSelector) ||
!channel_selector_type_is_valid(yChannelSelector)) {
return nullptr;
}
- SkImageFilter* inputs[2] = { displacement, color };
- return new SkDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, inputs, cropRect);
+ sk_sp<SkImageFilter> inputs[2] = { std::move(displacement), std::move(color) };
+ return sk_sp<SkImageFilter>(new SkDisplacementMapEffect(xChannelSelector,
+ yChannelSelector,
+ scale, inputs, cropRect));
}
SkDisplacementMapEffect::SkDisplacementMapEffect(ChannelSelectorType xChannelSelector,
ChannelSelectorType yChannelSelector,
SkScalar scale,
- SkImageFilter* inputs[2],
+ sk_sp<SkImageFilter> inputs[2],
const CropRect* cropRect)
- : INHERITED(2, inputs, cropRect)
+ : INHERITED(inputs, 2, cropRect)
, fXChannelSelector(xChannelSelector)
, fYChannelSelector(yChannelSelector)
, fScale(scale) {
@@ -197,8 +199,9 @@
ChannelSelectorType xsel = (ChannelSelectorType)buffer.readInt();
ChannelSelectorType ysel = (ChannelSelectorType)buffer.readInt();
SkScalar scale = buffer.readScalar();
- return sk_sp<SkFlattenable>(Create(xsel, ysel, scale, common.getInput(0).get(),
- common.getInput(1).get(), &common.cropRect()));
+ return Make(xsel, ysel, scale,
+ common.getInput(0), common.getInput(1),
+ &common.cropRect());
}
void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const {