Don't use GrDrawTarget's AA state bit to convey whether to do custom-aa

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



git-svn-id: http://skia.googlecode.com/svn/trunk@2539 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 4a1f1da..f980702 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -585,9 +585,9 @@
 
     GrDrawTarget* prepareToDraw(const GrPaint& paint, DrawCategory drawType);
 
-    GrPathRenderer* getPathRenderer(const GrDrawTarget* target,
-                                    const GrPath& path,
-                                    GrPathFill fill);
+    GrPathRenderer* getPathRenderer(const GrPath& path,
+                                    GrPathFill fill,
+                                    bool antiAlias);
 
     struct OffscreenRecord;
 
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index f16c8ef..35c4f20 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -106,20 +106,15 @@
     fQuadsIndexBuffer->unref();
 }
 
-bool GrAAHairLinePathRenderer::supportsAA(const GrDrawTarget* target,
-                                          const SkPath& path,
-                                          GrPathFill fill) const {
-    return kHairLine_PathFill == fill;
-}
-
-bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget* target,
+bool GrAAHairLinePathRenderer::canDrawPath(const GrDrawTarget::Caps& targetCaps,
                                            const SkPath& path,
-                                           GrPathFill fill) const {
+                                           GrPathFill fill,
+                                           bool antiAlias) const {
     static const uint32_t gReqDerivMask = SkPath::kCubic_SegmentMask |
                                           SkPath::kQuad_SegmentMask;
     return (kHairLine_PathFill == fill &&
-            target->isAntialiasState() &&
-            (target->getCaps().fShaderDerivativeSupport ||
+            antiAlias &&
+            (targetCaps.fShaderDerivativeSupport ||
              !(gReqDerivMask & path.getSegmentMasks())));
 }
 
diff --git a/src/gpu/GrAAHairLinePathRenderer.h b/src/gpu/GrAAHairLinePathRenderer.h
index 81cecf2..1d561fa 100644
--- a/src/gpu/GrAAHairLinePathRenderer.h
+++ b/src/gpu/GrAAHairLinePathRenderer.h
@@ -17,18 +17,16 @@
 
     static GrPathRenderer* Create(GrContext* context);
     // GrPathRenderer overrides
-    virtual bool supportsAA(const GrDrawTarget* target,
-                            const SkPath& path,
-                            GrPathFill fill) const;
-    virtual bool canDrawPath(const GrDrawTarget* target,
+    virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
                              const SkPath& path,
-                             GrPathFill fill) const;
-    virtual void drawPath(GrDrawTarget::StageBitfield stages);
+                             GrPathFill fill,
+                             bool antiAlias) const  SK_OVERRIDE;
+    virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
 
 protected:
 
     // GrPathRenderer overrides
-    virtual void pathWillClear();
+    virtual void pathWillClear()  SK_OVERRIDE;
 
 private:
     void resetGeom();
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5921838..d9dc3d2 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -333,7 +333,7 @@
             fGpu->setBlendFunc(kOne_BlendCoeff, kZero_BlendCoeff);
             fGpu->disableState(GrDrawTarget::kDither_StateBit |
                                GrDrawTarget::kClip_StateBit   |
-                               GrDrawTarget::kAntialias_StateBit);
+                               GrDrawTarget::kHWAntialias_StateBit);
             GrSamplerState::Filter filter;
             // if filtering is not desired then we want to ensure all
             // texels in the resampled image are copies of texels from
@@ -664,9 +664,6 @@
 #if !GR_USE_OFFSCREEN_AA
     return false;
 #else
