Index: src/effects/SkColorFilterImageFilter.cpp |
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp |
index 908f814b945e2c35a8ff43f6bb1ce2f9c328a6ce..fdf6de7b76daf755f2fea5d49c87a753374e3cb7 100755 |
--- a/src/effects/SkColorFilterImageFilter.cpp |
+++ b/src/effects/SkColorFilterImageFilter.cpp |
@@ -21,12 +21,10 @@ |
return NULL; |
} |
- SkColorFilter* inputCF; |
- if (input && input->asColorFilter(&inputCF)) { |
- // This is an optimization, as it collapses the hierarchy by just combining the two |
- // colorfilters into a single one, which the new imagefilter will wrap. |
- SkAutoUnref autoUnref(inputCF); |
- SkAutoTUnref<SkColorFilter> newCF(SkColorFilter::CreateComposeFilter(cf, inputCF)); |
+ 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)); |
} |
@@ -88,13 +86,10 @@ |
} |
bool SkColorFilterImageFilter::asColorFilter(SkColorFilter** filter) const { |
- if (!this->cropRectIsSet()) { |
- SkASSERT(1 == this->countInputs()); |
- // Since our factory has already performed the collapse optimization, we can assert that |
- // if we have an input, it is *not* also a colorfilter. |
- SkASSERT(!this->getInput(0) || !this->getInput(0)->asColorFilter(NULL)); |
+ if (!cropRectIsSet()) { |
if (filter) { |
- *filter = SkRef(fColorFilter); |
+ *filter = fColorFilter; |
+ fColorFilter->ref(); |
} |
return true; |
} |