Prep #1 for making GrDrawState a class

Review URL: http://codereview.appspot.com/5437138/




git-svn-id: http://skia.googlecode.com/svn/trunk@2808 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index eafe9eb..e306b67 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -601,7 +601,7 @@
 
 }
 
-bool GrAAHairLinePathRenderer::createGeom(GrDrawTarget::StageBitfield stages) {
+bool GrAAHairLinePathRenderer::createGeom(GrDrawState::StageMask stageMask) {
 
     int rtHeight = fTarget->getRenderTarget()->height();
 
@@ -616,7 +616,7 @@
     // If none of the inputs that affect generation of path geometry have
     // have changed since last previous path draw then we can reuse the
     // previous geoemtry.
-    if (stages == fPreviousStages &&
+    if (stageMask == fPreviousStages &&
         fPreviousViewMatrix == fTarget->getViewMatrix() &&
         fPreviousTranslate == fTranslate &&
         rtHeight == fPreviousRTHeight &&
@@ -626,7 +626,7 @@
 
     GrVertexLayout layout = GrDrawTarget::kEdge_VertexLayoutBit;
     for (int s = 0; s < GrDrawState::kNumStages; ++s) {
-        if ((1 << s) & stages) {
+        if ((1 << s) & stageMask) {
             layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
         }
     }
@@ -671,7 +671,7 @@
         add_quads(&quads[3*i], qSubdivs[i], toDevice, toSrc, &verts);
     }
 
-    fPreviousStages = stages;
+    fPreviousStages = stageMask;
     fPreviousViewMatrix = fTarget->getViewMatrix();
     fPreviousRTHeight = rtHeight;
     fClipRect = clip;
@@ -679,9 +679,9 @@
     return true;
 }
 
-void GrAAHairLinePathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
+void GrAAHairLinePathRenderer::drawPath(GrDrawState::StageMask stageMask) {
 
-    if (!this->createGeom(stages)) {
+    if (!this->createGeom(stageMask)) {
         return;
     }
 
@@ -690,7 +690,7 @@
         asr.set(fTarget);
         GrMatrix ivm;
         if (fTarget->getViewInverse(&ivm)) {
-            fTarget->preConcatSamplerMatrices(stages, ivm);
+            fTarget->preConcatSamplerMatrices(stageMask, ivm);
         }
         fTarget->setViewMatrix(GrMatrix::I());
     }
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index 1d561fa..3b29919 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -21,7 +21,7 @@
                              const SkPath& path,
                              GrPathFill fill,
                              bool antiAlias) const  SK_OVERRIDE;
-    virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
+    virtual void drawPath(GrDrawState::StageMask stages) SK_OVERRIDE;
 
 protected:
 
@@ -35,13 +35,13 @@
                              const GrIndexBuffer* fLinesIndexBuffer,
                              const GrIndexBuffer* fQuadsIndexBuffer);
 
-    bool createGeom(GrDrawTarget::StageBitfield stages);
+    bool createGeom(GrDrawState::StageMask stages);
 
     const GrIndexBuffer*        fLinesIndexBuffer;
     const GrIndexBuffer*        fQuadsIndexBuffer;
 
     // have to recreate geometry if stages in use changes :(
-    GrDrawTarget::StageBitfield fPreviousStages;
+    GrDrawState::StageMask      fPreviousStages;
     int                         fPreviousRTHeight;
     SkVector                    fPreviousTranslate;
     GrIRect                     fClipRect;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 9f82a15..335b9f4 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1551,7 +1551,7 @@
     }
 
     GrPathRenderer::AutoClearPath arp(pr, target, &path, fill, prAA, translate);
-    GrDrawTarget::StageBitfield stageMask = paint.getActiveStageMask();
+    GrDrawState::StageMask stageMask = paint.getActiveStageMask();
 
     if (doOSAA) {
         bool needsStencil = pr->requiresStencilPass(target, path, fill);
@@ -1925,7 +1925,7 @@
         int s = i + GrPaint::kFirstTextureStage;
         target->setTexture(s, paint.getTexture(i));
         ASSERT_OWNED_RESOURCE(paint.getTexture(i));
-        target->setSamplerState(s, *paint.getTextureSampler(i));
+        target->setSamplerState(s, paint.getTextureSampler(i));
     }
 
     target->setFirstCoverageStage(GrPaint::kFirstMaskStage);
@@ -1934,7 +1934,7 @@
         int s = i + GrPaint::kFirstMaskStage;
         target->setTexture(s, paint.getMask(i));
         ASSERT_OWNED_RESOURCE(paint.getMask(i));
-        target->setSamplerState(s, *paint.getMaskSampler(i));
+        target->setSamplerState(s, paint.getMaskSampler(i));
     }
 
     target->setColor(paint.fColor);
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index b9d9360..197ee06 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -227,8 +227,8 @@
     *((*indices)++) = edgeV0Idx + 1;
 }
 