-    if (!target->isAntialiasState()) {
-        return false;
-    }
     // Line primitves are always rasterized as 1 pixel wide.
     // Super-sampling would make them too thin but MSAA would be OK.
     if (isHairLines &&
@@ -778,6 +775,9 @@
     tempPaint.reset();
     SetPaint(tempPaint, target);
     target->setRenderTarget(offRT0);
+#if PREFER_MSAA_OFFSCREEN_AA
+    target->enableState(GrDrawTarget::kHWAntialias_StateBit);
+#endif
 
     GrMatrix transM;
     int left = boundRect.fLeft + tileX * record->fTileSizeX;
@@ -1166,16 +1166,12 @@
                              bool* useVertexCoverage) {
     // we use a simple alpha ramp to do aa on axis-aligned rects
     // do AA with alpha ramp if the caller requested AA, the rect 
-    // will be axis-aligned,the render target is not
-    // multisampled, and the rect won't land on integer coords.
-
-    if (!target->isAntialiasState()) {
-        return false;
-    }
+    // will be axis-aligned, and the rect won't land on integer coords.
 
     // we are keeping around the "tweak the alpha" trick because
     // it is our only hope for the fixed-pipe implementation.
     // In a shader implementation we can give a separate coverage input
+    // TODO: remove this ugliness when we drop the fixed-pipe impl
     *useVertexCoverage = false;
     if (!target->canTweakAlphaForCoverage()) {
         if (target->getCaps().fSupportPerVertexCoverage) {
@@ -1238,8 +1234,11 @@
     GrRect devRect = rect;
     GrMatrix combinedMatrix;
     bool useVertexCoverage;
-    bool doAA = apply_aa_to_rect(target, rect, width, matrix,
-                                 &combinedMatrix, &devRect, &useVertexCoverage);
+    bool needAA = paint.fAntiAlias &&
+                  !this->getRenderTarget()->isMultisampled();
+    bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix,
+                                           &combinedMatrix, &devRect,
+                                           &useVertexCoverage);
 
     if (doAA) {
         GrDrawTarget::AutoViewMatrixRestore avm(target);
@@ -1490,6 +1489,8 @@
 
     GrDrawTarget* target = this->prepareToDraw(paint, kUnbuffered_DrawCategory);
 
+    bool prAA = paint.fAntiAlias && !this->getRenderTarget()->isMultisampled();
+
     // An Assumption here is that path renderer would use some form of tweaking
     // the src color (either the input alpha or in the frag shader) to implement
     // aa. If we have some future driver-mojo path AA that can do the right
@@ -1498,10 +1499,22 @@
 #if GR_DEBUG
         GrPrintf("Turning off AA to correctly apply blend.\n");
 #endif
-        target->disableState(GrDrawTarget::kAntialias_StateBit);
+        prAA = false;
     }
-    
-    GrPathRenderer* pr = this->getPathRenderer(target, path, fill);
+
+    bool doOSAA = false;
+    GrPathRenderer* pr = NULL;
+    if (prAA) {
+        pr = this->getPathRenderer(path, fill, true);
+        if (NULL == pr) {
+            prAA = false;
+            doOSAA = this->doOffscreenAA(target, kHairLine_PathFill == fill);
+            pr = this->getPathRenderer(path, fill, false);
+        }
+    } else {
+        pr = this->getPathRenderer(path, fill, false);
+    }
+
     if (NULL == pr) {
 #if GR_DEBUG
         GrPrintf("Unable to find path renderer compatible with path.\n");
@@ -1509,12 +1522,10 @@
         return;
     }
 
-    GrPathRenderer::AutoClearPath arp(pr, target, &path, fill, translate);
+    GrPathRenderer::AutoClearPath arp(pr, target, &path, fill, prAA, translate);
     GrDrawTarget::StageBitfield stageMask = paint.getActiveStageMask();
 
-    if (!pr->supportsAA(target, path, fill) &&
-        this->doOffscreenAA(target, kHairLine_PathFill == fill)) {
-
+    if (doOSAA) {
         bool needsStencil = pr->requiresStencilPass(target, path, fill);
 
         // compute bounds as intersection of rt size, clip, and path
@@ -1723,9 +1734,9 @@
         target->disableState(GrDrawTarget::kDither_StateBit);
     }
     if (paint.fAntiAlias) {
-        target->enableState(GrDrawTarget::kAntialias_StateBit);
+        target->enableState(GrDrawTarget::kHWAntialias_StateBit);
     } else {
-        target->disableState(GrDrawTarget::kAntialias_StateBit);
+        target->disableState(GrDrawTarget::kHWAntialias_StateBit);
     }
     target->setBlendFunc(paint.fSrcBlendCoeff, paint.fDstBlendCoeff);
     target->setColorFilter(paint.fColorFilterColor, paint.fColorFilterXfermode);
@@ -1763,14 +1774,15 @@
     return target;
 }
 
-GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target,
-                                           const GrPath& path,
-                                           GrPathFill fill) {
+GrPathRenderer* GrContext::getPathRenderer(const GrPath& path,
+                                           GrPathFill fill,
+                                           bool antiAlias) {
     if (NULL == fPathRendererChain) {
         fPathRendererChain = 
             new GrPathRendererChain(this, GrPathRendererChain::kNone_UsageFlag);
     }
-    return fPathRendererChain->getPathRenderer(target, path, fill);
+    return fPathRendererChain->getPathRenderer(fGpu->getCaps(), path,
+                                               fill, antiAlias);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index 14c032b..52decb4 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -25,6 +25,16 @@
     fTarget = NULL;
 }
 
+bool GrDefaultPathRenderer::canDrawPath(const GrDrawTarget::Caps& targetCaps,
+                                        const SkPath& path,
+                                        GrPathFill fill,
+                                        bool antiAlias) const {
+    // this class can draw any path with any fill but doesn't do any 
+    // anti-aliasing.
+    return !antiAlias; 
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 // Stencil rules for paths
 
@@ -187,7 +197,7 @@
 }
 
 bool GrDefaultPathRenderer::requiresStencilPass(const GrDrawTarget* target,
-                                                const GrPath& path, 
+                                                const GrPath& path,
                                                 GrPathFill fill) const {
     return !single_pass_path(*target, path, fill);
 }
diff --git a/src/gpu/GrDefaultPathRenderer.h b/src/gpu/GrDefaultPathRenderer.h
index dd59641..2a34a3d 100644
--- a/src/gpu/GrDefaultPathRenderer.h
+++ b/src/gpu/GrDefaultPathRenderer.h
@@ -20,16 +20,17 @@
     GrDefaultPathRenderer(bool separateStencilSupport,
                           bool stencilWrapOpsSupport);
 
-    virtual bool canDrawPath(const GrDrawTarget* target,
+    virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
                              const SkPath& path,
-                             GrPathFill fill) const { return true; }
+                             GrPathFill fill,
+                             bool antiAlias) const SK_OVERRIDE;
 
     virtual bool requiresStencilPass(const GrDrawTarget* target,
                                      const SkPath& path,
-                                     GrPathFill fill) const;
+                                     GrPathFill fill) const SK_OVERRIDE;
 
