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

Unified Diff: src/effects/SkAlphaThresholdFilter.cpp

Issue 1847053004: Update SkAlphaThresholdFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix sample app 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 | « samplecode/SampleFilterFuzz.cpp ('k') | tests/FlattenableFactoryToName.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkAlphaThresholdFilter.cpp
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index 177a3ba5f0a77a4423caec8ec3a6ce04b67a6a43..1c79c45194477f278c62e16282c69559d8aaf4e8 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -6,6 +6,7 @@
*/
#include "SkAlphaThresholdFilter.h"
+
#include "SkBitmap.h"
#include "SkDevice.h"
#include "SkReadBuffer.h"
@@ -18,7 +19,7 @@
class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
public:
SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
- SkScalar outerThreshold, SkImageFilter* input);
+ SkScalar outerThreshold, sk_sp<SkImageFilter> input);
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl)
@@ -49,16 +50,17 @@ static SkScalar pin_0_1(SkScalar x) {
return SkMinScalar(SkMaxScalar(x, 0), 1);
}
-SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
- SkScalar innerThreshold,
- SkScalar outerThreshold,
- SkImageFilter* input) {
+sk_sp<SkImageFilter> SkAlphaThresholdFilter::Make(const SkRegion& region,
+ SkScalar innerThreshold,
+ SkScalar outerThreshold,
+ sk_sp<SkImageFilter> input) {
innerThreshold = pin_0_1(innerThreshold);
outerThreshold = pin_0_1(outerThreshold);
if (!SkScalarIsFinite(innerThreshold) || !SkScalarIsFinite(outerThreshold)) {
return nullptr;
}
- return new SkAlphaThresholdFilterImpl(region, innerThreshold, outerThreshold, input);
+ return sk_sp<SkImageFilter>(new SkAlphaThresholdFilterImpl(region, innerThreshold,
+ outerThreshold, std::move(input)));
}
#if SK_SUPPORT_GPU
@@ -269,14 +271,14 @@ SkFlattenable* SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) {
SkScalar outer = buffer.readScalar();
SkRegion rgn;
buffer.readRegion(&rgn);
- return SkAlphaThresholdFilter::Create(rgn, inner, outer, common.getInput(0).get());
+ return SkAlphaThresholdFilter::Make(rgn, inner, outer, common.getInput(0)).release();
}
SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
SkScalar innerThreshold,
SkScalar outerThreshold,
- SkImageFilter* input)
- : INHERITED(1, &input)
+ sk_sp<SkImageFilter> input)
+ : INHERITED(&input, 1, nullptr)
, fRegion(region)
, fInnerThreshold(innerThreshold)
, fOuterThreshold(outerThreshold) {
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/FlattenableFactoryToName.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698