GrCustomStage Renaming Part 2

GrSamplerState member rename
GrCustomStageUnitTest rename
some comment updates
Review URL: https://codereview.appspot.com/6771043

git-svn-id: http://skia.googlecode.com/svn/trunk@6078 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 9aad700..dcb5d8b 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -676,10 +676,10 @@
      * Save/restore the view-matrix in the context. It can optionally adjust a paint to account
      * for a coordinate system change. Here is an example of how the paint param can be used:
      *
-     * A GrPaint is setup with custom stages. The stages will have access to the pre-matrix source
+     * A GrPaint is setup with GrEffects. The stages will have access to the pre-matrix source
      * geometry positions when the draw is executed. Later on a decision is made to transform the
-     * geometry to device space on the CPU. The custom stages now need to know that the space in
-     * which the geometry will be specified has changed.
+     * geometry to device space on the CPU. The effects now need to know that the space in which
+     * the geometry will be specified has changed.
      *
      * Note that when restore is called (or in the destructor) the context's matrix will be
      * restored. However, the paint will not be restored. The caller must make a copy of the
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index 7ea5cd5..c5af2b9 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -11,7 +11,7 @@
 #include "GrRefCnt.h"
 #include "GrNoncopyable.h"
 #include "GrProgramStageFactory.h"
-#include "GrCustomStageUnitTest.h"
+#include "GrEffectUnitTest.h"
 #include "GrTextureAccess.h"
 
 class GrContext;
@@ -61,7 +61,7 @@
      */
     virtual const GrProgramStageFactory& getFactory() const = 0;
 
-    /** Returns true if the other custom stage will generate identical output.
+    /** Returns true if the other effect will generate identical output.
         Must only be called if the two are already known to be of the
         same type (i.e.  they return the same value from getFactory()).
 
diff --git a/include/gpu/GrCustomStageUnitTest.h b/include/gpu/GrEffectUnitTest.h
similarity index 95%
rename from include/gpu/GrCustomStageUnitTest.h
rename to include/gpu/GrEffectUnitTest.h
index 427c1e6..c18bdd0 100644
--- a/include/gpu/GrCustomStageUnitTest.h
+++ b/include/gpu/GrEffectUnitTest.h
@@ -5,14 +5,14 @@
  * found in the LICENSE file.
  */
 
-#ifndef GrCustomStageUnitTest_DEFINED
-#define GrCustomStageUnitTest_DEFINED
+#ifndef GrEffectUnitTest_DEFINED
+#define GrEffectUnitTest_DEFINED
 
 #include "SkRandom.h"
 #include "GrNoncopyable.h"
 #include "SkTArray.h"
 