-    virtual void drawPath(GrDrawTarget::StageBitfield stages);
-    virtual void drawPathToStencil();
+    virtual void drawPath(GrDrawTarget::StageBitfield stages) SK_OVERRIDE;
+    virtual void drawPathToStencil() SK_OVERRIDE;
 
 protected:
     virtual void pathWillClear();
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 0ba7ead..986dbd6 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -999,7 +999,7 @@
     // but not in a premul-alpha way. So we only use them when our alpha
     // is 0xff and tweaking the color for partial coverage is OK
     if (!fCaps.fHWAALineSupport ||
-        !(kAntialias_StateBit & fCurrDrawState.fFlagBits)) {
+        !(kHWAntialias_StateBit & fCurrDrawState.fFlagBits)) {
         return false;
     }
     BlendOptFlags opts = this->getBlendOpts();
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 10633f5..c85fc35 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -114,23 +114,31 @@
      *  default to disabled.
      */
     enum StateBits {
-        kDither_StateBit        = 0x01, //<! Perform color dithering
-        kAntialias_StateBit     = 0x02, //<! Perform anti-aliasing. The render-
-                                        //   target must support some form of AA
-                                        //   (msaa, coverage sampling, etc). For
-                                        //   GrGpu-created rendertarget/textures
-                                        //   this is controlled by parameters
-                                        //   passed to createTexture.
-        kClip_StateBit          = 0x04, //<! Controls whether drawing is clipped
-                                        //   against the region specified by
-                                        //   setClip.
-        kNoColorWrites_StateBit = 0x08, //<! If set it disables writing colors.
-                                        //   Useful while performing stencil
-                                        //   ops.
-        kEdgeAAConcave_StateBit =  0x10,//<! If set, edge AA will test edge
-                                        //   pairs for convexity while 
-                                        //   rasterizing.  Set this if the
-                                        //   source polygon is non-convex.
+        /**
+         * Perform dithering. TODO: Re-evaluate whether we need this bit
+         */
+        kDither_StateBit        = 0x01,
+        /**
+         * Perform HW anti-aliasing. This means either HW FSAA, if supported
+         * by the render target, or smooth-line rendering if a line primitive
+         * is drawn and line smoothing is supported by the 3D API.
+         */
+        kHWAntialias_StateBit   = 0x02,
+        /**
+         * Draws will respect the clip, otherwise the clip is ignored.
+         */
+        kClip_StateBit          = 0x04,
+        /**
+         * Disables writing to the color buffer. Useful when performing stencil
+         * operations.
+         */
+        kNoColorWrites_StateBit = 0x08,
+        /**
+         * Modifies the behavior of edge AA specified by setEdgeAA. If set, 
+         * will test edge pairs for convexity when rasterizing. Set this if the 
+         * source polygon is non-convex.
+         */
+        kEdgeAAConcave_StateBit =  0x10,
         // subclass may use additional bits internally
         kDummyStateBit,
         kLastPublicStateBit = kDummyStateBit-1
@@ -477,8 +485,8 @@
         return 0 != (fCurrDrawState.fFlagBits & kDither_StateBit);
     }
 
