aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkImageFilter.h
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-12 19:14:06 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-12 19:14:06 +0000
commit8d21f6c7a9d0cf4f87d77c235c6da7203620c7e5 (patch)
treedf28bf3f40b4f9327736cc0166d0d964c32fe463 /include/core/SkImageFilter.h
parent3bafe74a29c37761082980ed4ee9b831256bd27e (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 'include/core/SkImageFilter.h')
-rw-r--r--include/core/SkImageFilter.h32
1 files changed, 26 insertions, 6 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index f035bf9d37..596da242ac 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -11,6 +11,7 @@
#include "SkFlattenable.h"
class SkBitmap;
+class SkColorFilter;
class SkDevice;
class SkMatrix;
struct SkIPoint;
@@ -108,13 +109,34 @@ public:
*/
virtual GrTexture* onFilterImageGPU(Proxy*, GrTexture* texture, const SkRect& rect);
+ /**
+ * Returns this image filter as a color filter if possible,
+ * NULL otherwise.
+ */
+ virtual SkColorFilter* asColorFilter() const;
+
+ /**
+ * Returns the number of inputs this filter will accept (some inputs can
+ * be NULL).
+ */
+ int countInputs() const { return fInputCount; }
+
+ /**
+ * Returns the input filter at a given index, or NULL if no input is
+ * connected. The indices used are filter-specific.
+ */
+ SkImageFilter* getInput(int i) const {
+ SkASSERT(i < fInputCount);
+ return fInputs[i];
+ }
+
protected:
- SkImageFilter(int numInputs, SkImageFilter** inputs);
+ SkImageFilter(int inputCount, SkImageFilter** inputs);
- // The ... represents numInputs SkImageFilter pointers, upon which this
+ // The ... represents inputCount SkImageFilter pointers, upon which this
// constructor will call SkSafeRef(). This is the same behaviour as
// the SkImageFilter(int, SkImageFilter**) constructor above.
- explicit SkImageFilter(int numInputs, ...);
+ explicit SkImageFilter(int inputCount, ...);
virtual ~SkImageFilter();
@@ -128,8 +150,6 @@ protected:
// Default impl copies src into dst and returns true
virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*);
- int numInputs() const { return fNumInputs; }
- SkImageFilter* getInput(int i) const { SkASSERT(i < fNumInputs); return fInputs[i]; }
// Return the result of processing the given input, or the source bitmap
// if we have no connected input at that index.
SkBitmap getInputResult(int index, Proxy*, const SkBitmap& src, const SkMatrix&,
@@ -137,7 +157,7 @@ protected:
private:
typedef SkFlattenable INHERITED;
- int fNumInputs;
+ int fInputCount;
SkImageFilter** fInputs;
};