Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: src/gpu/batches/GrStencilAndCoverPathRenderer.cpp

Issue 1962243002: Separate user and raw stencil settings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrPathStencilSettings.h ('k') | src/gpu/batches/GrStencilPathBatch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index ddba1c871eb1903f4ba2d01e968345d55a6976cc..1309dedd4c3c073ed60b5bd51ad964d3fb2be81d 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -36,7 +36,7 @@ bool GrStencilAndCoverPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
if (args.fStyle->hasNonDashPathEffect() || args.fStyle->strokeRec().isHairlineStyle()) {
return false;
}
- if (!args.fIsStencilDisabled) {
+ if (args.fHasUserStencilSettings) {
return false;
}
if (args.fAntiAlias) {
@@ -80,7 +80,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
GrPipelineBuilder* pipelineBuilder = args.fPipelineBuilder;
const SkMatrix& viewMatrix = *args.fViewMatrix;
- SkASSERT(pipelineBuilder->getStencil().isDisabled());
+ SkASSERT(!pipelineBuilder->hasUserStencilSettings());
if (args.fAntiAlias) {
SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled());
@@ -90,18 +90,21 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, *args.fStyle));
if (path.isInverseFillType()) {
- static constexpr GrStencilSettings kInvertedStencilPass(
- kKeep_StencilOp,
- kZero_StencilOp,
- // 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.
- kEqualIfInClip_StencilFunc,
- 0xffff,
- 0x0000,
- 0xffff);
-
- pipelineBuilder->setStencil(kInvertedStencilPass);
+ 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>()
+ );
+
+
+ pipelineBuilder->setUserStencil(&kInvertedCoverPass);
// fake inverse with a stencil and cover
args.fTarget->stencilPath(*pipelineBuilder, viewMatrix, p, p->getFillType());
@@ -133,20 +136,22 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
&invert));
args.fTarget->drawBatch(*pipelineBuilder, batch);
} else {
- static constexpr GrStencilSettings kStencilPass(
- kZero_StencilOp,
- kKeep_StencilOp,
- kNotEqual_StencilFunc,
- 0xffff,
- 0x0000,
- 0xffff);
-
- pipelineBuilder->setStencil(kStencilPass);
+ static constexpr GrUserStencilSettings kCoverPass(
+ GrUserStencilSettings::StaticInit<
+ 0x0000,
+ GrUserStencilTest::kNotEqual,
+ 0xffff,
+ GrUserStencilOp::kZero,
+ GrUserStencilOp::kKeep,
+ 0xffff>()
+ );
+
+ pipelineBuilder->setUserStencil(&kCoverPass);
SkAutoTUnref<GrDrawPathBatchBase> batch(
GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p));
args.fTarget->drawPathBatch(*pipelineBuilder, batch);
}
- pipelineBuilder->stencil()->setDisabled();
+ pipelineBuilder->disableUserStencil();
return true;
}
« no previous file with comments | « src/gpu/batches/GrPathStencilSettings.h ('k') | src/gpu/batches/GrStencilPathBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698