Add a stencil test for transparent tessellated strokes
Initially we restricted tessellated stroking to opaque solid colors.
This CL adds support for transparency by enabling a stencil test. The
stencil test also allows us to use mixed samples.
Bug: skia:10419
Change-Id: Ie40f3099d2b009f92ed49f7f43e5f269b1a479af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340798
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/tessellate/GrStrokeOp.h b/src/gpu/tessellate/GrStrokeOp.h
index ce5d855..7cd4c82 100644
--- a/src/gpu/tessellate/GrStrokeOp.h
+++ b/src/gpu/tessellate/GrStrokeOp.h
@@ -34,10 +34,10 @@
bool hasMixedSampledCoverage, GrClampType) override;
CombineResult onCombineIfPossible(GrOp*, SkArenaAlloc*, const GrCaps&) override;
- void prePrepareColorProgram(SkArenaAlloc* arena, GrStrokeTessellateShader*,
- const GrSurfaceProxyView&, GrAppliedClip&&,
- const GrXferProcessor::DstProxyView&, GrXferBarrierFlags,
- GrLoadOp colorLoadOp, const GrCaps&);
+ void prePreparePrograms(SkArenaAlloc* arena, GrStrokeTessellateShader*,
+ const GrSurfaceProxyView&, GrAppliedClip&&,
+ const GrXferProcessor::DstProxyView&, GrXferBarrierFlags,
+ GrLoadOp colorLoadOp, const GrCaps&);
static float NumCombinedSegments(float numParametricSegments, float numRadialSegments) {
// The first and last edges are shared by both the parametric and radial sets of edges, so
@@ -76,12 +76,14 @@
// smoothness.
const float fNumRadialSegmentsPerRadian;
SkPMColor4f fColor;
+ bool fNeedsStencil = false;
GrProcessorSet fProcessors;
GrSTArenaList<SkPath> fPathList;
int fTotalCombinedVerbCnt;
- const GrProgramInfo* fColorProgram = nullptr;
+ const GrProgramInfo* fStencilProgram = nullptr;
+ const GrProgramInfo* fFillProgram = nullptr;
};
#endif