args.fPipelineBuilder = &pipelineBuilder;
args.fViewMatrix = &viewMatrix;
args.fPath = &clipPath;
- args.fStroke = &stroke;
pr->stencilPath(args);
}
}
/**
* This function is to get the stencil support for a particular path. The path's fill must
- * not be an inverse type.
+ * not be an inverse type. The path will always be filled and not stroked.
*
* @param path the path that will be drawn
- * @param stroke the stroke information (width, join, cap).
*/
- StencilSupport getStencilSupport(const SkPath& path, const GrStrokeInfo& stroke) const {
+ StencilSupport getStencilSupport(const SkPath& path) const {
SkASSERT(!path.isInverseFillType());
- return this->onGetStencilSupport(path, stroke);
+ return this->onGetStencilSupport(path);
}
/** Args to canDrawPath()
canArgs.fIsStencilBufferMSAA =
args.fPipelineBuilder->getRenderTarget()->isStencilBufferMultisampled();
SkASSERT(this->canDrawPath(canArgs));
- SkASSERT(args.fPipelineBuilder->getStencil().isDisabled() ||
- kNoRestriction_StencilSupport == this->getStencilSupport(*args.fPath,
- *args.fStroke));
+ if (!args.fPipelineBuilder->getStencil().isDisabled()) {
+ SkASSERT(kNoRestriction_StencilSupport == this->getStencilSupport(*args.fPath));
+ SkASSERT(!args.fStroke->isDashed());
+ SkASSERT(args.fStroke->isFillStyle());
+ }
#endif
return this->onDrawPath(args);
}
* fPipelineBuilder The pipeline builder.
* fViewMatrix Matrix applied to the path.
* fPath The path to draw.
- * fStroke The stroke information (width, join, cap)
*/
struct StencilPathArgs {
GrDrawTarget* fTarget;
GrPipelineBuilder* fPipelineBuilder;
const SkMatrix* fViewMatrix;
const SkPath* fPath;
- const GrStrokeInfo* fStroke;
void validate() const {
SkASSERT(fTarget);
SkASSERT(fPipelineBuilder);
SkASSERT(fViewMatrix);
SkASSERT(fPath);
- SkASSERT(fStroke);
SkASSERT(!fPath->isEmpty());
}
};
*/
void stencilPath(const StencilPathArgs& args) {
SkDEBUGCODE(args.validate();)
- SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(*args.fPath, *args.fStroke));
+ SkASSERT(kNoSupport_StencilSupport != this->getStencilSupport(*args.fPath));
this->onStencilPath(args);
}
/**
* Subclass overrides if it has any limitations of stenciling support.
*/
- virtual StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const {
+ virtual StencilSupport onGetStencilSupport(const SkPath&) const {
return kNoRestriction_StencilSupport;
}
drawArgs.fColor = 0xFFFFFFFF;
drawArgs.fViewMatrix = args.fViewMatrix;
drawArgs.fPath = args.fPath;
- drawArgs.fStroke = args.fStroke;
+ drawArgs.fStroke = &GrStrokeInfo::FillInfo();
drawArgs.fAntiAlias = false;
drawArgs.fGammaCorrect = false;
this->drawPath(drawArgs);
return pr;
}
-GrPathRenderer* GrPathRendererChain::getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args,
- DrawType drawType,
- GrPathRenderer::StencilSupport* stencilSupport) {
+GrPathRenderer* GrPathRendererChain::getPathRenderer(
+ const GrPathRenderer::CanDrawPathArgs& args,
+ DrawType drawType,
+ GrPathRenderer::StencilSupport* stencilSupport) {
GR_STATIC_ASSERT(GrPathRenderer::kNoSupport_StencilSupport <
GrPathRenderer::kStencilOnly_StencilSupport);
GR_STATIC_ASSERT(GrPathRenderer::kStencilOnly_StencilSupport <
} else {
minStencilSupport = GrPathRenderer::kNoSupport_StencilSupport;
}
+ if (minStencilSupport != GrPathRenderer::kNoSupport_StencilSupport) {
+ // We don't support (and shouldn't need) stenciling of non-fill paths.
+ if (!args.fStroke->isFillStyle() || args.fStroke->isDashed()) {
+ return nullptr;
+ }
+ }
for (int i = 0; i < fChain.count(); ++i) {
if (fChain[i]->canDrawPath(args)) {
if (GrPathRenderer::kNoSupport_StencilSupport != minStencilSupport) {
GrPathRenderer::StencilSupport support =
- fChain[i]->getStencilSupport(*args.fPath, *args.fStroke);
+ fChain[i]->getStencilSupport(*args.fPath);
if (support < minStencilSupport) {
continue;
} else if (stencilSupport) {
: fContext(context) {
}
private:
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ StencilSupport onGetStencilSupport(const SkPath&) const override {
return GrPathRenderer::kNoSupport_StencilSupport;
}
virtual ~GrAADistanceFieldPathRenderer();
private:
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ StencilSupport onGetStencilSupport(const SkPath&) const override {
return GrPathRenderer::kNoSupport_StencilSupport;
}
private:
bool onCanDrawPath(const CanDrawPathArgs&) const override;
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ StencilSupport onGetStencilSupport(const SkPath&) const override {
return kNoSupport_StencilSupport;
}
}
GrPathRenderer::StencilSupport
-GrDefaultPathRenderer::onGetStencilSupport(const SkPath& path, const GrStrokeInfo& stroke) const {
- if (single_pass_path(path, stroke)) {
+GrDefaultPathRenderer::onGetStencilSupport(const SkPath& path) const {
+ if (single_pass_path(path, SkStrokeRec(SkStrokeRec::kFill_InitStyle))) {
return GrPathRenderer::kNoRestriction_StencilSupport;
} else {
return GrPathRenderer::kStencilOnly_StencilSupport;
SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix,
- *args.fPath, *args.fStroke, true);
+ *args.fPath, GrStrokeInfo::FillInfo(), true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
private:
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&) const override;
bool onCanDrawPath(const CanDrawPathArgs&) const override;
}
GrPathRenderer::StencilSupport
-GrMSAAPathRenderer::onGetStencilSupport(const SkPath& path, const GrStrokeInfo& stroke) const {
- if (single_pass_path(path, stroke)) {
+GrMSAAPathRenderer::onGetStencilSupport(const SkPath& path) const {
+ if (single_pass_path(path, SkStrokeRec(SkStrokeRec::kFill_InitStyle))) {
return GrPathRenderer::kNoRestriction_StencilSupport;
} else {
return GrPathRenderer::kStencilOnly_StencilSupport;
SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix,
- *args.fPath, *args.fStroke, true);
+ *args.fPath, GrStrokeInfo::FillInfo(), true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
class SK_API GrMSAAPathRenderer : public GrPathRenderer {
private:
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override;
+ StencilSupport onGetStencilSupport(const SkPath&) const override;
bool onCanDrawPath(const CanDrawPathArgs&) const override;
GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),
"GrStencilAndCoverPathRenderer::onStencilPath");
SkASSERT(!args.fPath->isInverseFillType());
- SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fPath, *args.fStroke));
+ SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fPath, GrStrokeInfo::FillInfo()));
args.fTarget->stencilPath(*args.fPipelineBuilder, *args.fViewMatrix, p, p->getFillType());
}
private:
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ StencilSupport onGetStencilSupport(const SkPath&) const override {
return GrPathRenderer::kStencilOnly_StencilSupport;
}
private:
bool onCanDrawPath(const CanDrawPathArgs& ) const override;
- StencilSupport onGetStencilSupport(const SkPath&, const GrStrokeInfo&) const override {
+ StencilSupport onGetStencilSupport(const SkPath&) const override {
return GrPathRenderer::kNoSupport_StencilSupport;
}