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
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index be3b7be..a406629 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1938,8 +1938,14 @@
} else {
drawState->disableState(GrDrawState::kHWAntialias_StateBit);
}
+ if (paint.fColorMatrixEnabled) {
+ drawState->enableState(GrDrawState::kColorMatrix_StateBit);
+ } else {
+ drawState->disableState(GrDrawState::kColorMatrix_StateBit);
+ }
drawState->setBlendFunc(paint.fSrcBlendCoeff, paint.fDstBlendCoeff);
drawState->setColorFilter(paint.fColorFilterColor, paint.fColorFilterXfermode);
+ drawState->setColorMatrix(paint.fColorMatrix);
if (paint.getActiveMaskStageMask() && !target->canApplyCoverage()) {
GrPrintf("Partial pixel coverage will be incorrectly blended.\n");