Also provides the ResourceProvider to onDrawPath which allows the DF PR to no longer require access to GrContext.

Review URL: https://codereview.chromium.org/1265763002
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index 7e65fcc..344b119 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -678,14 +678,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool GrAAConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                         const GrPipelineBuilder*,
-                                         const SkMatrix& viewMatrix,
-                                         const SkPath& path,
-                                         const GrStrokeInfo& stroke,
-                                         bool antiAlias) const {
-    return (target->caps()->shaderCaps()->shaderDerivativeSupport() && antiAlias &&
-            stroke.isFillStyle() && !path.isInverseFillType() && path.isConvex());
+bool GrAAConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+    return (args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport() && args.fAntiAlias &&
+            args.fStroke->isFillStyle() && !args.fPath->isInverseFillType() &&
+            args.fPath->isConvex());
 }
 
 // extract the result vertices and indices from the GrAAConvexTessellator
@@ -988,24 +984,18 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
-                                        GrPipelineBuilder* pipelineBuilder,
-                                        GrColor color,
-                                        const SkMatrix& vm,
-                                        const SkPath& path,
-                                        const GrStrokeInfo&,
-                                        bool antiAlias) {
-    if (path.isEmpty()) {
+bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
+    if (args.fPath->isEmpty()) {
         return true;
     }
 
     AAConvexPathBatch::Geometry geometry;
-    geometry.fColor = color;
-    geometry.fViewMatrix = vm;
-    geometry.fPath = path;
+    geometry.fColor = args.fColor;
+    geometry.fViewMatrix = *args.fViewMatrix;
+    geometry.fPath = *args.fPath;
 
     SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
-    target->drawBatch(*pipelineBuilder, batch);
+    args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
 
diff --git a/src/gpu/GrAAConvexPathRenderer.h b/src/gpu/GrAAConvexPathRenderer.h
index 3abf1ab..5d51d6c 100644
--- a/src/gpu/GrAAConvexPathRenderer.h
+++ b/src/gpu/GrAAConvexPathRenderer.h
@@ -15,21 +15,10 @@
 public:
     GrAAConvexPathRenderer();
 
-    virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrPipelineBuilder*,
-                             const SkMatrix& viewMatrix,
-                             const SkPath&,
-                             const GrStrokeInfo&,
-                             bool antiAlias) const override;
+private:
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-protected:
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) override;
+    bool onDrawPath(const DrawPathArgs&) override;
 };
 
 #endif
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 830232b..960d7b4 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -62,10 +62,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-GrAADistanceFieldPathRenderer::GrAADistanceFieldPathRenderer(GrContext* context)
-    : fContext(context)
-    , fAtlas(NULL) {
-}
+GrAADistanceFieldPathRenderer::GrAADistanceFieldPathRenderer() : fAtlas(NULL) {}
 
 GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
     PathDataList::Iter iter;
@@ -84,34 +81,29 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-bool GrAADistanceFieldPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                                const GrPipelineBuilder* pipelineBuilder,
-                                                const SkMatrix& viewMatrix,
-                                                const SkPath& path,
-                                                const GrStrokeInfo& stroke,
-                                                bool antiAlias) const {
+bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     
     // TODO: Support inverse fill
     // TODO: Support strokes
-    if (!target->caps()->shaderCaps()->shaderDerivativeSupport() || !antiAlias 
-        || path.isInverseFillType() || path.isVolatile() || !stroke.isFillStyle()) {
+    if (!args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport() || !args.fAntiAlias ||
+        args.fPath->isInverseFillType() || args.fPath->isVolatile() ||
+        !args.fStroke->isFillStyle()) {
         return false;
     }
 
     // currently don't support perspective
-    if (viewMatrix.hasPerspective()) {
+    if (args.fViewMatrix->hasPerspective()) {
         return false;
     }
     
     // only support paths smaller than 64x64, scaled to less than 256x256
     // the goal is to accelerate rendering of lots of small paths that may be scaling
-    SkScalar maxScale = viewMatrix.getMaxScale();
-    const SkRect& bounds = path.getBounds();
+    SkScalar maxScale = args.fViewMatrix->getMaxScale();
+    const SkRect& bounds = args.fPath->getBounds();
     SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
     return maxDim < 64.f && maxDim * maxScale < 256.f;
 }
 
-
 GrPathRenderer::StencilSupport
 GrAADistanceFieldPathRenderer::onGetStencilSupport(const GrDrawTarget*,
                                                    const GrPipelineBuilder*,
@@ -537,7 +529,7 @@
     PathDataList* fPathList;
 };
 
-static GrBatchAtlas* create_atlas(GrContext* context, GrBatchAtlas::EvictionFunc func, void* data) {
+static GrBatchAtlas* create_atlas(GrTextureProvider* provider, GrBatchAtlas::EvictionFunc func, void* data) {
     GrBatchAtlas* atlas;
     // Create a new atlas
     GrSurfaceDesc desc;
@@ -548,7 +540,7 @@
 
     // We don't want to flush the context so we claim we're in the middle of flushing so as to
     // guarantee we do not recieve a texture with pending IO
-    GrTexture* texture = context->textureProvider()->refScratchTexture(
+    GrTexture* texture = provider->refScratchTexture(
         desc, GrTextureProvider::kApprox_ScratchTexMatch, true);
     if (texture) {
         atlas = SkNEW_ARGS(GrBatchAtlas, (texture, NUM_PLOTS_X, NUM_PLOTS_Y));
@@ -559,35 +551,28 @@
     return atlas;
 }
 
-bool GrAADistanceFieldPathRenderer::onDrawPath(GrDrawTarget* target,
-                                               GrPipelineBuilder* pipelineBuilder,
-                                               GrColor color,
-                                               const SkMatrix& viewMatrix,
-                                               const SkPath& path,
-                                               const GrStrokeInfo& stroke,
-                                               bool antiAlias) {
+bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
     // we've already bailed on inverse filled paths, so this is safe
-    if (path.isEmpty()) {
+    if (args.fPath->isEmpty()) {
         return true;
     }
 
-    SkASSERT(fContext);
-
     if (!fAtlas) {
-        fAtlas = create_atlas(fContext, &GrAADistanceFieldPathRenderer::HandleEviction,
-                              (void*)this);
+        fAtlas = create_atlas(args.fResourceProvider,
+                              &GrAADistanceFieldPathRenderer::HandleEviction, (void*)this);
         if (!fAtlas) {
             return false;
         }
     }
 
-    AADistanceFieldPathBatch::Geometry geometry(stroke);
-    geometry.fPath = path;
-    geometry.fAntiAlias = antiAlias;
+    AADistanceFieldPathBatch::Geometry geometry(*args.fStroke);
+    geometry.fPath = *args.fPath;
+    geometry.fAntiAlias = args.fAntiAlias;
 
-    SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
-                                                                 fAtlas, &fPathCache, &fPathList));
-    target->drawBatch(*pipelineBuilder, batch);
+    SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, args.fColor,
+                                                                 *args.fViewMatrix, fAtlas,
+                                                                 &fPathCache, &fPathList));
+    args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
 }
@@ -644,8 +629,8 @@
     if (context->uniqueID() != gTestStruct.fContextID) {
         gTestStruct.fContextID = context->uniqueID();
         gTestStruct.reset();
-        gTestStruct.fAtlas = create_atlas(context, &PathTestStruct::HandleEviction,
-                                          (void*)&gTestStruct);
+        gTestStruct.fAtlas = create_atlas(context->resourceProvider(),
+                                          &PathTestStruct::HandleEviction, (void*)&gTestStruct);
     }
 
     SkMatrix viewMatrix = GrTest::TestMatrix(random);
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.h b/src/gpu/GrAADistanceFieldPathRenderer.h
index bb76eff..30846e4 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.h
+++ b/src/gpu/GrAADistanceFieldPathRenderer.h
@@ -20,31 +20,19 @@
 
 class GrAADistanceFieldPathRenderer : public GrPathRenderer {
 public:
-    GrAADistanceFieldPathRenderer(GrContext* context);
+    GrAADistanceFieldPathRenderer();
     virtual ~GrAADistanceFieldPathRenderer();
-    
-    virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrPipelineBuilder*,
-                             const SkMatrix& viewMatrix,
-                             const SkPath&,
-                             const GrStrokeInfo&,
-                             bool antiAlias) const override;
-
-protected:
-    virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrPipelineBuilder*,
-                                               const SkPath&,
-                                               const GrStrokeInfo&) const override;
-    
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) override;
 
 private:
