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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1877783003: Update DisplacementMapEffect to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug 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
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index aee15ef753b0c9166f4b2224d6c31fff4a011491..b715f6a4f3b5635d65cf0fa4c07eba7962584b72 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -163,27 +163,29 @@ bool channel_selector_type_is_valid(SkDisplacementMapEffect::ChannelSelectorType
///////////////////////////////////////////////////////////////////////////////
-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 @@ sk_sp<SkFlattenable> SkDisplacementMapEffect::CreateProc(SkReadBuffer& buffer) {
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 {
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698