diff options
author | Mike Reed <reed@google.com> | 2017-07-06 12:32:55 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-06 17:01:16 +0000 |
commit | 6d9f42984d94a2e9116dd951d47cd65cd8f4d401 (patch) | |
tree | 1b0bd5b49fa59188fc0886e1aff4f534cd4e860f /src/effects/SkMatrixConvolutionImageFilter.cpp | |
parent | 674a1848ae62277ea9a2d022b60aa1f17d306f17 (diff) |
only create new instance if needed for colorspacexformer
just an experiment to address performance when imagefilters are cached.
Bug: skia:
Change-Id: Ic1033c897d0a569b46a339fb3ae7f8f961882953
Reviewed-on: https://skia-review.googlesource.com/21395
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/effects/SkMatrixConvolutionImageFilter.cpp')
-rw-r--r-- | src/effects/SkMatrixConvolutionImageFilter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index e92f07247b..b94ece514d 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -8,6 +8,7 @@ #include "SkMatrixConvolutionImageFilter.h" #include "SkBitmap.h" #include "SkColorPriv.h" +#include "SkColorSpaceXformer.h" #include "SkReadBuffer.h" #include "SkSpecialImage.h" #include "SkWriteBuffer.h" @@ -384,14 +385,14 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma sk_sp<SkImageFilter> SkMatrixConvolutionImageFilter::onMakeColorSpace(SkColorSpaceXformer* xformer) const { SkASSERT(1 == this->countInputs()); - if (!this->getInput(0)) { - return sk_ref_sp(const_cast<SkMatrixConvolutionImageFilter*>(this)); - } - sk_sp<SkImageFilter> input = this->getInput(0)->makeColorSpace(xformer); - return SkMatrixConvolutionImageFilter::Make(fKernelSize, fKernel, fGain, fBias, fKernelOffset, - fTileMode, fConvolveAlpha, std::move(input), - this->getCropRectIfSet()); + sk_sp<SkImageFilter> input = xformer->apply(this->getInput(0)); + if (input.get() != this->getInput(0)) { + return SkMatrixConvolutionImageFilter::Make(fKernelSize, fKernel, fGain, fBias, + fKernelOffset, fTileMode, fConvolveAlpha, + std::move(input), this->getCropRectIfSet()); + } + return this->refMe(); } SkIRect SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm, |