Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index 06076c6891101e4f6c4cd71b94fb40ab61f0e3c8..e999d3aebb3ef885b0ea82926a11eb7319c76190 100644 |
--- a/src/core/SkImageFilter.cpp |
+++ b/src/core/SkImageFilter.cpp |
@@ -158,6 +158,22 @@ bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) { |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
+SkImageFilter::SkImageFilter(sk_sp<SkImageFilter>* inputs, |
+ int inputCount, |
+ const CropRect* cropRect) |
+ : fInputCount(inputCount), |
+ fInputs(new SkImageFilter*[inputCount]), |
+ fUsesSrcInput(false), |
+ fCropRect(cropRect ? *cropRect : CropRect(SkRect(), 0x0)), |
+ fUniqueID(next_image_filter_unique_id()) { |
+ for (int i = 0; i < inputCount; ++i) { |
+ if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) { |
+ fUsesSrcInput = true; |
+ } |
+ fInputs[i] = SkSafeRef(inputs[i].get()); |
+ } |
+} |
+ |
SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRect) |
: fInputCount(inputCount), |
fInputs(new SkImageFilter*[inputCount]), |
@@ -168,8 +184,7 @@ SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const CropR |
if (nullptr == inputs[i] || inputs[i]->usesSrcInput()) { |
fUsesSrcInput = true; |
} |
- fInputs[i] = inputs[i]; |
- SkSafeRef(fInputs[i]); |
+ fInputs[i] = SkSafeRef(inputs[i]); |
} |
} |
@@ -556,11 +571,12 @@ SkImageFilter* SkImageFilter::CreateMatrixFilter(const SkMatrix& matrix, |
return SkMatrixImageFilter::Create(matrix, filterQuality, input); |
} |
-SkImageFilter* SkImageFilter::newWithLocalMatrix(const SkMatrix& matrix) const { |
+sk_sp<SkImageFilter> SkImageFilter::makeWithLocalMatrix(const SkMatrix& matrix) const { |
// SkLocalMatrixImageFilter takes SkImage* in its factory, but logically that parameter |
// is *always* treated as a const ptr. Hence the const-cast here. |
// |
- return SkLocalMatrixImageFilter::Create(matrix, const_cast<SkImageFilter*>(this)); |
+ SkImageFilter* nonConstThis = const_cast<SkImageFilter*>(this); |
+ return SkLocalMatrixImageFilter::Make(matrix, sk_ref_sp<SkImageFilter>(nonConstThis)); |
} |
sk_sp<SkSpecialImage> SkImageFilter::filterInput(int index, |