-    bool isAntialiasState() const {
-        return 0 != (fCurrDrawState.fFlagBits & kAntialias_StateBit);
+    bool isHWAntialiasState() const {
+        return 0 != (fCurrDrawState.fFlagBits & kHWAntialias_StateBit);
     }
 
     bool isClipState() const {
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index b05f2c0..f0808d3 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -600,7 +600,7 @@
                     }
                     canRenderDirectToStencil =
                         !pr->requiresStencilPass(this, *clipPath, fill);
-                    arp.set(pr, this, clipPath, fill, NULL);
+                    arp.set(pr, this, clipPath, fill, false, NULL);
                 }
 
                 GrSetOp op = (c == start) ? startOp : clip.getOp(c);
@@ -684,7 +684,8 @@
             new GrPathRendererChain(this->getContext(),
                                     GrPathRendererChain::kNonAAOnly_UsageFlag);
     }
-    return fPathRendererChain->getPathRenderer(this, path, fill);
+    return fPathRendererChain->getPathRenderer(this->getCaps(),
+                                               path, fill, false);
 }
 
 
diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp
index b27815b..077cdd9 100644
--- a/src/gpu/GrGpuGL.cpp
+++ b/src/gpu/GrGpuGL.cpp
@@ -1798,7 +1798,7 @@
                 fHWAAState.fMSAAEnabled = false;
             }
         } else if (fCurrDrawState.fRenderTarget->isMultisampled() &&
-                   !!(kAntialias_StateBit & fCurrDrawState.fFlagBits) !=
+                   SkToBool(kHWAntialias_StateBit & fCurrDrawState.fFlagBits) !=
                    fHWAAState.fMSAAEnabled) {
             if (fHWAAState.fMSAAEnabled) {
                 GL_CALL(Disable(GR_GL_MULTISAMPLE));
diff --git a/src/gpu/GrPathRenderer.cpp b/src/gpu/GrPathRenderer.cpp
index 929941a..a4f7d0c 100644
--- a/src/gpu/GrPathRenderer.cpp
+++ b/src/gpu/GrPathRenderer.cpp
@@ -16,6 +16,7 @@
 void GrPathRenderer::setPath(GrDrawTarget* target,
                              const SkPath* path,
                              GrPathFill fill,
+                             bool antiAlias,
                              const GrPoint* translate) {
     GrAssert(NULL == fPath);
     GrAssert(NULL == fTarget);
@@ -24,6 +25,7 @@
     fTarget = target;
     fPath = path;
     fFill = fill;
+    fAntiAlias = antiAlias;
     if (NULL != translate) {
         fTranslate = *translate;
     } else {
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index d95cc85..a7205e5 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -24,7 +24,7 @@
  *  Paths may be drawn multiple times as when tiling for supersampling. The 
  *  calls on GrPathRenderer to draw a path will look like this:
  *  
- *  pr->setPath(target, path, fill, translate); // sets the path to draw
+ *  pr->setPath(target, path, fill, aa, translate); // sets the path to draw
  *      pr->drawPath(...);  // draw the path
  *      pr->drawPath(...);
  *      ...
@@ -54,27 +54,20 @@
      * Returns true if this path renderer is able to render the path.
      * Returning false allows the caller to fallback to another path renderer.
      * When searching for a path renderer capable of rendering a path this
-     * function is called. The path renderer can examine the path, fill rule,
-     * and draw settings that will be used (via the targetparameter). If "true"
-     * is reported note that the caller is permitted to make modifications to
-     * the following settings of the target between the calls to canDrawPath and
-     * drawPath:
-     *     1. view matrix: The matrix at drawPath time may have additional scale
-     *                     scale and translation applied
-     *     2. render target: The render target may change between canDrawPath 
-     *                       and drawPath.
-     * The GrPathRenderer subclass's decision about whether to return true
-     * or false in its implementation of this function should consider these
-     * possible state changes.
+     * function is called.
      *
-     * @param path      The path to draw
-     * @param fill      The fill rule to use
+     * @param targetCaps The caps of the draw target that will be used to draw
+     *                   the path.
+     * @param path       The path to draw
+     * @param fill       The fill rule to use
+     * @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,
+    virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
                              const SkPath& path,
-                             GrPathFill fill) const = 0;
+                             GrPathFill fill,
+                             bool antiAlias) const = 0;
 
     /**
      * For complex clips Gr uses the stencil buffer. The path renderer must be
@@ -102,15 +95,6 @@
                                      GrPathFill fill) const { return false; }
 
     /**
-     * @return true if the path renderer can perform anti-aliasing (aside from
-     * having FSAA enabled for a render target). Target is provided to
-     * communicate the draw state (blend mode, stage settings, etc).
-     */
-    virtual bool supportsAA(const GrDrawTarget* target,
-                            const SkPath& path,
-                            GrPathFill fill) const { return false; }
-
-    /**
      * Sets the path to render and target to render into. All calls to drawPath
      * and drawPathToStencil must occur between setPath and clearPath. The
      * path cannot be modified externally between setPath and clearPath. The
@@ -125,12 +109,14 @@
      * @param target                the target to draw into.
      * @param path                  the path to draw.
      * @param fill                  the fill rule to apply.
+     * @param antiAlias             perform antiAliasing when drawing the path.
      * @param translate             optional additional translation to apply to
      *                              the path. NULL means (0,0).
      */
     void setPath(GrDrawTarget* target,
                  const SkPath* path,
                  GrPathFill fill,
+                 bool antiAlias,
                  const GrPoint* translate);
 
     /**
@@ -179,24 +165,26 @@
             fPathRenderer = NULL;
         }
         AutoClearPath(GrPathRenderer* pr,
-                       GrDrawTarget* target,
-                       const SkPath* path,
-                       GrPathFill fill,
-                       const GrPoint* translate) {
+                      GrDrawTarget* target,
+                      const SkPath* path,
+                      GrPathFill fill,
+                      bool antiAlias,
+                      const GrPoint* translate) {
             GrAssert(NULL != pr);
-            pr->setPath(target, path, fill, translate);
+            pr->setPath(target, path, fill, antiAlias, translate);
             fPathRenderer = pr;
         }
         void set(GrPathRenderer* pr,
                  GrDrawTarget* target,
                  const SkPath* path,
                  GrPathFill fill,
+                 bool antiAlias,
                  const GrPoint* translate) {
             if (NULL != fPathRenderer) {
                 fPathRenderer->clearPath();
             }
             GrAssert(NULL != pr);
-            pr->setPath(target, path, fill, translate);
+            pr->setPath(target, path, fill, antiAlias, translate);
             fPathRenderer = pr;
         }
         ~AutoClearPath() {
@@ -219,6 +207,7 @@
     GrDrawTarget*               fTarget;
     GrPathFill                  fFill;
     GrPoint                     fTranslate;
+    bool                        fAntiAlias;
 
 private:
 
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 7a064e8..a45437b 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -32,25 +32,20 @@
     return pr;
 }
 
-GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrDrawTarget* target,
-                                                     const GrPath& path,
-                                                     GrPathFill fill) {
+GrPathRenderer* GrPathRendererChain::getPathRenderer(
+                                        const GrDrawTarget::Caps& targetCaps,
+                                        const GrPath& path,
+                                        GrPathFill fill,
+                                        bool antiAlias) {
     if (!fInit) {
         this->init();
     }
-    bool preferAA = target->isAntialiasState() && 
-                    !target->getRenderTarget()->isMultisampled();
-    GrPathRenderer* nonAAPR = NULL;
     for (int i = 0; i < fChain.count(); ++i) {
-        if (fChain[i]->canDrawPath(target, path, fill)) {
-            if (!preferAA || fChain[i]->supportsAA(target, path, fill)) {
-                return fChain[i];
-            } else {
-                nonAAPR = fChain[i];
-            }
+        if (fChain[i]->canDrawPath(targetCaps, path, fill, antiAlias)) {
+            return fChain[i];
         }
     }
-    return nonAAPR;
+    return NULL;
 }
 
 void GrPathRendererChain::init() {
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h
index 5719484..8f95ea3 100644
--- a/src/gpu/GrPathRendererChain.h
+++ b/src/gpu/GrPathRendererChain.h
@@ -10,11 +10,12 @@
 #ifndef GrPathRendererChain_DEFINED
 #define GrPathRendererChain_DEFINED
 
+#include "GrDrawTarget.h"
 #include "GrRefCnt.h"
 #include "SkTArray.h"
 
 class GrContext;
-class GrDrawTarget;
+
 class SkPath;
 class GrPathRenderer;
 
@@ -39,9 +40,10 @@
     // takes a ref and unrefs in destructor
     GrPathRenderer* addPathRenderer(GrPathRenderer* pr);
 
-    GrPathRenderer* getPathRenderer(const GrDrawTarget* target,
+    GrPathRenderer* getPathRenderer(const GrDrawTarget::Caps& targetCaps,
                                     const SkPath& path,
-                                    GrPathFill fill);
+                                    GrPathFill fill,
+                                    bool antiAlias);
 
 private:
 
diff --git a/src/gpu/GrTesselatedPathRenderer.cpp b/src/gpu/GrTesselatedPathRenderer.cpp
index 3c4bb01..5c5a50e 100644
--- a/src/gpu/GrTesselatedPathRenderer.cpp
+++ b/src/gpu/GrTesselatedPathRenderer.cpp
@@ -457,7 +457,7 @@
     }
 
     if (subpathCnt == 1 && !inverted && fPath->isConvex()) {
-        if (fTarget->isAntialiasState()) {
+        if (fAntiAlias) {
             GrEdgeArray edges;
             GrMatrix inverse, matrix = fTarget->getViewMatrix();
             fTarget->getViewInverse(&inverse);
@@ -492,7 +492,7 @@
         return;
     }
 
-    if (fTarget->isAntialiasState()) {
+    if (fAntiAlias) {
         // Run the tesselator once to get the boundaries.
         GrBoundaryTess btess(count, fill_type_to_glu_winding_rule(fFill));
         btess.addVertices(base, subpathVertCount, subpathCnt);
@@ -590,9 +590,10 @@
     }
 }
 
-bool GrTesselatedPathRenderer::canDrawPath(const GrDrawTarget* target,
+bool GrTesselatedPathRenderer::canDrawPath(const GrDrawTarget::Caps& caps,
                                            const SkPath& path,
-                                           GrPathFill fill) const {
+                                           GrPathFill fill,
+                                           bool antiAlias) const {
     return kHairLine_PathFill != fill;
 }
 
@@ -600,8 +601,3 @@
     GrAlwaysAssert(!"multipass stencil should not be needed");
 }
 
-bool GrTesselatedPathRenderer::supportsAA(const GrDrawTarget* target,
-                                          const SkPath& path,
-                                          GrPathFill fill) const {
-    return true;
-}
diff --git a/src/gpu/GrTesselatedPathRenderer.h b/src/gpu/GrTesselatedPathRenderer.h
index d4f2243..18cead2 100644
--- a/src/gpu/GrTesselatedPathRenderer.h
+++ b/src/gpu/GrTesselatedPathRenderer.h
@@ -17,17 +17,11 @@
     GrTesselatedPathRenderer();
 
     virtual void drawPath(GrDrawTarget::StageBitfield stages);
-    virtual bool canDrawPath(const GrDrawTarget* target,
+    virtual bool canDrawPath(const GrDrawTarget::Caps& targetCaps,
                              const GrPath& path,
-                             GrPathFill fill) const;
-
-    virtual bool requiresStencilPass(const GrDrawTarget* target,
-                                     const GrPath& path,
-                                     GrPathFill fill) const { return false; }
-    virtual void drawPathToStencil();
-    virtual bool supportsAA(const GrDrawTarget* target,
-                            const GrPath& path,
-                            GrPathFill fill) const;
+                             GrPathFill fill,
+                             bool antiAlias) const SK_OVERRIDE;
+    virtual void drawPathToStencil() SK_OVERRIDE;
 };
 
 #endif