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/core/SkLocalMatrixImageFilter.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/core/SkLocalMatrixImageFilter.cpp')
-rw-r--r-- | src/core/SkLocalMatrixImageFilter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/SkLocalMatrixImageFilter.cpp b/src/core/SkLocalMatrixImageFilter.cpp index 1e50101e01..255ab7686e 100644 --- a/src/core/SkLocalMatrixImageFilter.cpp +++ b/src/core/SkLocalMatrixImageFilter.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkColorSpaceXformer.h" #include "SkLocalMatrixImageFilter.h" #include "SkReadBuffer.h" #include "SkSpecialImage.h" @@ -59,8 +60,11 @@ sk_sp<SkImageFilter> SkLocalMatrixImageFilter::onMakeColorSpace(SkColorSpaceXfor const { SkASSERT(1 == this->countInputs() && this->getInput(0)); - sk_sp<SkImageFilter> input = this->getInput(0)->makeColorSpace(xformer); - return SkLocalMatrixImageFilter::Make(fLocalM, std::move(input)); + auto input = xformer->apply(this->getInput(0)); + if (input.get() != this->getInput(0)) { + return SkLocalMatrixImageFilter::Make(fLocalM, std::move(input)); + } + return this->refMe(); } #ifndef SK_IGNORE_TO_STRING |