Flip the switch to turn on GrCustomStage implementation of gradients;
remove old implementation, including enums & state on various structs.

http://codereview.appspot.com/6245078/



git-svn-id: http://skia.googlecode.com/svn/trunk@4129 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp
index afbe809..e79afe1 100644
--- a/src/gpu/gl/GrGpuGL_program.cpp
+++ b/src/gpu/gl/GrGpuGL_program.cpp
@@ -7,6 +7,8 @@
 
 #include "GrGpuGL.h"
 
+#include "effects/GrGradientEffects.h"
+
 #include "GrCustomStage.h"
 #include "GrGLProgramStage.h"
 #include "GrGpuVertex.h"
@@ -148,7 +150,6 @@
 // helpers for texture matrices
 
 void GrGpuGL::AdjustTextureMatrix(const GrGLTexture* texture,
-                                  GrSamplerState::SampleMode mode,
                                   GrMatrix* matrix) {
     GrAssert(NULL != texture);
     GrAssert(NULL != matrix);
@@ -200,9 +201,7 @@
             (orientationChange || !hwMatrix.cheapEqualTo(samplerMatrix))) {
 
             GrMatrix m = samplerMatrix;
-            GrSamplerState::SampleMode mode =
-                drawState.getSampler(s).getSampleMode();
-            AdjustTextureMatrix(texture, mode, &m);
+            AdjustTextureMatrix(texture, &m);
 
             // ES doesn't allow you to pass true to the transpose param,
             // so do our own transpose
@@ -251,40 +250,6 @@
     }
 }
 
-void GrGpuGL::flushRadial2(int s) {
-
-    const int &uni = fProgramData->fUniLocations.fStages[s].fRadial2Uni;
-    const GrSamplerState& sampler = this->getDrawState().getSampler(s);
-    if (GrGLProgram::kUnusedUniform != uni &&
-        (fProgramData->fRadial2CenterX1[s] != sampler.getRadial2CenterX1() ||
-         fProgramData->fRadial2Radius0[s]  != sampler.getRadial2Radius0()  ||
-         fProgramData->fRadial2PosRoot[s]  != sampler.isRadial2PosRoot())) {
-
-        GrScalar centerX1 = sampler.getRadial2CenterX1();
-        GrScalar radius0 = sampler.getRadial2Radius0();
-
-        GrScalar a = GrMul(centerX1, centerX1) - GR_Scalar1;
-
-        // when were in the degenerate (linear) case the second
-        // value will be INF but the program doesn't read it. (We
-        // use the same 6 uniforms even though we don't need them
-        // all in the linear case just to keep the code complexity
-        // down).
-        float values[6] = {
-            GrScalarToFloat(a),
-            1 / (2.f * GrScalarToFloat(a)),
-            GrScalarToFloat(centerX1),
-            GrScalarToFloat(radius0),
-            GrScalarToFloat(GrMul(radius0, radius0)),
-            sampler.isRadial2PosRoot() ? 1.f : -1.f
-        };
-        GL_CALL(Uniform1fv(uni, 6, values));
-        fProgramData->fRadial2CenterX1[s] = sampler.getRadial2CenterX1();
-        fProgramData->fRadial2Radius0[s]  = sampler.getRadial2Radius0();
-        fProgramData->fRadial2PosRoot[s]  = sampler.isRadial2PosRoot();
-    }
-}
-
 void GrGpuGL::flushTexelSize(int s) {
     const int& uni = fProgramData->fUniLocations.fStages[s].fNormalizedTexelSizeUni;
     if (GrGLProgram::kUnusedUniform != uni) {
@@ -475,8 +440,6 @@
         if (this->isStageEnabled(s)) {
             this->flushTextureMatrixAndDomain(s);
 
-            this->flushRadial2(s);
-
             this->flushTexelSize(s);
 
             if (NULL != fProgramData->fCustomStage[s]) {
@@ -773,29 +736,6 @@
             } else if (!sampler.getMatrix().hasPerspective()) {
                 stage.fOptFlags |= StageDesc::kNoPerspective_OptFlagBit;
             }
-            switch (sampler.getSampleMode()) {
-                case GrSamplerState::kNormal_SampleMode:
-                    stage.fCoordMapping = StageDesc::kIdentity_CoordMapping;
-                    break;
-                case GrSamplerState::kRadial_SampleMode:
-                    stage.fCoordMapping = StageDesc::kRadialGradient_CoordMapping;
-                    break;
-                case GrSamplerState::kRadial2_SampleMode:
-                    if (sampler.radial2IsDegenerate()) {
-                        stage.fCoordMapping =
-                            StageDesc::kRadial2GradientDegenerate_CoordMapping;
-                    } else {
-                        stage.fCoordMapping =
-                            StageDesc::kRadial2Gradient_CoordMapping;
-                    }
-                    break;
-                case GrSamplerState::kSweep_SampleMode:
-                    stage.fCoordMapping = StageDesc::kSweepGradient_CoordMapping;
-                    break;
-                default:
-                    GrCrash("Unexpected sample mode!");
-                    break;
-            }
 
             switch (sampler.getFilter()) {
                 // these both can use a regular texture2D()
@@ -858,7 +798,6 @@
 
         } else {
             stage.fOptFlags         = 0;
-            stage.fCoordMapping     = (StageDesc::CoordMapping) 0;
             stage.fInConfigFlags    = 0;
             stage.fFetchMode        = (StageDesc::FetchMode) 0;
             stage.fCustomStageKey   = 0;