Remove stencil settings param from stencilPath()
authorcsmartdalton <csmartdalton@google.com>
Fri, 12 Aug 2016 22:11:51 +0000 (15:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 12 Aug 2016 22:11:51 +0000 (15:11 -0700)
stencilPath() picks its own user stencil settings. This argument
should not be there.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241873002

Review-Url: https://codereview.chromium.org/2241873002

src/gpu/GrDrawContext.cpp
src/gpu/GrDrawContextPriv.h
src/gpu/GrDrawTarget.cpp
src/gpu/GrDrawTarget.h
src/gpu/batches/GrStencilAndCoverPathRenderer.cpp

index d73097a..76e0d8a 100644 (file)
@@ -542,11 +542,10 @@ void GrDrawContextPriv::clearStencilClip(const SkIRect& rect, bool insideClip) {
 }
 
 void GrDrawContextPriv::stencilPath(const GrClip& clip, 
-                                    const GrUserStencilSettings* ss,
                                     bool useHWAA,
                                     const SkMatrix& viewMatrix,
                                     const GrPath* path) {
-    fDrawContext->getDrawTarget()->stencilPath(fDrawContext, clip, ss, useHWAA, viewMatrix, path);
+    fDrawContext->getDrawTarget()->stencilPath(fDrawContext, clip, useHWAA, viewMatrix, path);
 }
 
 void GrDrawContextPriv::stencilRect(const GrFixedClip& clip,
index 6f7d5b4..31d8481 100644 (file)
@@ -34,7 +34,6 @@ public:
                      const SkRect& rect);
 
     void stencilPath(const GrClip&,
-                     const GrUserStencilSettings* ss,
                      bool useHWAA,
                      const SkMatrix& viewMatrix,
                      const GrPath*);
index 32f755e..e143f90 100644 (file)
@@ -417,7 +417,6 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
 
 void GrDrawTarget::stencilPath(GrDrawContext* drawContext,
                                const GrClip& clip,
-                               const GrUserStencilSettings* ss,
                                bool useHWAA,
                                const SkMatrix& viewMatrix,
                                const GrPath* path) {
@@ -427,7 +426,7 @@ void GrDrawTarget::stencilPath(GrDrawContext* drawContext,
 
     // Setup clip
     GrAppliedClip appliedClip;
-    if (!clip.apply(fContext, drawContext, nullptr, useHWAA, SkToBool(ss), &appliedClip)) {
+    if (!clip.apply(fContext, drawContext, nullptr, useHWAA, true, &appliedClip)) {
         return;
     }
     // TODO: respect fClipBatchToBounds if we ever start computing bounds here.
index 6a2c5f5..682dd2d 100644 (file)
@@ -111,14 +111,14 @@ public:
     void addBatch(sk_sp<GrBatch>);
 
     /**
-     * Draws path into the stencil buffer. The path's fill must be either even/odd or
-     * winding (not inverse or hairline). It will respect the HW antialias boolean
-     * (if possible in the 3D API).  Note, we will never have an inverse
-     * fill with stencil path
+     * Draws the path into user stencil bits. Upon return, all user stencil values
+     * inside the path will be nonzero. The path's fill must be either even/odd or
+     * winding (notnverse or hairline).It will respect the HW antialias boolean (if
+     * possible in the 3D API).  Note, we will never have an inverse fill with
+     * stencil path.
      */
     void stencilPath(GrDrawContext*,
                      const GrClip&,
-                     const GrUserStencilSettings*,
                      bool useHWAA,
                      const SkMatrix& viewMatrix,
                      const GrPath*);
index 02d74ff..5d280ef 100644 (file)
@@ -76,8 +76,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(const StencilPathArgs& args) {
     args.fShape->asPath(&path);
 
     SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, GrStyle::SimpleFill()));
-    args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, nullptr, args.fIsAA,
-                                                     *args.fViewMatrix, p);
+    args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fIsAA, *args.fViewMatrix, p);
 }
 
 bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
@@ -94,25 +93,6 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
     SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, args.fShape->style()));
 
     if (path.isInverseFillType()) {
-        static constexpr GrUserStencilSettings kInvertedCoverPass(
-            GrUserStencilSettings::StaticInit<
-                0x0000,
-                // We know our rect will hit pixels outside the clip and the user bits will be 0
-                // outside the clip. So we can't just fill where the user bits are 0. We also need
-                // to check that the clip bit is set.
-                GrUserStencilTest::kEqualIfInClip,
-                0xffff,
-                GrUserStencilOp::kKeep,
-                GrUserStencilOp::kZero,
-                0xffff>()
-        );
-
-        // fake inverse with a stencil and cover
-        args.fDrawContext->drawContextPriv().stencilPath(*args.fClip,
-                                                         &kInvertedCoverPass,
-                                                         args.fPaint->isAntiAlias(),
-                                                         viewMatrix, p);
-
         SkMatrix invert = SkMatrix::I();
         SkRect bounds =
             SkRect::MakeLTRB(0, 0,
@@ -137,7 +117,24 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
                 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), viewM, bounds,
                                                     nullptr, &invert));
 
+        // fake inverse with a stencil and cover
+        args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(),
+                                                         viewMatrix, p);
+
         {
+            static constexpr GrUserStencilSettings kInvertedCoverPass(
+                GrUserStencilSettings::StaticInit<
+                    0x0000,
+                    // We know our rect will hit pixels outside the clip and the user bits will
+                    // be 0 outside the clip. So we can't just fill where the user bits are 0. We
+                    // also need to check that the clip bit is set.
+                    GrUserStencilTest::kEqualIfInClip,
+                    0xffff,
+                    GrUserStencilOp::kKeep,
+                    GrUserStencilOp::kZero,
+                    0xffff>()
+            );
+
             GrPipelineBuilder pipelineBuilder(*args.fPaint,
                                               args.fPaint->isAntiAlias() &&
                                               !args.fDrawContext->hasMixedSamples());