Avoid unnecessary GrShape->SkPath conversion in GrStencilAndCoverPathRenderer
Also remove redundant param to the path batch constructor.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2348543002
Review-Url: https://codereview.chromium.org/2348543002
diff --git a/src/gpu/batches/GrDrawPathBatch.h b/src/gpu/batches/GrDrawPathBatch.h
index cfdbc02..33bf678 100644
--- a/src/gpu/batches/GrDrawPathBatch.h
+++ b/src/gpu/batches/GrDrawPathBatch.h
@@ -64,9 +64,8 @@
public:
DEFINE_BATCH_CLASS_ID
- static GrDrawBatch* Create(const SkMatrix& viewMatrix, GrColor color,
- GrPathRendering::FillType fill, const GrPath* path) {
- return new GrDrawPathBatch(viewMatrix, color, fill, path);
+ static GrDrawBatch* Create(const SkMatrix& viewMatrix, GrColor color, const GrPath* path) {
+ return new GrDrawPathBatch(viewMatrix, color, path);
}
const char* name() const override { return "DrawPath"; }
@@ -74,9 +73,8 @@
SkString dumpInfo() const override;
private:
- GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, GrPathRendering::FillType fill,
- const GrPath* path)
- : INHERITED(ClassID(), viewMatrix, color, fill)
+ GrDrawPathBatch(const SkMatrix& viewMatrix, GrColor color, const GrPath* path)
+ : INHERITED(ClassID(), viewMatrix, color, path->getFillType())
, fPath(path) {
this->setTransformedBounds(path->getBounds(), viewMatrix, HasAABloat::kNo, IsZeroArea::kNo);
}
diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
index 69a3142..3bbd157 100644
--- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp
@@ -94,12 +94,10 @@
const SkMatrix& viewMatrix = *args.fViewMatrix;
- SkPath path;
- args.fShape->asPath(&path);
- SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
+ SkAutoTUnref<GrPath> path(get_gr_path(fResourceProvider, *args.fShape));
- if (path.isInverseFillType()) {
+ if (args.fShape->inverseFilled()) {
SkMatrix invert = SkMatrix::I();
SkRect bounds =
SkRect::MakeLTRB(0, 0,
@@ -126,7 +124,7 @@
// fake inverse with a stencil and cover
args.fDrawContext->drawContextPriv().stencilPath(*args.fClip, args.fPaint->isAntiAlias(),
- viewMatrix, p);
+ viewMatrix, path);
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@@ -160,8 +158,8 @@
0xffff>()
);
- SkAutoTUnref<GrDrawBatch> batch(
- GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p->getFillType(), p));
+ SkAutoTUnref<GrDrawBatch> batch(GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(),
+ path));
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);