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
This commit is contained in:
parent
01015fbea1
commit
a224bb7027
@ -64,9 +64,8 @@ class GrDrawPathBatch final : public GrDrawPathBatchBase {
|
||||
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 @@ public:
|
||||
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);
|
||||
}
|
||||
|
@ -94,12 +94,10 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
|
||||
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 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
|
||||
// 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 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user