+    StencilSupport onGetStencilSupport(const GrDrawTarget*,
+                                       const GrPipelineBuilder*,
+                                       const SkPath&,
+                                       const GrStrokeInfo&) const override;
+
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
+
+    bool onDrawPath(const DrawPathArgs&) override;
+
     struct PathData {
         struct Key {
             uint32_t   fGenID;
@@ -75,7 +63,6 @@
     typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
     typedef SkTInternalLList<PathData> PathDataList;
     
-    GrContext*                         fContext;
     GrBatchAtlas*                      fAtlas;
     PathCache                          fPathCache;
     PathDataList                       fPathList;
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 6b1f8a4..ca83f6a 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -616,22 +616,17 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target,
-                                           const GrPipelineBuilder* pipelineBuilder,
-                                           const SkMatrix& viewMatrix,
-                                           const SkPath& path,
-                                           const GrStrokeInfo& stroke,
-                                           bool antiAlias) const {
-    if (!antiAlias) {
+bool GrAAHairLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+    if (!args.fAntiAlias) {
         return false;
     }
 
-    if (!IsStrokeHairlineOrEquivalent(stroke, viewMatrix, NULL)) {
+    if (!IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, NULL)) {
         return false;
     }
 
-    if (SkPath::kLine_SegmentMask == path.getSegmentMasks() ||
-        target->caps()->shaderCaps()->shaderDerivativeSupport()) {
+    if (SkPath::kLine_SegmentMask == args.fPath->getSegmentMasks() ||
+        args.fTarget->caps()->shaderCaps()->shaderDerivativeSupport()) {
         return true;
     }
     return false;
@@ -974,20 +969,14 @@
     return AAHairlineBatch::Create(geometry);
 }
 
-bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
-                                          GrPipelineBuilder* pipelineBuilder,
-                                          GrColor color,
-                                          const SkMatrix& viewMatrix,
-                                          const SkPath& path,
-                                          const GrStrokeInfo& stroke,
-                                          bool) {
+bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
     SkIRect devClipBounds;
-    pipelineBuilder->clip().getConservativeBounds(pipelineBuilder->getRenderTarget(),
-                                                  &devClipBounds);
+    args.fPipelineBuilder->clip().getConservativeBounds(args.fPipelineBuilder->getRenderTarget(),
+                                                        &devClipBounds);
 
-    SkAutoTUnref<GrBatch> batch(create_hairline_batch(color, viewMatrix, path, stroke,
-                                                      devClipBounds));
-    target->drawBatch(*pipelineBuilder, batch);
+    SkAutoTUnref<GrBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, *args.fPath,
+                                                      *args.fStroke, devClipBounds));
+    args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
 }
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index b523493..f9fa920 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -15,27 +15,15 @@
 public:
     static GrPathRenderer* Create()  { return SkNEW(GrAAHairLinePathRenderer); }
 
-    bool canDrawPath(const GrDrawTarget*,
-                     const GrPipelineBuilder*,
-                     const SkMatrix& viewMatrix,
-                     const SkPath&,
-                     const GrStrokeInfo&,
-                     bool antiAlias) const override;
-
     typedef SkTArray<SkPoint, true> PtArray;
     typedef SkTArray<int, true> IntArray;
     typedef SkTArray<float, true> FloatArray;
 
