diff options
author | 2016-08-12 15:11:51 -0700 | |
---|---|---|
committer | 2016-08-12 15:11:51 -0700 | |
commit | 5c6fc4fbfd425a91bbb9cd493517bd3c9aa6ad55 (patch) | |
tree | e80776aae2b6dea8537325319faabe844e200956 /src/gpu | |
parent | ca39d716f10e75e3a2449262e67584f46d589c26 (diff) |
Remove stencil settings param from stencilPath()
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
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrDrawContext.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrDrawContextPriv.h | 1 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.h | 10 | ||||
-rw-r--r-- | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp | 39 |
5 files changed, 25 insertions, 31 deletions
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index d73097a816..76e0d8a66c 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -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, diff --git a/src/gpu/GrDrawContextPriv.h b/src/gpu/GrDrawContextPriv.h index 6f7d5b4002..31d8481c73 100644 --- a/src/gpu/GrDrawContextPriv.h +++ b/src/gpu/GrDrawContextPriv.h @@ -34,7 +34,6 @@ public: const SkRect& rect); void stencilPath(const GrClip&, - const GrUserStencilSettings* ss, bool useHWAA, const SkMatrix& viewMatrix, const GrPath*); diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 32f755e0eb..e143f90291 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -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. diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h index 6a2c5f5c19..682dd2de33 100644 --- a/src/gpu/GrDrawTarget.h +++ b/src/gpu/GrDrawTarget.h @@ -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*); diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index 02d74fff6e..5d280efac2 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -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()); |