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/GrDrawState.h b/src/gpu/GrDrawState.h
index a119115..dfe0d4b 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -455,6 +455,22 @@
     /// @}
 
     ///////////////////////////////////////////////////////////////////////////
+    /// @name Color Matrix
+    ////
+
+    /**
+     * Sets the color matrix to use for the next draw.
+     * @param matrix  the 5x4 matrix to apply to the incoming color
+     */
+    void setColorMatrix(const float matrix[20]) {
+        memcpy(fColorMatrix, matrix, sizeof(fColorMatrix));
+    }
+
+    const float* getColorMatrix() const { return fColorMatrix; }
+
+    /// @}
+
+    ///////////////////////////////////////////////////////////////////////////
     // @name Edge AA
     // There are two ways to perform antialiasing using edge equations. One
     // is to specify an (linear or quadratic) edge eq per-vertex. This requires
@@ -569,6 +585,11 @@
          * source polygon is non-convex.
          */
         kEdgeAAConcave_StateBit = 0x10,
+        /**
+         * Draws will apply the color matrix, otherwise the color matrix is
+         * ignored.
+         */
+        kColorMatrix_StateBit   = 0x20,
 
         // Users of the class may add additional bits to the vector
         kDummyStateBit,
@@ -703,6 +724,7 @@
     GrRenderTarget*         fRenderTarget;
     GrColor                 fColor;
     GrColor                 fColorFilterColor;
+    float                   fColorMatrix[20];
     GrStencilSettings       fStencilSettings;
     GrMatrix                fViewMatrix;
     // @{ Data for GrTesselatedPathRenderer