aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-20 20:58:18 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-12-20 20:58:18 +0000
commite5ff3cefe007d092daf9d0bc2b03f9ff87b2c34e (patch)
tree9442d032a8b676b7a8070d544c605f769303b19e /include
parent9d0c6ecb8440e8e546881a4ff850eb6333f24541 (diff)
Implement SkColorFilter::asColorMatrix() virtual, and override in
SkColorMatrixFilter. Implement missing SkColorMatrixFilter::setMatrix() and setArray() functions (were in .h, just not implemented). Add a gm for color matrix filters. Review URL: http://codereview.appspot.com/5500044/ git-svn-id: http://skia.googlecode.com/svn/trunk@2909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkColorFilter.h7
-rw-r--r--include/effects/SkColorMatrixFilter.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index e346996832..6328e706cb 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -23,6 +23,13 @@ public:
*/
virtual bool asColorMode(SkColor* color, SkXfermode::Mode* mode);
+ /**
+ * If the filter can be represented by a 5x4 matrix, this
+ * returns true, and sets the matrix appropriately.
+ * If not, this returns false and ignores the parameter.
+ */
+ virtual bool asColorMatrix(SkScalar matrix[20]);
+
/** Called with a scanline of colors, as if there was a shader installed.
The implementation writes out its filtered version into result[].
Note: shader and result may be the same buffer.
diff --git a/include/effects/SkColorMatrixFilter.h b/include/effects/SkColorMatrixFilter.h
index 32ae7dfd37..d5f87d0659 100644
--- a/include/effects/SkColorMatrixFilter.h
+++ b/include/effects/SkColorMatrixFilter.h
@@ -26,6 +26,7 @@ public:
virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]);
virtual void filterSpan16(const uint16_t src[], int count, uint16_t[]);
virtual uint32_t getFlags();
+ virtual bool asColorMatrix(SkScalar matrix[20]) SK_OVERRIDE;
// overrides for SkFlattenable
virtual void flatten(SkFlattenableWriteBuffer& buffer);