-protected:
-    bool onDrawPath(GrDrawTarget*,
-                    GrPipelineBuilder*,
-                    GrColor,
-                    const SkMatrix& viewMatrix,
-                    const SkPath&,
-                    const GrStrokeInfo&,
-                    bool antiAlias) override;
-
 private:
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
+
+    bool onDrawPath(const DrawPathArgs&) override;
+
     GrAAHairLinePathRenderer() {}
 
     typedef GrPathRenderer INHERITED;
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
index d899e7d..69f9d1c 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp
@@ -39,27 +39,23 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-bool GrAALinearizingConvexPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                                    const GrPipelineBuilder*,
-                                                    const SkMatrix& viewMatrix,
-                                                    const SkPath& path,
-                                                    const GrStrokeInfo& stroke,
-                                                    bool antiAlias) const {
-    if (!antiAlias) {
+bool GrAALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+    if (!args.fAntiAlias) {
         return false;
     }
-    if (path.isInverseFillType()) {
+    if (args.fPath->isInverseFillType()) {
         return false;
     }
-    if (!path.isConvex()) {
+    if (!args.fPath->isConvex()) {
         return false;
     }
-    if (stroke.getStyle() == SkStrokeRec::kStroke_Style) {
-        return viewMatrix.isSimilarity() && stroke.getWidth() >= 1.0f && 
-                stroke.getWidth() <= kMaxStrokeWidth && !stroke.isDashed() && 
-                SkPathPriv::LastVerbIsClose(path) && stroke.getJoin() != SkPaint::Join::kRound_Join;
+    if (args.fStroke->getStyle() == SkStrokeRec::kStroke_Style) {
+        return args.fViewMatrix->isSimilarity() && args.fStroke->getWidth() >= 1.0f && 
+                args.fStroke->getWidth() <= kMaxStrokeWidth && !args.fStroke->isDashed() && 
+                SkPathPriv::LastVerbIsClose(*args.fPath) &&
+                args.fStroke->getJoin() != SkPaint::Join::kRound_Join;
     }
-    return stroke.getStyle() == SkStrokeRec::kFill_Style;
+    return args.fStroke->getStyle() == SkStrokeRec::kFill_Style;
 }
 
 // extract the result vertices and indices from the GrAAConvexTessellator
@@ -303,26 +299,21 @@
     SkSTArray<1, Geometry, true> fGeoData;
 };
 
-bool GrAALinearizingConvexPathRenderer::onDrawPath(GrDrawTarget* target,
-                                                   GrPipelineBuilder* pipelineBuilder,
-                                                   GrColor color,
-                                                   const SkMatrix& vm,
-                                                   const SkPath& path,
-                                                   const GrStrokeInfo& stroke,
-                                                   bool antiAlias) {
-    if (path.isEmpty()) {
+bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
+    if (args.fPath->isEmpty()) {
         return true;
     }
     AAFlatteningConvexPathBatch::Geometry geometry;
-    geometry.fColor = color;
-    geometry.fViewMatrix = vm;
-    geometry.fPath = path;
-    geometry.fStrokeWidth = stroke.isFillStyle() ? -1.0f : stroke.getWidth();
-    geometry.fJoin = stroke.isFillStyle() ? SkPaint::Join::kMiter_Join : stroke.getJoin();
-    geometry.fMiterLimit = stroke.getMiter();
+    geometry.fColor = args.fColor;
+    geometry.fViewMatrix = *args.fViewMatrix;
+    geometry.fPath = *args.fPath;
+    geometry.fStrokeWidth = args.fStroke->isFillStyle() ? -1.0f : args.fStroke->getWidth();
+    geometry.fJoin = args.fStroke->isFillStyle() ? SkPaint::Join::kMiter_Join :
+                                                   args.fStroke->getJoin();
+    geometry.fMiterLimit = args.fStroke->getMiter();
 
     SkAutoTUnref<GrBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
-    target->drawBatch(*pipelineBuilder, batch);
+    args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
 }
diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.h b/src/gpu/GrAALinearizingConvexPathRenderer.h
index 8776332..57d21e0 100644
--- a/src/gpu/GrAALinearizingConvexPathRenderer.h
+++ b/src/gpu/GrAALinearizingConvexPathRenderer.h
@@ -15,21 +15,10 @@
 public:
     GrAALinearizingConvexPathRenderer();
 
-    virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrPipelineBuilder*,
-                             const SkMatrix& viewMatrix,
-                             const SkPath&,
-                             const GrStrokeInfo&,
-                             bool antiAlias) const override;
+private:
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-protected:
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) override;
+    bool onDrawPath(const DrawPathArgs&) override;
 };
 
 #endif
diff --git a/src/gpu/GrAddPathRenderers_default.cpp b/src/gpu/GrAddPathRenderers_default.cpp
index 963bbb9..4b2caec 100644
--- a/src/gpu/GrAddPathRenderers_default.cpp
+++ b/src/gpu/GrAddPathRenderers_default.cpp
@@ -36,5 +36,5 @@
     }
     chain->addPathRenderer(SkNEW(GrAAConvexPathRenderer))->unref();
     chain->addPathRenderer(SkNEW(GrAALinearizingConvexPathRenderer))->unref();
-    chain->addPathRenderer(SkNEW_ARGS(GrAADistanceFieldPathRenderer, (ctx)))->unref();
+    chain->addPathRenderer(SkNEW(GrAADistanceFieldPathRenderer))->unref();
 }
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index ec833c8..73637d8 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -432,9 +432,16 @@
             if (NULL == pr) {
                 return false;
             }
-
-            pr->drawPath(fClipTarget, pipelineBuilder, color, viewMatrix, path, stroke,
-                         element->isAA());
+            GrPathRenderer::DrawPathArgs args;
+            args.fTarget = fClipTarget;
+            args.fResourceProvider = this->getContext()->resourceProvider();
+            args.fPipelineBuilder = pipelineBuilder;
+            args.fColor = color;
+            args.fViewMatrix = &viewMatrix;
+            args.fPath = &path;
+            args.fStroke = &stroke;
+            args.fAntiAlias = element->isAA();
+            pr->drawPath(args);
             break;
         }
     }
@@ -829,11 +836,26 @@
                     if (!clipPath.isEmpty()) {
                         if (canRenderDirectToStencil) {
                             *pipelineBuilder.stencil() = gDrawToStencil;
-                            pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHITE,
-                                         viewMatrix, clipPath, stroke, false);
+
+                            GrPathRenderer::DrawPathArgs args;
+                            args.fTarget = fClipTarget;
+                            args.fResourceProvider = this->getContext()->resourceProvider();
+                            args.fPipelineBuilder = &pipelineBuilder;
+                            args.fColor = GrColor_WHITE;
+                            args.fViewMatrix = &viewMatrix;
+                            args.fPath = &clipPath;
+                            args.fStroke = &stroke;
+                            args.fAntiAlias = false;
+                            pr->drawPath(args);
                         } else {
-                            pr->stencilPath(fClipTarget, &pipelineBuilder, viewMatrix,
-                                            clipPath, stroke);
+                            GrPathRenderer::StencilPathArgs args;
+                            args.fTarget = fClipTarget;
+                            args.fResourceProvider = this->getContext()->resourceProvider();
+                            args.fPipelineBuilder = &pipelineBuilder;
+                            args.fViewMatrix = &viewMatrix;
+                            args.fPath = &clipPath;
+                            args.fStroke = &stroke;
+                            pr->stencilPath(args);
                         }
                     }
                 }
