diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-12 19:14:06 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-12 19:14:06 +0000 |
commit | 8d21f6c7a9d0cf4f87d77c235c6da7203620c7e5 (patch) | |
tree | df28bf3f40b4f9327736cc0166d0d964c32fe463 /src/core | |
parent | 3bafe74a29c37761082980ed4ee9b831256bd27e (diff) |
When two or more color matrix image filters are connected together, and the non-leaf matrices do not require clamping, we can concatenate their matrices and apply them together.
Review URL: https://codereview.appspot.com/6489054
git-svn-id: http://skia.googlecode.com/svn/trunk@5931 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkImageFilter.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index c688310111..45ad024d45 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -14,19 +14,19 @@ SK_DEFINE_INST_COUNT(SkImageFilter) -SkImageFilter::SkImageFilter(int numInputs, SkImageFilter** inputs) - : fNumInputs(numInputs), fInputs(new SkImageFilter*[numInputs]) { - for (int i = 0; i < numInputs; ++i) { +SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs) + : fInputCount(inputCount), fInputs(new SkImageFilter*[inputCount]) { + for (int i = 0; i < inputCount; ++i) { fInputs[i] = inputs[i]; SkSafeRef(fInputs[i]); } } -SkImageFilter::SkImageFilter(int numInputs, ...) - : fNumInputs(numInputs), fInputs(new SkImageFilter*[numInputs]) { +SkImageFilter::SkImageFilter(int inputCount, ...) + : fInputCount(inputCount), fInputs(new SkImageFilter*[inputCount]) { va_list ap; - va_start(ap, numInputs); - for (int i = 0; i < numInputs; ++i) { + va_start(ap, inputCount); + for (int i = 0; i < inputCount; ++i) { fInputs[i] = va_arg(ap, SkImageFilter*); SkSafeRef(fInputs[i]); } @@ -34,15 +34,15 @@ SkImageFilter::SkImageFilter(int numInputs, ...) } SkImageFilter::~SkImageFilter() { - for (int i = 0; i < fNumInputs; i++) { + for (int i = 0; i < fInputCount; i++) { SkSafeUnref(fInputs[i]); } delete[] fInputs; } SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer) - : fNumInputs(buffer.readInt()), fInputs(new SkImageFilter*[fNumInputs]) { - for (int i = 0; i < fNumInputs; i++) { + : fInputCount(buffer.readInt()), fInputs(new SkImageFilter*[fInputCount]) { + for (int i = 0; i < fInputCount; i++) { if (buffer.readBool()) { fInputs[i] = static_cast<SkImageFilter*>(buffer.readFlattenable()); } else { @@ -52,8 +52,8 @@ SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer) } void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { - buffer.writeInt(fNumInputs); - for (int i = 0; i < fNumInputs; i++) { + buffer.writeInt(fInputCount); + for (int i = 0; i < fInputCount; i++) { SkImageFilter* input = getInput(i); buffer.writeBool(input != NULL); if (input != NULL) { @@ -65,7 +65,7 @@ void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { SkBitmap SkImageFilter::getInputResult(int index, Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, SkIPoint* loc) { - SkASSERT(index < fNumInputs); + SkASSERT(index < fInputCount); SkImageFilter* input = getInput(index); SkBitmap result; if (input && input->filterImage(proxy, src, ctm, &result, loc)) { @@ -118,3 +118,7 @@ bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, bool SkImageFilter::asNewCustomStage(GrCustomStage**, GrTexture*) const { return false; } + +SkColorFilter* SkImageFilter::asColorFilter() const { + return NULL; +} |