Chromium Code Reviews| Index: src/effects/SkColorFilterImageFilter.cpp |
| diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp |
| index fdf6de7b76daf755f2fea5d49c87a753374e3cb7..94a5650f559e7431659933b66c4779f9934be587 100755 |
| --- a/src/effects/SkColorFilterImageFilter.cpp |
| +++ b/src/effects/SkColorFilterImageFilter.cpp |
| @@ -21,13 +21,11 @@ SkColorFilterImageFilter* SkColorFilterImageFilter::Create(SkColorFilter* cf, |
| return NULL; |
| } |
| - SkColorFilter* inputColorFilter; |
| - if (input && input->asColorFilter(&inputColorFilter)) { |
| - SkAutoUnref autoUnref(inputColorFilter); |
| - SkAutoTUnref<SkColorFilter> newCF(cf->newComposed(inputColorFilter)); |
| - if (newCF) { |
| - return SkNEW_ARGS(SkColorFilterImageFilter, (newCF, input->getInput(0), cropRect, 0)); |
| - } |
| + SkColorFilter* inputCF; |
| + if (input && input->asColorFilter(&inputCF)) { |
| + SkAutoUnref autoUnref(inputCF); |
| + SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf, inputCF)); |
| + return SkNEW_ARGS(SkColorFilterImageFilter, (newCF, input->getInput(0), cropRect, 0)); |
| } |
| return SkNEW_ARGS(SkColorFilterImageFilter, (cf, input, cropRect, uniqueID)); |
| @@ -86,10 +84,22 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc |
| } |
| bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { |
| - if (!cropRectIsSet()) { |
| + if (!this->cropRectIsSet()) { |
| + SkASSERT(1 == this->countInputs()); |
| + if (this->getInput(0)) { |
| + SkColorFilter* inputCF; |
| + if (this->getInput(0)->asColorFilter(&inputCF)) { |
| + if (filter) { |
| + *filter = SkColorFilter::CreateComposeFilter(fColorFilter, inputCF); |
|
Stephen White
2015/03/04 15:01:52
I don't understand the need to call this here as w
reed1
2015/03/04 15:49:01
Ah, perhaps so. In that case I could instead add a
Stephen White
2015/03/04 16:06:56
It might have a crop rect. I suppose we could asse
|
| + } |
| + inputCF->unref(); |
| + return true; |
| + } |
| + // we have an input but it isn't another colorfilter, so we have to report false. |
| + return false; |
| + } |
| if (filter) { |
| - *filter = fColorFilter; |
| - fColorFilter->ref(); |
| + *filter = SkRef(fColorFilter); |
| } |
| return true; |
| } |