@@ -853,8 +875,16 @@
                                                     viewMatrix,
                                                     element->getRect());
                     } else {
-                        pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHITE,
-                                     viewMatrix, clipPath, stroke, false);
+                        GrPathRenderer::DrawPathArgs args;
+                        args.fTarget = fClipTarget;
+                        args.fResourceProvider = this->getContext()->resourceProvider();
+                        args.fPipelineBuilder = &pipelineBuilder;
+                        args.fColor = GrColor_WHITE;
+                        args.fViewMatrix = &viewMatrix;
+                        args.fPath = &clipPath;
+                        args.fStroke = &stroke;
+                        args.fAntiAlias = false;
+                        pr->drawPath(args);
                     }
                 } else {
                     // The view matrix is setup to do clip space -> stencil space translation, so
diff --git a/src/gpu/GrDashLinePathRenderer.cpp b/src/gpu/GrDashLinePathRenderer.cpp
index 17c1890..e26f5d7 100644
--- a/src/gpu/GrDashLinePathRenderer.cpp
+++ b/src/gpu/GrDashLinePathRenderer.cpp
@@ -10,28 +10,17 @@
 #include "GrGpu.h"
 #include "effects/GrDashingEffect.h"
 
-bool GrDashLinePathRenderer::canDrawPath(const GrDrawTarget* target,
-                                         const GrPipelineBuilder* pipelineBuilder,
-                                         const SkMatrix& viewMatrix,
-                                         const SkPath& path,
-                                         const GrStrokeInfo& stroke,
-                                         bool antiAlias) const {
+bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     SkPoint pts[2];
-    if (stroke.isDashed() && path.isLine(pts)) {
-        return GrDashingEffect::CanDrawDashLine(pts, stroke, viewMatrix);
+    if (args.fStroke->isDashed() && args.fPath->isLine(pts)) {
+        return GrDashingEffect::CanDrawDashLine(pts, *args.fStroke, *args.fViewMatrix);
     }
     return false;
 }
 
-bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
-                                        GrPipelineBuilder* pipelineBuilder,
-                                        GrColor color,
-                                        const SkMatrix& viewMatrix,
-                                        const SkPath& path,
-                                        const GrStrokeInfo& stroke,
-                                        bool useAA) {
+bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
     SkPoint pts[2];
-    SkAssertResult(path.isLine(pts));
-    return GrDashingEffect::DrawDashLine(target, *pipelineBuilder, color,
-                                         viewMatrix, pts, useAA, stroke);
+    SkAssertResult(args.fPath->isLine(pts));
+    return GrDashingEffect::DrawDashLine(args.fTarget, *args.fPipelineBuilder, args.fColor,
+                                         *args.fViewMatrix, pts, args.fAntiAlias, *args.fStroke);
 }
diff --git a/src/gpu/GrDashLinePathRenderer.h b/src/gpu/GrDashLinePathRenderer.h
index 09dc7ee..2e37665 100644
--- a/src/gpu/GrDashLinePathRenderer.h
+++ b/src/gpu/GrDashLinePathRenderer.h
@@ -12,15 +12,9 @@
 #include "GrPathRenderer.h"
 
 class GrDashLinePathRenderer : public GrPathRenderer {
-public:
-    bool canDrawPath(const GrDrawTarget*,
-                     const GrPipelineBuilder*,
-                     const SkMatrix& viewMatrix,
-                     const SkPath&,
-                     const GrStrokeInfo&,
-                     bool antiAlias) const override;
+private:
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-protected:
     StencilSupport onGetStencilSupport(const GrDrawTarget*,
                                        const GrPipelineBuilder*,
                                        const SkPath&,
@@ -28,13 +22,8 @@
       return kNoSupport_StencilSupport;
     }
 
-    bool onDrawPath(GrDrawTarget*,
-                    GrPipelineBuilder*,
-                    GrColor,
-                    const SkMatrix& viewMatrix,
-                    const SkPath&,
-                    const GrStrokeInfo&,
-                    bool antiAlias) override;
+    bool onDrawPath(const DrawPathArgs&) override;
+
     SkAutoTUnref<GrGpu> fGpu;
     typedef GrPathRenderer INHERITED;
 };
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 77af9e9..9258bfb 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -702,42 +702,28 @@
     return true;
 }
 
-bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                        const GrPipelineBuilder* pipelineBuilder,
-                                        const SkMatrix& viewMatrix,
-                                        const SkPath& path,
-                                        const GrStrokeInfo& stroke,
-                                        bool antiAlias) const {
+bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     // this class can draw any path with any fill but doesn't do any anti-aliasing.
-    return !antiAlias && (stroke.isFillStyle() || IsStrokeHairlineOrEquivalent(stroke,
-                                                                               viewMatrix,
-                                                                               NULL));
+    return !args.fAntiAlias && (args.fStroke->isFillStyle() ||
+                                IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix,
+                                                             NULL));
 }
 
-bool GrDefaultPathRenderer::onDrawPath(GrDrawTarget* target,
-                                       GrPipelineBuilder* pipelineBuilder,
-                                       GrColor color,
-                                       const SkMatrix& viewMatrix,
-                                       const SkPath& path,
-                                       const GrStrokeInfo& stroke,
-                                       bool antiAlias) {
-    return this->internalDrawPath(target,
-                                  pipelineBuilder,
-                                  color,
-                                  viewMatrix,
-                                  path,
-                                  stroke,
+bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
+    return this->internalDrawPath(args.fTarget,
+                                  args.fPipelineBuilder,
+                                  args.fColor,
+                                  *args.fViewMatrix,
+                                  *args.fPath,
+                                  *args.fStroke,
                                   false);
 }
 
-void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target,
-                                          GrPipelineBuilder* pipelineBuilder,
-                                          const SkMatrix& viewMatrix,
-                                          const SkPath& path,
-                                          const GrStrokeInfo& stroke) {
-    SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType());
-    SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType());
-    this->internalDrawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, path, stroke, true);
+void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
+    SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
+    SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
+    this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix,
+                           *args.fPath, *args.fStroke, true);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index 008eac2..2c1545f 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -19,13 +19,6 @@
 public:
     GrDefaultPathRenderer(bool separateStencilSupport, bool stencilWrapOpsSupport);
 
-    virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrPipelineBuilder*,
-                             const SkMatrix& viewMatrix,
-                             const SkPath&,
-                             const GrStrokeInfo&,
-                             bool antiAlias) const override;
-
 private:
 
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
@@ -33,19 +26,11 @@
                                                const SkPath&,
                                                const GrStrokeInfo&) const override;
 
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) override;
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-    virtual void onStencilPath(GrDrawTarget*,
-                               GrPipelineBuilder*,
-                               const SkMatrix& viewMatrix,
-                               const SkPath&,
-                               const GrStrokeInfo&) override;
+    bool onDrawPath(const DrawPathArgs&) override;
+
+    void onStencilPath(const StencilPathArgs&) override;
 
     bool internalDrawPath(GrDrawTarget*,
                           GrPipelineBuilder*,
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp
index eabdfd2..5a496d2 100644
--- a/src/gpu/GrDrawContext.cpp
+++ b/src/gpu/GrDrawContext.cpp
@@ -1183,7 +1183,16 @@
         return;
     }
 