-namespace GrCustomStageUnitTest {
+namespace GrEffectUnitTest {
 // Used to access the dummy textures in TestCreate procs.
 enum {
     kSkiaPMTextureIdx = 0,
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index b481955..4b2d3cd 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -127,7 +127,7 @@
 
     bool isColorStageEnabled(int i) const {
         GrAssert((unsigned)i < kMaxColorStages);
-        return (NULL != fColorSamplers[i].getCustomStage());
+        return (NULL != fColorSamplers[i].getEffect());
     }
 
     /**
@@ -146,7 +146,7 @@
 
     bool isCoverageStageEnabled(int i) const {
         GrAssert((unsigned)i < kMaxCoverageStages);
-        return (NULL != fCoverageSamplers[i].getCustomStage());
+        return (NULL != fCoverageSamplers[i].getEffect());
     }
 
     bool hasCoverageStage() const {
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h
index 98ca51d..a70b383 100644
--- a/include/gpu/GrSamplerState.h
+++ b/include/gpu/GrSamplerState.h
@@ -21,28 +21,28 @@
 public:
 
     GrSamplerState()
-    : fCustomStage (NULL) {
+    : fEffect (NULL) {
         GR_DEBUGCODE(fSavedCoordChangeCnt = 0;)
     }
 
     ~GrSamplerState() {
-        GrSafeUnref(fCustomStage);
+        GrSafeUnref(fEffect);
         GrAssert(0 == fSavedCoordChangeCnt);
     }
 
     bool operator ==(const GrSamplerState& other) const {
-        // first handle cases where one or the other has no custom stage
-        if (NULL == fCustomStage) {
-            return NULL == other.fCustomStage;
-        } else if (NULL == other.fCustomStage) {
+        // first handle cases where one or the other has no effect
+        if (NULL == fEffect) {
+            return NULL == other.fEffect;
+        } else if (NULL == other.fEffect) {
             return false;
         }
 
-        if (fCustomStage->getFactory() != other.fCustomStage->getFactory()) {
+        if (fEffect->getFactory() != other.fEffect->getFactory()) {
             return false;
         }
 
-        if (!fCustomStage->isEqual(*other.fCustomStage)) {
+        if (!fEffect->isEqual(*other.fEffect)) {
             return false;
         }
 
@@ -52,8 +52,8 @@
     bool operator !=(const GrSamplerState& s) const { return !(*this == s); }
 
     GrSamplerState& operator =(const GrSamplerState& other) {
-        GrSafeAssign(fCustomStage, other.fCustomStage);
-        if (NULL != fCustomStage) {
+        GrSafeAssign(fEffect, other.fEffect);
+        if (NULL != fEffect) {
             fMatrix = other.fMatrix;
             fCoordChangeMatrix = other.fCoordChangeMatrix;
         }
@@ -70,22 +70,22 @@
     class SavedCoordChange {
     private:
         GrMatrix fCoordChangeMatrix;
-        GR_DEBUGCODE(mutable SkAutoTUnref<GrEffect> fCustomStage;)
+        GR_DEBUGCODE(mutable SkAutoTUnref<GrEffect> fEffect;)
 
         friend class GrSamplerState;
     };
 
     /**
      * This gets the current coordinate system change. It is the accumulation of
-     * preConcatCoordChange calls since the custom stage was installed. It is used when then caller
+     * preConcatCoordChange calls since the effect was installed. It is used when then caller
      * wants to temporarily change the source geometry coord system, draw something, and then
      * restore the previous coord system (e.g. temporarily draw in device coords).s
      */
     void saveCoordChange(SavedCoordChange* savedCoordChange) const {
         savedCoordChange->fCoordChangeMatrix = fCoordChangeMatrix;
-        GrAssert(NULL == savedCoordChange->fCustomStage.get());
-        GR_DEBUGCODE(GrSafeRef(fCustomStage);)
-        GR_DEBUGCODE(savedCoordChange->fCustomStage.reset(fCustomStage);)
+        GrAssert(NULL == savedCoordChange->fEffect.get());
+        GR_DEBUGCODE(GrSafeRef(fEffect);)
+        GR_DEBUGCODE(savedCoordChange->fEffect.reset(fEffect);)
         GR_DEBUGCODE(++fSavedCoordChangeCnt);
     }
 
@@ -94,9 +94,9 @@
      */
     void restoreCoordChange(const SavedCoordChange& savedCoordChange) {
         fCoordChangeMatrix = savedCoordChange.fCoordChangeMatrix;
-        GrAssert(savedCoordChange.fCustomStage.get() == fCustomStage);
+        GrAssert(savedCoordChange.fEffect.get() == fEffect);
         GR_DEBUGCODE(--fSavedCoordChangeCnt);
-        GR_DEBUGCODE(savedCoordChange.fCustomStage.reset(NULL);)
+        GR_DEBUGCODE(savedCoordChange.fEffect.reset(NULL);)
     }
 
     /**
@@ -114,31 +114,31 @@
     }
 
     void reset() {
-        GrSafeSetNull(fCustomStage);
+        GrSafeSetNull(fEffect);
     }
 
-    GrEffect* setCustomStage(GrEffect* stage) {
+    GrEffect* setEffect(GrEffect* effect) {
         GrAssert(0 == fSavedCoordChangeCnt);
-        GrSafeAssign(fCustomStage, stage);
+        GrSafeAssign(fEffect, effect);
         fMatrix.reset();
         fCoordChangeMatrix.reset();
-        return stage;
+        return effect;
     }
 
-    GrEffect* setCustomStage(GrEffect* stage, const GrMatrix& matrix) {
+    GrEffect* setEffect(GrEffect* effect, const GrMatrix& matrix) {
         GrAssert(0 == fSavedCoordChangeCnt);
-        GrSafeAssign(fCustomStage, stage);
+        GrSafeAssign(fEffect, effect);
         fMatrix = matrix;
         fCoordChangeMatrix.reset();
-        return stage;
+        return effect;
     }
 
-    const GrEffect* getCustomStage() const { return fCustomStage; }
+    const GrEffect* getEffect() const { return fEffect; }
 
 private:
     GrMatrix            fCoordChangeMatrix;
     GrMatrix            fMatrix; // TODO: remove this, store in GrEffect
-    GrEffect*           fCustomStage;
+    GrEffect*           fEffect;
 
     GR_DEBUGCODE(mutable int fSavedCoordChangeCnt;)
 };