Don't use analytic clip FPs when drawing to stencil
It doesn't make sense to multiply by coverage when drawing to stencil.
This could theoretically work with FPs that discard and/or modify
the sample mask, but for the time being an analytic FP means one that
calculates a coverage value.
Bug: skia:7190
Change-Id: I44140a5823f8683ec08244bdf9d369f51fa05dd9
Reviewed-on: https://skia-review.googlesource.com/68362
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index e1ce24c..b259d78 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -623,7 +623,7 @@
fRenderTargetContext->getRTOpList()->addOp(std::move(op), *fRenderTargetContext->caps());
}
-void GrRenderTargetContextPriv::stencilPath(const GrClip& clip,
+void GrRenderTargetContextPriv::stencilPath(const GrHardClip& clip,
GrAAType aaType,
const SkMatrix& viewMatrix,
const GrPath* path) {
@@ -645,16 +645,12 @@
SkRect bounds = SkRect::MakeIWH(fRenderTargetContext->width(), fRenderTargetContext->height());
// Setup clip
- GrAppliedClip appliedClip;
- if (!clip.apply(fRenderTargetContext->fContext, fRenderTargetContext, useHWAA, true,
- &appliedClip, &bounds)) {
+ GrAppliedHardClip appliedClip;
+ if (!clip.apply(fRenderTargetContext->width(), fRenderTargetContext->height(), &appliedClip,
+ &bounds)) {
return;
}
- // Coverage AA does not make sense when rendering to the stencil buffer. The caller should never
- // attempt this in a situation that would require coverage AA.
- SkASSERT(!appliedClip.numClipCoverageFragmentProcessors());
-
fRenderTargetContext->setNeedsStencil();
std::unique_ptr<GrOp> op = GrStencilPathOp::Make(viewMatrix,
@@ -670,7 +666,7 @@
fRenderTargetContext->getRTOpList()->addOp(std::move(op), *fRenderTargetContext->caps());
}
-void GrRenderTargetContextPriv::stencilRect(const GrClip& clip,
+void GrRenderTargetContextPriv::stencilRect(const GrHardClip& clip,
const GrUserStencilSettings* ss,
GrAAType aaType,
const SkMatrix& viewMatrix,
@@ -691,7 +687,7 @@
fRenderTargetContext->addDrawOp(clip, std::move(op));
}
-bool GrRenderTargetContextPriv::drawAndStencilRect(const GrClip& clip,
+bool GrRenderTargetContextPriv::drawAndStencilRect(const GrHardClip& clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,
@@ -1594,7 +1590,7 @@
this->internalDrawPath(clip, std::move(paint), aa, viewMatrix, path, style);
}
-bool GrRenderTargetContextPriv::drawAndStencilPath(const GrClip& clip,
+bool GrRenderTargetContextPriv::drawAndStencilPath(const GrHardClip& clip,
const GrUserStencilSettings* ss,
SkRegion::Op op,
bool invert,