-    pr->drawPath(target, pipelineBuilder, color, viewMatrix, *pathPtr, *strokeInfoPtr, useCoverageAA);
+    GrPathRenderer::DrawPathArgs args;
+    args.fTarget = target;
+    args.fResourceProvider = fContext->resourceProvider();
+    args.fPipelineBuilder = pipelineBuilder;
+    args.fColor = color;
+    args.fViewMatrix = &viewMatrix;
+    args.fPath = pathPtr;
+    args.fStroke = strokeInfoPtr;
+    args.fAntiAlias = useCoverageAA;
+    pr->drawPath(args);
 }
 
 bool GrDrawContext::prepareToDraw(GrRenderTarget* rt) {
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 3400ead..e353d68 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -89,68 +89,127 @@
         return this->onGetStencilSupport(target, pipelineBuilder, path, stroke);
     }
 
+    /** Args to canDrawPath()
+     *
+     * fTarget           The target that the path will be rendered to
+     * fPipelineBuilder  The pipelineBuilder
+     * fViewMatrix       The viewMatrix
+     * fPath             The path to draw
+     * fStroke           The stroke information (width, join, cap)
+     * fAntiAlias        True if anti-aliasing is required.
+     */
+    struct CanDrawPathArgs {
+        const GrDrawTarget*         fTarget;
+        const GrPipelineBuilder*    fPipelineBuilder;
+        const SkMatrix*             fViewMatrix;
+        const SkPath*               fPath;
+        const GrStrokeInfo*         fStroke;
+        bool                        fAntiAlias;
+    };
+
     /**
      * Returns true if this path renderer is able to render the path. Returning false allows the
      * caller to fallback to another path renderer This function is called when searching for a path
      * renderer capable of rendering a path.
      *
-     * @param target           The target that the path will be rendered to
-     * @param pipelineBuilder  The pipelineBuilder
-     * @param viewMatrix       The viewMatrix
-     * @param path             The path to draw
-     * @param stroke           The stroke information (width, join, cap)
-     * @param antiAlias        True if anti-aliasing is required.
-     *
      * @return  true if the path can be drawn by this object, false otherwise.
      */
-    virtual bool canDrawPath(const GrDrawTarget* target,
-                             const GrPipelineBuilder* pipelineBuilder,
-                             const SkMatrix& viewMatrix,
-                             const SkPath& path,
-                             const GrStrokeInfo& rec,
-                             bool antiAlias) const = 0;
+    bool canDrawPath(const CanDrawPathArgs& args) const {
+        SkASSERT(args.fTarget);
+        SkASSERT(args.fPipelineBuilder);
+        SkASSERT(args.fViewMatrix);
+        SkASSERT(args.fPath);
+        SkASSERT(args.fStroke);
+        SkASSERT(!args.fPath->isEmpty());
+        return this->onCanDrawPath(args);
+    }
+
+    /**
+     * Args to drawPath()
+     *
+     * fTarget                The target that the path will be rendered to
+     * fResourceProvider      The resource provider for creating gpu resources to render the path
+     * fPipelineBuilder       The pipelineBuilder
+     * fViewMatrix            The viewMatrix
+     * fPath                  the path to draw.
+     * fStroke                the stroke information (width, join, cap)
+     * fAntiAlias             true if anti-aliasing is required.
+     */
+    struct DrawPathArgs {
+        GrDrawTarget*               fTarget;
+        GrResourceProvider*         fResourceProvider;
+        GrPipelineBuilder*          fPipelineBuilder;
+        GrColor                     fColor;
+        const SkMatrix*             fViewMatrix;
+        const SkPath*               fPath;
+        const GrStrokeInfo*         fStroke;
+        bool                        fAntiAlias;
+    };
+
     /**
      * Draws the path into the draw target. If getStencilSupport() would return kNoRestriction then
-     * the subclass must respect the stencil settings of the target's draw state.
-     *
-     * @param target                The target that the path will be rendered to
-     * @param pipelineBuilder       The pipelineBuilder
-     * @param viewMatrix            The viewMatrix
-     * @param path                  the path to draw.
-     * @param stroke                the stroke information (width, join, cap)
-     * @param antiAlias             true if anti-aliasing is required.
+     * the subclass must respect the stencil settings of the GrPipelineBuilder.
      */
-    bool drawPath(GrDrawTarget* target,
-                  GrPipelineBuilder* ds,
-                  GrColor color,
-                  const SkMatrix& viewMatrix,
-                  const SkPath& path,
-                  const GrStrokeInfo& stroke,
-                  bool antiAlias) {
-        SkASSERT(!path.isEmpty());
-        SkASSERT(this->canDrawPath(target, ds, viewMatrix, path, stroke, antiAlias));
-        SkASSERT(ds->getStencil().isDisabled() ||
-                 kNoRestriction_StencilSupport == this->getStencilSupport(target, ds, path,
-                                                                          stroke));
-        return this->onDrawPath(target, ds, color, viewMatrix, path, stroke, antiAlias);
+    bool drawPath(const DrawPathArgs& args) {
+        SkASSERT(args.fTarget);
+        SkASSERT(args.fPipelineBuilder);
+        SkASSERT(args.fViewMatrix);
+        SkASSERT(args.fPath);
+        SkASSERT(args.fStroke);
+
+        SkASSERT(!args.fPath->isEmpty());
+#ifdef SK_DEBUG
+        CanDrawPathArgs canArgs;
+        canArgs.fTarget = args.fTarget;
+        canArgs.fPipelineBuilder = args.fPipelineBuilder;
+        canArgs.fViewMatrix = args.fViewMatrix;
+        canArgs.fPath = args.fPath;
+        canArgs.fStroke = args.fStroke;
+        canArgs.fAntiAlias = args.fAntiAlias;
+        SkASSERT(this->canDrawPath(canArgs));
+        SkASSERT(args.fPipelineBuilder->getStencil().isDisabled() ||
+                 kNoRestriction_StencilSupport == this->getStencilSupport(args.fTarget,
+                                                                          args.fPipelineBuilder,
+                                                                          *args.fPath,
+                                                                          *args.fStroke));
+#endif
+        return this->onDrawPath(args);
     }
 
+    /* Args to stencilPath().
+     *
+     * fTarget                The target that the path will be rendered to.
+     * fPipelineBuilder       The pipeline builder.
+     * fViewMatrix            Matrix applied to the path.
+     * fPath                  The path to draw.
+     * fStroke                The stroke information (width, join, cap)
+     */
+    struct StencilPathArgs {
+        GrDrawTarget*       fTarget;
+        GrPipelineBuilder*  fPipelineBuilder;
+        GrResourceProvider* fResourceProvider;
+        const SkMatrix*     fViewMatrix;
+        const SkPath*       fPath;
+        const GrStrokeInfo* fStroke;
+    };
+
     /**
      * Draws the path to the stencil buffer. Assume the writable stencil bits are already
      * initialized to zero. The pixels inside the path will have non-zero stencil values afterwards.
      *
-     * @param path                  the path to draw.
-     * @param stroke                the stroke information (width, join, cap)
-     * @param target                target that the path will be rendered to
      */
-    void stencilPath(GrDrawTarget* target,
-                     GrPipelineBuilder* ds,
-                     const SkMatrix& viewMatrix,
-                     const SkPath& path,
-                     const GrStrokeInfo& stroke) {
-        SkASSERT(!path.isEmpty());
-        SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(target, ds, path, stroke));
-        this->onStencilPath(target, ds, viewMatrix, path, stroke);
+    void stencilPath(const StencilPathArgs& args) {
+        SkASSERT(args.fTarget);
+        SkASSERT(args.fPipelineBuilder);
+        SkASSERT(args.fResourceProvider);
+        SkASSERT(args.fViewMatrix);
+        SkASSERT(args.fPath);
+        SkASSERT(args.fStroke);
+        SkASSERT(!args.fPath->isEmpty());
+        SkASSERT(kNoSupport_StencilSupport !=
+                 this->getStencilSupport(args.fTarget, args.fPipelineBuilder, *args.fPath,
+                                         *args.fStroke));
+        this->onStencilPath(args);
     }
 
     // Helper for determining if we can treat a thin stroke as a hairline w/ coverage.
@@ -171,48 +230,6 @@
     }
 
 protected:
-    /**
-     * Subclass overrides if it has any limitations of stenciling support.
-     */
-    virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
-                                               const GrPipelineBuilder*,
-                                               const SkPath&,
-                                               const GrStrokeInfo&) const {
-        return kNoRestriction_StencilSupport;
-    }
-
-    /**
-     * Subclass implementation of drawPath()
-     */
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) = 0;
-
-    /**
-     * Subclass implementation of stencilPath(). Subclass must override iff it ever returns
-     * kStencilOnly in onGetStencilSupport().
-     */
-    virtual void onStencilPath(GrDrawTarget* target,
-                               GrPipelineBuilder* pipelineBuilder,
-                               const SkMatrix& viewMatrix,
-                               const SkPath& path,
-                               const GrStrokeInfo& stroke) {
-        GR_STATIC_CONST_SAME_STENCIL(kIncrementStencil,
-                                     kReplace_StencilOp,
-                                     kReplace_StencilOp,
-                                     kAlways_StencilFunc,
-                                     0xffff,
-                                     0xffff,
-                                     0xffff);
-        pipelineBuilder->setStencil(kIncrementStencil);
-        pipelineBuilder->setDisableColorXPFactory();
-        this->drawPath(target, pipelineBuilder, GrColor_WHITE, viewMatrix, path, stroke, false);
-    }
-
     // Helper for getting the device bounds of a path. Inverse filled paths will have bounds set
     // by devSize. Non-inverse path bounds will not necessarily be clipped to devSize.
     static void GetPathDevBounds(const SkPath& path,
@@ -230,6 +247,52 @@
     }
 
 private:
