Chromium Code Reviews| Index: src/core/SkImageFilter.cpp |
| diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
| index 62509c52be1448718daf08fc01b24da7af9c8e23..fe7d9eec38b432253670a31b039e95b5e7493417 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_sp<SkImageFilter>(SkRef(nonConstThis))); |
|
f(malita)
2016/03/29 18:10:06
Nit: sk_ref_sp(nonConstThis)?
robertphillips
2016/03/29 19:31:40
Done.
|
| } |
| sk_sp<SkSpecialImage> SkImageFilter::filterInput(int index, |