-bool GrDefaultPathRenderer::createGeom(GrScalar srcSpaceTol, 
-                                       GrDrawTarget::StageBitfield stages) {
+bool GrDefaultPathRenderer::createGeom(GrScalar srcSpaceTol,
+                                       GrDrawState::StageMask stageMask) {
     {
     SK_TRACE_EVENT0("GrDefaultPathRenderer::createGeom");
 
@@ -246,7 +246,7 @@
 
     GrVertexLayout layout = 0;
     for (int s = 0; s < GrDrawState::kNumStages; ++s) {
-        if ((1 << s) & stages) {
+        if ((1 << s) & stageMask) {
             layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
         }
     }
@@ -377,11 +377,11 @@
     // setPath/clearPath block we won't assume geom was created on a subsequent
     // drawPath in the same block.
     fPreviousSrcTol = srcSpaceTol;
-    fPreviousStages = stages;
+    fPreviousStages = stageMask;
     return true;
 }
 
-void GrDefaultPathRenderer::onDrawPath(GrDrawTarget::StageBitfield stages,
+void GrDefaultPathRenderer::onDrawPath(GrDrawState::StageMask stageMask,
                                        bool stencilOnly) {
 
     GrMatrix viewM = fTarget->getViewMatrix();
@@ -397,8 +397,8 @@
     // won't change the stages in use inside a setPath / removePath pair. But
     // it is a silly limitation of the GrDrawTarget design that should be fixed.
     if (tol != fPreviousSrcTol ||
-        stages != fPreviousStages) {
-        if (!this->createGeom(tol, stages)) {
+        stageMask != fPreviousStages) {
+        if (!this->createGeom(tol, stageMask)) {
             return;
         }
     }
@@ -525,12 +525,12 @@
                     fTarget->getViewInverse(&vmi)) {
                     vmi.mapRect(&bounds);
                 } else {
-                    if (stages) {
+                    if (stageMask) {
                         if (!fTarget->getViewInverse(&vmi)) {
                             GrPrintf("Could not invert matrix.");
                             return;
                         }
-                        fTarget->preConcatSamplerMatrices(stages, vmi);
+                        fTarget->preConcatSamplerMatrices(stageMask, vmi);
                     }
                     fTarget->setViewMatrix(GrMatrix::I());
                 }
@@ -539,7 +539,7 @@
                 bounds.offset(fTranslate);
             }
             GrDrawTarget::AutoGeometryPush agp(fTarget);
-            fTarget->drawSimpleRect(bounds, NULL, stages);
+            fTarget->drawSimpleRect(bounds, NULL, stageMask);
         } else {
             if (passCount > 1) {
                 fTarget->enableState(GrDrawTarget::kNoColorWrites_StateBit);
@@ -560,8 +560,8 @@
     }
 }
 
-void GrDefaultPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
-    this->onDrawPath(stages, false);
+void GrDefaultPathRenderer::drawPath(GrDrawState::StageMask stageMask) {
+    this->onDrawPath(stageMask, false);
 }
 
 void GrDefaultPathRenderer::drawPathToStencil() {
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index 2a34a3d..adfe7d2 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -29,7 +29,7 @@
                                      const SkPath& path,
                                      GrPathFill fill) const SK_OVERRIDE;
 
-    virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
+    virtual void drawPath(GrDrawState::StageMask stageMask) SK_OVERRIDE;
     virtual void drawPathToStencil() SK_OVERRIDE;
 
 protected:
@@ -37,10 +37,10 @@
 
 private:
 
-    void onDrawPath(GrDrawTarget::StageBitfield stages, bool stencilOnly);
+    void onDrawPath(GrDrawState::StageMask stages, bool stencilOnly);
 
     bool createGeom(GrScalar srcSpaceTol,
-                    GrDrawTarget::StageBitfield stages);
+                   GrDrawState::StageMask stages);
 
     bool    fSeparateStencil;
     bool    fStencilWrapOps;
@@ -50,7 +50,7 @@
     int                         fIndexCnt;
     int                         fVertexCnt;
     GrScalar                    fPreviousSrcTol;
-    GrDrawTarget::StageBitfield fPreviousStages;
+    GrDrawState::StageMask      fPreviousStages;
     GrPrimitiveType             fPrimitiveType;
     bool                        fUseIndexedDraw;
 
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 8401772..90de1a3 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -39,6 +39,12 @@
         kMaxTexCoords = kNumStages
     };
 
+    /**
+     *  Bitfield used to indicate a set of stages.
+     */
+    typedef uint32_t StageMask;
+    GR_STATIC_ASSERT(sizeof(StageMask)*8 >= GrDrawState::kNumStages);
+
     enum DrawFace {
         kBoth_DrawFace,
         kCCW_DrawFace,
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 20098fc..7a84262 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1057,10 +1057,10 @@
 
 void GrDrawTarget::drawRect(const GrRect& rect, 
                             const GrMatrix* matrix,
-                            StageBitfield stageEnableBitfield,
+                            StageMask stageMask,
                             const GrRect* srcRects[],
                             const GrMatrix* srcMatrices[]) {
-    GrVertexLayout layout = GetRectVertexLayout(stageEnableBitfield, srcRects);
+    GrVertexLayout layout = GetRectVertexLayout(stageMask, srcRects);
 
     AutoReleaseGeometry geo(this, layout, 4, 0);
     if (!geo.succeeded()) {
@@ -1074,13 +1074,13 @@
     drawNonIndexed(kTriangleFan_PrimitiveType, 0, 4);
 }
 
-GrVertexLayout GrDrawTarget::GetRectVertexLayout(StageBitfield stageEnableBitfield, 
+GrVertexLayout GrDrawTarget::GetRectVertexLayout(StageMask stageMask, 
                                                  const GrRect* srcRects[]) {
     GrVertexLayout layout = 0;
 
     for (int i = 0; i < GrDrawState::kNumStages; ++i) {
         int numTC = 0;
-        if (stageEnableBitfield & (1 << i)) {
+        if (stageMask & (1 << i)) {
             if (NULL != srcRects && NULL != srcRects[i]) {
                 layout |= StageTexCoordVertexLayoutBit(i, numTC);
                 ++numTC;
@@ -1170,8 +1170,9 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-GrDrawTarget::AutoDeviceCoordDraw::AutoDeviceCoordDraw(GrDrawTarget* target, 
-                                                       int stageMask) {
+GrDrawTarget::AutoDeviceCoordDraw::AutoDeviceCoordDraw(
+                                            GrDrawTarget* target,
+                                            GrDrawState::StageMask stageMask) {
     GrAssert(NULL != target);
 
     fDrawTarget = target;
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 22cbbdb..4bd9eee 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -57,11 +57,7 @@
         int fMaxTextureSize;
     };
 
-    /**
-     *  Bitfield used to indicate which stages are in use.
-     */
-    typedef int StageBitfield;
-    GR_STATIC_ASSERT(sizeof(StageBitfield)*8 >= GrDrawState::kNumStages);
+    typedef GrDrawState::StageMask StageMask;
 
     /**
      *  Flags that affect rendering. Controlled using enable/disableState(). All
@@ -205,7 +201,7 @@
      * Shortcut for preConcatSamplerMatrix on all stages in mask with same
      * matrix
      */
-    void preConcatSamplerMatrices(int stageMask, const GrMatrix& matrix) {
+    void preConcatSamplerMatrices(StageMask stageMask, const GrMatrix& matrix) {
         for (int i = 0; i < GrDrawState::kNumStages; ++i) {
             if ((1 << i) & stageMask) {
                 this->preConcatSamplerMatrix(i, matrix);
@@ -221,7 +217,7 @@
      * @param matrix  the matrix to concat
      */
     void preConcatEnabledSamplerMatrices(const GrMatrix& matrix) {
-        StageBitfield stageMask = this->enabledStages();
+        StageMask stageMask = this->enabledStages();
         this->preConcatSamplerMatrices(stageMask, matrix);
     }
 
@@ -825,8 +821,8 @@
      * drawNonIndexed.
      * @param rect      the rect to draw
      * @param matrix    optional matrix applied to rect (before viewMatrix)
-     * @param stageEnableBitfield bitmask indicating which stages are enabled.
-     *                            Bit i indicates whether stage i is enabled.
+     * @param stageMask bitmask indicating which stages are enabled.
+     *                  Bit i indicates whether stage i is enabled.
      * @param srcRects  specifies rects for stages enabled by stageEnableMask.
      *                  if stageEnableMask bit i is 1, srcRects is not NULL,
      *                  and srcRects[i] is not NULL, then srcRects[i] will be
@@ -840,7 +836,7 @@
      */
     virtual void drawRect(const GrRect& rect,
                           const GrMatrix* matrix,
-                          StageBitfield stageEnableBitfield,
+                          StageMask stageMask,
                           const GrRect* srcRects[],
                           const GrMatrix* srcMatrices[]);
 
@@ -850,7 +846,7 @@
      */
     void drawSimpleRect(const GrRect& rect,
                         const GrMatrix* matrix,
-                        StageBitfield stageEnableBitfield) {
+                        StageMask stageEnableBitfield) {
          drawRect(rect, matrix, stageEnableBitfield, NULL, NULL);
     }
 
@@ -931,7 +927,7 @@
      */
     class AutoDeviceCoordDraw : ::GrNoncopyable {
     public:
-        AutoDeviceCoordDraw(GrDrawTarget* target, int stageMask);
+        AutoDeviceCoordDraw(GrDrawTarget* target, StageMask stageMask);
         ~AutoDeviceCoordDraw();
     private:
         GrDrawTarget*       fDrawTarget;
@@ -1291,8 +1287,8 @@
                                fCurrDrawState);
     }
 
-    StageBitfield enabledStages() const {
-        StageBitfield mask = 0;
+    StageMask enabledStages() const {
+        StageMask mask = 0;
         for (int s = 0; s < GrDrawState::kNumStages; ++s) {
             mask |= this->isStageEnabled(s) ? 1 : 0;
         }
@@ -1341,7 +1337,7 @@
 
     // Helpers for drawRect, protected so subclasses that override drawRect
     // can use them.
-    static GrVertexLayout GetRectVertexLayout(StageBitfield stageEnableBitfield,
+    static GrVertexLayout GetRectVertexLayout(StageMask stageEnableBitfield,
                                               const GrRect* srcRects[]);
 
     static void SetRectVertices(const GrRect& rect,
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 837d2c1..340cff1 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -70,7 +70,7 @@
 
 void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
                                    const GrMatrix* matrix,
-                                   StageBitfield stageEnableBitfield,
+                                   StageMask stageMask,
                                    const GrRect* srcRects[],
                                    const GrMatrix* srcMatrices[]) {
 
@@ -83,7 +83,7 @@
     if (fMaxQuads) {
 
         bool appendToPreviousDraw = false;
-        GrVertexLayout layout = GetRectVertexLayout(stageEnableBitfield, srcRects);
+        GrVertexLayout layout = GetRectVertexLayout(stageMask, srcRects);
         AutoReleaseGeometry geo(this, layout, 4, 0);
         if (!geo.succeeded()) {
             GrPrintf("Failed to get space for vertices!\n");
@@ -179,7 +179,7 @@
             this->enableState(kClip_StateBit);
         }
     } else {
-        INHERITED::drawRect(rect, matrix, stageEnableBitfield, srcRects, srcMatrices);
+        INHERITED::drawRect(rect, matrix, stageMask, srcRects, srcMatrices);
     }
 }
 
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index 3273525..f935be1 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -81,7 +81,7 @@
     // overrides from GrDrawTarget
     virtual void drawRect(const GrRect& rect, 
                           const GrMatrix* matrix = NULL,
-                          int stageEnableMask = 0,
+                          StageMask stageEnableMask = 0,
                           const GrRect* srcRects[] = NULL,
                           const GrMatrix* srcMatrices[] = NULL);
 
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index a7205e5..e24b982 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -137,7 +137,7 @@
      *                              use the remaining stages for its path
      *                              filling algorithm.
      */
-    virtual void drawPath(GrDrawTarget::StageBitfield stages) = 0;
+    virtual void drawPath(GrDrawState::StageMask stageMask) = 0;
 
     /**
      * Draws the path to the stencil buffer. Assume the writable stencil bits
diff --git a/src/gpu/GrTesselatedPathRenderer.cpp b/src/gpu/GrTesselatedPathRenderer.cpp
index 51cea10..b6612d1 100644
--- a/src/gpu/GrTesselatedPathRenderer.cpp
+++ b/src/gpu/GrTesselatedPathRenderer.cpp
@@ -346,7 +346,7 @@
     return edges->count();
 }
 
-void GrTesselatedPathRenderer::drawPath(GrDrawTarget::StageBitfield stages) {
+void GrTesselatedPathRenderer::drawPath(GrDrawState::StageMask stageMask) {
     GrDrawTarget::AutoStateRestore asr(fTarget);
     // face culling doesn't make sense here
     GrAssert(GrDrawState::kBoth_DrawFace == fTarget->getDrawFace());
@@ -362,7 +362,7 @@
 
     GrVertexLayout layout = 0;
     for (int s = 0; s < GrDrawState::kNumStages; ++s) {
-        if ((1 << s) & stages) {
+        if ((1 << s) & stageMask) {
             layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s);
         }
     }
diff --git a/src/gpu/GrTesselatedPathRenderer.h b/src/gpu/GrTesselatedPathRenderer.h
index 18cead2..e783958 100644
--- a/src/gpu/GrTesselatedPathRenderer.h
+++ b/src/gpu/GrTesselatedPathRenderer.h
@@ -16,7 +16,7 @@
 public:
     GrTesselatedPathRenderer();
 
-    virtual void drawPath(GrDrawTarget::StageBitfield stages);
+    virtual void drawPath(GrDrawState::StageMask stageMask);
     virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
                              const GrPath& path,
                              GrPathFill fill,
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 06cc2a1..657841c 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -123,7 +123,7 @@
         if (NULL != fPaint.getTexture(t)) {
             if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
                 invVMComputed = true;
-                fPaint.getTextureSampler(t)->preConcatMatrix(invVM);
+                fPaint.textureSampler(t)->preConcatMatrix(invVM);
             }
         }
     }
@@ -131,7 +131,7 @@
         if (NULL != fPaint.getMask(m)) {
             if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
                 invVMComputed = true;
-                fPaint.getMaskSampler(m)->preConcatMatrix(invVM);
+                fPaint.maskSampler(m)->preConcatMatrix(invVM);
             }
         }
     }
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 02a83f2..0ad0a5c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -496,7 +496,7 @@
         }
         return false;
     }
-    GrSamplerState* sampler = grPaint->getTextureSampler(kShaderTextureIdx);
+    GrSamplerState* sampler = grPaint->textureSampler(kShaderTextureIdx);
     sampler->setSampleMode(sampleMode);
     if (skPaint.isFilterBitmap()) {
         sampler->setFilter(GrSamplerState::kBilinear_Filter);
@@ -755,12 +755,12 @@
     GrTexture* dstTexture = temp1->texture();
     GrPaint paint;
     paint.reset();
-    paint.getTextureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
+    paint.textureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
 
     for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
         GrMatrix sampleM;
         sampleM.setIDiv(srcTexture->width(), srcTexture->height());
-        paint.getTextureSampler(0)->setMatrix(sampleM);
+        paint.textureSampler(0)->setMatrix(sampleM);
         context->setRenderTarget(dstTexture->asRenderTarget());
         SkRect dstRect(srcRect);
         scaleRect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, 
@@ -821,10 +821,10 @@
             srcRect.fRight, srcRect.fTop, 1, srcRect.height());
         context->clear(&clearRect, 0x0);
         // FIXME:  This should be mitchell, not bilinear.
-        paint.getTextureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
+        paint.textureSampler(0)->setFilter(GrSamplerState::kBilinear_Filter);
         GrMatrix sampleM;
         sampleM.setIDiv(srcTexture->width(), srcTexture->height());
-        paint.getTextureSampler(0)->setMatrix(sampleM);
+        paint.textureSampler(0)->setMatrix(sampleM);
         context->setRenderTarget(dstTexture->asRenderTarget());
         paint.setTexture(0, srcTexture);
         SkRect dstRect(srcRect);
@@ -930,10 +930,10 @@
     if (!isNormalBlur) {
         GrPaint paint;
         paint.reset();
-        paint.getTextureSampler(0)->setFilter(GrSamplerState::kNearest_Filter);
+        paint.textureSampler(0)->setFilter(GrSamplerState::kNearest_Filter);
         GrMatrix sampleM;
         sampleM.setIDiv(pathTexture->width(), pathTexture->height());
-        paint.getTextureSampler(0)->setMatrix(sampleM);
+        paint.textureSampler(0)->setMatrix(sampleM);
         // Blend pathTexture over blurTexture.
         context->setRenderTarget(blurTexture->asRenderTarget());
         paint.setTexture(0, pathTexture);
@@ -969,12 +969,12 @@
     // we assume the last mask index is available for use
     GrAssert(NULL == grp->getMask(MASK_IDX));
     grp->setMask(MASK_IDX, blurTexture);
-    grp->getMaskSampler(MASK_IDX)->setClampNoFilter();
+    grp->maskSampler(MASK_IDX)->setClampNoFilter();
 
     GrMatrix m;
     m.setTranslate(-finalRect.fLeft, -finalRect.fTop);
     m.postIDiv(blurTexture->width(), blurTexture->height());
-    grp->getMaskSampler(MASK_IDX)->setMatrix(m);
+    grp->maskSampler(MASK_IDX)->setMatrix(m);
     context->drawRect(*grp, finalRect);
     return true;
 }
@@ -1037,7 +1037,7 @@
     // we assume the last mask index is available for use
     GrAssert(NULL == grp->getMask(MASK_IDX));
     grp->setMask(MASK_IDX, texture);
-    grp->getMaskSampler(MASK_IDX)->setClampNoFilter();
+    grp->maskSampler(MASK_IDX)->setClampNoFilter();
 
     GrRect d;
     d.setLTRB(GrIntToScalar(dstM.fBounds.fLeft),
@@ -1049,7 +1049,7 @@
     m.setTranslate(-dstM.fBounds.fLeft*SK_Scalar1,
                    -dstM.fBounds.fTop*SK_Scalar1);
     m.postIDiv(texture->width(), texture->height());
-    grp->getMaskSampler(MASK_IDX)->setMatrix(m);
+    grp->maskSampler(MASK_IDX)->setMatrix(m);
     
     context->drawRect(*grp, d);
     return true;
@@ -1308,7 +1308,7 @@
     if (!this->skPaint2GrPaintNoShader(paint, true, &grPaint, false)) {
         return;
     }
-    GrSamplerState* sampler = grPaint.getTextureSampler(kBitmapTextureIdx);
+    GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx);
     if (paint.isFilterBitmap()) {
         sampler->setFilter(GrSamplerState::kBilinear_Filter);
     } else {
@@ -1395,7 +1395,7 @@
         return;
     }
 
-    GrSamplerState* sampler = grPaint->getTextureSampler(kBitmapTextureIdx);
+    GrSamplerState* sampler = grPaint->textureSampler(kBitmapTextureIdx);
 
     sampler->setWrapX(GrSamplerState::kClamp_WrapMode);
     sampler->setWrapY(GrSamplerState::kClamp_WrapMode);
@@ -1462,7 +1462,7 @@
 
     GrAutoMatrix avm(fContext, GrMatrix::I());
 
-    GrSamplerState* sampler = grPaint.getTextureSampler(kBitmapTextureIdx);
+    GrSamplerState* sampler = grPaint.textureSampler(kBitmapTextureIdx);
 
     GrTexture* texture;
     sampler->setClampNoFilter();
@@ -1497,7 +1497,7 @@
 
     GrAutoMatrix avm(fContext, GrMatrix::I());
 
-    grPaint.getTextureSampler(kBitmapTextureIdx)->setClampNoFilter();
+    grPaint.textureSampler(kBitmapTextureIdx)->setClampNoFilter();
 
     GrRect dstRect = GrRect::MakeXYWH(GrIntToScalar(x),
                                       GrIntToScalar(y),