+    /**
+     * Subclass overrides if it has any limitations of stenciling support.
+     */
+    virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
+                                               const GrPipelineBuilder*,
+                                               const SkPath&,
+                                               const GrStrokeInfo&) const {
+        return kNoRestriction_StencilSupport;
+    }
+
+    /**
+     * Subclass implementation of drawPath()
+     */
+    virtual bool onDrawPath(const DrawPathArgs& args) = 0;
+
+    /**
+     * Subclass implementation of canDrawPath()
+     */
+    virtual bool onCanDrawPath(const CanDrawPathArgs& args) const = 0;
+
+    /**
+     * Subclass implementation of stencilPath(). Subclass must override iff it ever returns
+     * kStencilOnly in onGetStencilSupport().
+     */
+    virtual void onStencilPath(const StencilPathArgs& args) {
+        GR_STATIC_CONST_SAME_STENCIL(kIncrementStencil,
+                                     kReplace_StencilOp,
+                                     kReplace_StencilOp,
+                                     kAlways_StencilFunc,
+                                     0xffff,
+                                     0xffff,
+                                     0xffff);
+        args.fPipelineBuilder->setStencil(kIncrementStencil);
+        args.fPipelineBuilder->setDisableColorXPFactory();
+        DrawPathArgs drawArgs;
+        drawArgs.fTarget = args.fTarget;
+        drawArgs.fResourceProvider = args.fResourceProvider;
+        drawArgs.fPipelineBuilder = args.fPipelineBuilder;
+        drawArgs.fColor = 0xFFFFFFFF;
+        drawArgs.fViewMatrix = args.fViewMatrix;
+        drawArgs.fPath = args.fPath;
+        drawArgs.fStroke = args.fStroke;
+        drawArgs.fAntiAlias = false;
+        this->drawPath(drawArgs);
+    }
+
 
     typedef SkRefCnt INHERITED;
 };
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 7c68a02..9bfa752 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -60,7 +60,14 @@
 
 
     for (int i = 0; i < fChain.count(); ++i) {
-        if (fChain[i]->canDrawPath(target, pipelineBuilder, viewMatrix, path, stroke, antiAlias)) {
+        GrPathRenderer::CanDrawPathArgs args;
+        args.fTarget = target;
+        args.fPipelineBuilder = pipelineBuilder;
+        args.fViewMatrix = &viewMatrix;
+        args.fPath = &path;
+        args.fStroke = &stroke;
+        args.fAntiAlias = antiAlias;
+        if (fChain[i]->canDrawPath(args)) {
             if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
                 GrPathRenderer::StencilSupport support =
                     fChain[i]->getStencilSupport(target, pipelineBuilder, path, stroke);
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 5389a9b..401246e 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -12,16 +12,11 @@
 #include "GrVertexBuffer.h"
 
 ////////////////////////////////////////////////////////////////////////////////
-bool GrSoftwarePathRenderer::canDrawPath(const GrDrawTarget*,
-                                         const GrPipelineBuilder*,
-                                         const SkMatrix& viewMatrix,
-                                         const SkPath&,
-                                         const GrStrokeInfo& stroke,
-                                         bool antiAlias) const {
+bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     if (NULL == fContext) {
         return false;
     }
-    if (stroke.isDashed()) {
+    if (args.fStroke->isDashed()) {
         return false;
     }
     return true;
@@ -117,41 +112,35 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 // return true on success; false on failure
-bool GrSoftwarePathRenderer::onDrawPath(GrDrawTarget* target,
-                                        GrPipelineBuilder* pipelineBuilder,
-                                        GrColor color,
-                                        const SkMatrix& viewMatrix,
-                                        const SkPath& path,
-                                        const GrStrokeInfo& stroke,
-                                        bool antiAlias) {
+bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
     if (NULL == fContext) {
         return false;
     }
 
     SkIRect devPathBounds, devClipBounds;
-    if (!get_path_and_clip_bounds(target, pipelineBuilder, path, viewMatrix, &devPathBounds,
-                                  &devClipBounds)) {
-        if (path.isInverseFillType()) {
-            draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClipBounds,
-                                 devPathBounds);
+    if (!get_path_and_clip_bounds(args.fTarget, args.fPipelineBuilder, *args.fPath,
+                                  *args.fViewMatrix, &devPathBounds, &devClipBounds)) {
+        if (args.fPath->isInverseFillType()) {
+            draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor,
+                                 *args.fViewMatrix, devClipBounds, devPathBounds);
         }
         return true;
     }
 
     SkAutoTUnref<GrTexture> texture(
-            GrSWMaskHelper::DrawPathMaskToTexture(fContext, path, stroke,
+            GrSWMaskHelper::DrawPathMaskToTexture(fContext, *args.fPath, *args.fStroke,
                                                   devPathBounds,
-                                                  antiAlias, &viewMatrix));
+                                                  args.fAntiAlias, args.fViewMatrix));
     if (NULL == texture) {
         return false;
     }
 
-    GrSWMaskHelper::DrawToTargetWithPathMask(texture, target, pipelineBuilder, color, viewMatrix,
-                                             devPathBounds);
+    GrSWMaskHelper::DrawToTargetWithPathMask(texture, args.fTarget, args.fPipelineBuilder,
+                                             args.fColor, *args.fViewMatrix, devPathBounds);
 
-    if (path.isInverseFillType()) {
-        draw_around_inv_path(target, pipelineBuilder, color, viewMatrix, devClipBounds,
-                             devPathBounds);
+    if (args.fPath->isInverseFillType()) {
+        draw_around_inv_path(args.fTarget, args.fPipelineBuilder, args.fColor, *args.fViewMatrix,
+                             devClipBounds, devPathBounds);
     }
 
     return true;
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 6e2055a..d7991b8 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -22,26 +22,15 @@
     GrSoftwarePathRenderer(GrContext* context)
         : fContext(context) {
     }
-
-    virtual bool canDrawPath(const GrDrawTarget*,
-                             const GrPipelineBuilder*,
-                             const SkMatrix& viewMatrix,
-                             const SkPath&,
-                             const GrStrokeInfo&,
-                             bool antiAlias) const override;
-protected:
+private:
     virtual StencilSupport onGetStencilSupport(const GrDrawTarget*,
                                                const GrPipelineBuilder*,
                                                const SkPath&,
                                                const GrStrokeInfo&) const override;
+    
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-    virtual bool onDrawPath(GrDrawTarget*,
-                            GrPipelineBuilder*,
-                            GrColor,
-                            const SkMatrix& viewMatrix,
-                            const SkPath&,
-                            const GrStrokeInfo&,
-                            bool antiAlias) override;
+    bool onDrawPath(const DrawPathArgs&) override;
 
 private:
     GrContext*     fContext;
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.cpp b/src/gpu/GrStencilAndCoverPathRenderer.cpp
index fb37360..4d92fb2 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/GrStencilAndCoverPathRenderer.cpp
@@ -45,20 +45,15 @@
     : fResourceProvider(resourceProvider) {    
 }
 
-bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                                const GrPipelineBuilder* pipelineBuilder,
-                                                const SkMatrix& viewMatrix,
-                                                const SkPath& path,
-                                                const GrStrokeInfo& stroke,
-                                                bool antiAlias) const {
-    if (stroke.isHairlineStyle()) {
+bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
+    if (args.fStroke->isHairlineStyle()) {
         return false;
     }
-    if (!pipelineBuilder->getStencil().isDisabled()) {
+    if (!args.fPipelineBuilder->getStencil().isDisabled()) {
         return false;
     }
-    if (antiAlias) {
-        return pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled();
+    if (args.fAntiAlias) {
+        return args.fPipelineBuilder->getRenderTarget()->isStencilBufferMultisampled();
     } else {
         return true; // doesn't do per-path AA, relies on the target having MSAA
     }
@@ -90,33 +85,28 @@
     return path.detach();
 }
 
-void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
-                                                  GrPipelineBuilder* pipelineBuilder,
-                                                  const SkMatrix& viewMatrix,
-                                                  const SkPath& path,
-                                                  const GrStrokeInfo& stroke) {
-    SkASSERT(!path.isInverseFillType());
-    SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
-    SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke));
-    target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
+    SkASSERT(!args.fPath->isInverseFillType());
+    SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, *args.fViewMatrix));
+    SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fPath, *args.fStroke));
+    args.fTarget->stencilPath(*args.fPipelineBuilder, pp, p,
+                              convert_skpath_filltype(args.fPath->getFillType()));
 }
 
-bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
-                                               GrPipelineBuilder* pipelineBuilder,
-                                               GrColor color,
-                                               const SkMatrix& viewMatrix,
-                                               const SkPath& path,
-                                               const GrStrokeInfo& stroke,
-                                               bool antiAlias) {
-    SkASSERT(!stroke.isHairlineStyle());
+bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
+    SkASSERT(!args.fStroke->isHairlineStyle());
+    const SkPath& path = *args.fPath;
+    GrPipelineBuilder* pipelineBuilder = args.fPipelineBuilder;
+    const SkMatrix& viewMatrix = *args.fViewMatrix;
+
     SkASSERT(pipelineBuilder->getStencil().isDisabled());
 
-    if (antiAlias) {
+    if (args.fAntiAlias) {
         SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled());
         pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag);
     }
 
-    SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke));
+    SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStroke));
 
     if (path.isInverseFillType()) {
         GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass,
@@ -134,7 +124,8 @@
 
         // fake inverse with a stencil and cover
         SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
-        target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+        args.fTarget->stencilPath(*pipelineBuilder, pp, p,
+                                  convert_skpath_filltype(path.getFillType()));
 
         SkMatrix invert = SkMatrix::I();
         SkRect bounds =
@@ -154,7 +145,7 @@
             }
         }
         const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
