diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-03 20:51:57 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-01-03 20:51:57 +0000 |
commit | 50bdad85db2fe6be4d0bf0c5b6473f712b1bdd32 (patch) | |
tree | dd25219722719bd57f8e13336d960e5cd18afeea /include/gpu | |
parent | 31bab3934c773c2bd4c1e5e9ba8eb87c1c623b09 (diff) |
Implement the color matrix filter in Ganesh. Also, fix and enable the color
matrix test slide. This was basically implemented in the same places where
the blending-based color filter was being done. The shader simply does a mat4
matrix multiply and a vec4 add.
Review URL: http://codereview.appspot.com/5489107/
git-svn-id: http://skia.googlecode.com/svn/trunk@2948 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu')
-rw-r--r-- | include/gpu/GrPaint.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h index ace11cc074..f1d74b2860 100644 --- a/include/gpu/GrPaint.h +++ b/include/gpu/GrPaint.h @@ -33,11 +33,13 @@ public: GrBlendCoeff fDstBlendCoeff; bool fAntiAlias; bool fDither; + bool fColorMatrixEnabled; GrColor fColor; GrColor fColorFilterColor; SkXfermode::Mode fColorFilterXfermode; + float fColorMatrix[20]; void setTexture(int i, GrTexture* texture) { GrAssert((unsigned)i < kMaxTextures); @@ -127,6 +129,8 @@ public: fColorFilterColor = paint.fColorFilterColor; fColorFilterXfermode = paint.fColorFilterXfermode; + memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix)); + fColorMatrixEnabled = paint.fColorMatrixEnabled; for (int i = 0; i < kMaxTextures; ++i) { GrSafeUnref(fTextures[i]); @@ -165,6 +169,8 @@ public: void resetColorFilter() { fColorFilterXfermode = SkXfermode::kDst_Mode; fColorFilterColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); + memset(fColorMatrix, 0, sizeof(fColorMatrix)); + fColorMatrixEnabled = false; } bool hasTexture() const { |