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
This commit is contained in:
csmartdalton 2016-08-12 15:11:51 -07:00 committed by Commit bot
parent ca39d716f1
commit 5c6fc4fbfd
5 changed files with 25 additions and 31 deletions

View 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,

View File

@ -34,7 +34,6 @@ public:
const SkRect& rect);
void stencilPath(const GrClip&,
const GrUserStencilSettings* ss,
bool useHWAA,
const SkMatrix& viewMatrix,
const GrPath*);

View 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.

View 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*);

View 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());