-        target->drawBWRect(*pipelineBuilder, color, viewM, bounds, NULL, &invert);
+        args.fTarget->drawBWRect(*pipelineBuilder, args.fColor, viewM, bounds, NULL, &invert);
     } else {
         GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
             kZero_StencilOp,
@@ -165,8 +156,9 @@
             0xffff);
 
         pipelineBuilder->setStencil(kStencilPass);
-        SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatrix));
-        target->drawPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
+        SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(args.fColor, viewMatrix));
+        args.fTarget->drawPath(*pipelineBuilder, pp, p,
+                               convert_skpath_filltype(path.getFillType()));
     }
 
     pipelineBuilder->stencil()->setDisabled();
diff --git a/src/gpu/GrStencilAndCoverPathRenderer.h b/src/gpu/GrStencilAndCoverPathRenderer.h
index 62a378b..5b6ce41 100644
--- a/src/gpu/GrStencilAndCoverPathRenderer.h
+++ b/src/gpu/GrStencilAndCoverPathRenderer.h
@@ -23,34 +23,19 @@
 
     static GrPathRenderer* Create(GrResourceProvider*, const GrCaps&);
 
-    bool canDrawPath(const GrDrawTarget*,
-                     const GrPipelineBuilder*,
-                     const SkMatrix& viewMatrix,
-                     const SkPath&,
-                     const GrStrokeInfo&,
-                     bool antiAlias) const override;
 
-protected:
+private:
     StencilSupport onGetStencilSupport(const GrDrawTarget*,
                                        const GrPipelineBuilder*,
                                        const SkPath&,
                                        const GrStrokeInfo&) const override;
 
-    bool onDrawPath(GrDrawTarget*,
-                    GrPipelineBuilder*,
-                    GrColor,
-                    const SkMatrix& viewMatrix,
-                    const SkPath&,
-                    const GrStrokeInfo&,
-                    bool antiAlias) override;
+    bool onCanDrawPath(const CanDrawPathArgs&) const override;
 
-    void onStencilPath(GrDrawTarget*,
-                       GrPipelineBuilder*,
-                       const SkMatrix& viewMatrix,
-                       const SkPath&,
-                       const GrStrokeInfo&) override;
+    bool onDrawPath(const DrawPathArgs&) override;
 
-private:
+    void onStencilPath(const StencilPathArgs&) override;
+
     GrStencilAndCoverPathRenderer(GrResourceProvider*);
 
     GrResourceProvider* fResourceProvider;
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index f420372..6abfc45 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1342,15 +1342,10 @@
     return GrPathRenderer::kNoSupport_StencilSupport;
 }
 
-bool GrTessellatingPathRenderer::canDrawPath(const GrDrawTarget* target,
-                                             const GrPipelineBuilder* pipelineBuilder,
-                                             const SkMatrix& viewMatrix,
-                                             const SkPath& path,
-                                             const GrStrokeInfo& stroke,
-                                             bool antiAlias) const {
+bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     // This path renderer can draw all fill styles, but does not do antialiasing. It can do convex
     // and concave paths, but we'll leave the convex ones to simpler algorithms.
-    return stroke.isFillStyle() && !antiAlias && !path.isConvex();
+    return args.fStroke->isFillStyle() && !args.fAntiAlias && !args.fPath->isConvex();
 }
 
 class TessellatingPathBatch : public GrBatch {
@@ -1489,29 +1484,24 @@
     GrPipelineInfo fPipelineInfo;
 };
 
-bool GrTessellatingPathRenderer::onDrawPath(GrDrawTarget* target,
-                                            GrPipelineBuilder* pipelineBuilder,
-                                            GrColor color,
-                                            const SkMatrix& viewM,
-                                            const SkPath& path,
-                                            const GrStrokeInfo&,
-                                            bool antiAlias) {
-    SkASSERT(!antiAlias);
-    const GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
+    SkASSERT(!args.fAntiAlias);
+    const GrRenderTarget* rt = args.fPipelineBuilder->getRenderTarget();
     if (NULL == rt) {
         return false;
     }
 
     SkIRect clipBoundsI;
-    pipelineBuilder->clip().getConservativeBounds(rt, &clipBoundsI);
+    args.fPipelineBuilder->clip().getConservativeBounds(rt, &clipBoundsI);
     SkRect clipBounds = SkRect::Make(clipBoundsI);
     SkMatrix vmi;
-    if (!viewM.invert(&vmi)) {
+    if (!args.fViewMatrix->invert(&vmi)) {
         return false;
     }
     vmi.mapRect(&clipBounds);
-    SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM, clipBounds));
-    target->drawBatch(*pipelineBuilder, batch);
+    SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fPath,
+                                                              *args.fViewMatrix, clipBounds));
+    args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
 
     return true;
 }
diff --git a/src/gpu/GrTessellatingPathRenderer.h b/src/gpu/GrTessellatingPathRenderer.h
index 79cafc9..aa7be77 100644
--- a/src/gpu/GrTessellatingPathRenderer.h
+++ b/src/gpu/GrTessellatingPathRenderer.h
@@ -18,26 +18,15 @@
 public:
     GrTessellatingPathRenderer();
 
-    bool canDrawPath(const GrDrawTarget*,
-                     const GrPipelineBuilder*,
-                     const SkMatrix&,
-                     const SkPath&,
-                     const GrStrokeInfo&,
-                     bool antiAlias) const override;
-protected:
+private:
+    bool onCanDrawPath(const CanDrawPathArgs& ) const override;
 
     StencilSupport onGetStencilSupport(const GrDrawTarget*,
                                        const GrPipelineBuilder*,
                                        const SkPath&,
                                        const GrStrokeInfo&) const override;
 
-    bool onDrawPath(GrDrawTarget*,
-                    GrPipelineBuilder*,
-                    GrColor,
-                    const SkMatrix& viewMatrix,
-                    const SkPath&,
-                    const GrStrokeInfo&,
-                    bool antiAlias) override;
+    bool onDrawPath(const DrawPathArgs&) override;
 
     typedef GrPathRenderer INHERITED;
 };
diff --git a/src/gpu/GrTest.h b/src/gpu/GrTest.h
index 7b0d564..eb1d7de 100644
--- a/src/gpu/GrTest.h
+++ b/src/gpu/GrTest.h
@@ -23,6 +23,7 @@
     void init(GrContext*, GrDrawTarget*);
 
     GrDrawTarget* target() { return fDrawTarget.get(); }
+    GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); }
 
 private:
     SkAutoTUnref<GrDrawTarget>              fDrawTarget;