Remove GrPendingIOResource
AFAICT these three remaining uses of GrPendingIOResource were just real-ref placeholders (i.e., they just added 1 pending read and then held on to the GrPendingIOResource until object destruction).
Change-Id: Iba6bb199477d846d079999f09794422e240c675a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235458
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index 4388524..5d93e45 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -79,10 +79,10 @@
const SkMatrix& viewMatrix,
GrPaint&& paint,
GrAA aa,
- GrPath* path) {
+ sk_sp<const GrPath> path) {
GrOpMemoryPool* pool = context->priv().opMemoryPool();
- return pool->allocate<GrDrawPathOp>(viewMatrix, std::move(paint), aa, path);
+ return pool->allocate<GrDrawPathOp>(viewMatrix, std::move(paint), aa, std::move(path));
}
void GrDrawPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index cd4ecc30..fd9631b 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -71,7 +71,7 @@
DEFINE_OP_CLASS_ID
static std::unique_ptr<GrDrawOp> Make(
- GrRecordingContext*, const SkMatrix& viewMatrix, GrPaint&&, GrAA, GrPath*);
+ GrRecordingContext*, const SkMatrix& viewMatrix, GrPaint&&, GrAA, sk_sp<const GrPath>);
const char* name() const override { return "DrawPath"; }
@@ -82,16 +82,16 @@
private:
friend class GrOpMemoryPool; // for ctor
- GrDrawPathOp(const SkMatrix& viewMatrix, GrPaint&& paint, GrAA aa, const GrPath* path)
+ GrDrawPathOp(const SkMatrix& viewMatrix, GrPaint&& paint, GrAA aa, sk_sp<const GrPath> path)
: GrDrawPathOpBase(
ClassID(), viewMatrix, std::move(paint), path->getFillType(), aa)
- , fPath(path) {
- this->setTransformedBounds(path->getBounds(), viewMatrix, HasAABloat::kNo, IsZeroArea::kNo);
+ , fPath(std::move(path)) {
+ this->setTransformedBounds(fPath->getBounds(), viewMatrix, HasAABloat::kNo, IsZeroArea::kNo);
}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
- GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
+ sk_sp<const GrPath> fPath;
typedef GrDrawPathOpBase INHERITED;
};
diff --git a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
index b2a4105..c05b955 100644
--- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
@@ -79,7 +79,7 @@
"GrStencilAndCoverPathRenderer::onStencilPath");
sk_sp<GrPath> p(get_gr_path(fResourceProvider, *args.fShape));
args.fRenderTargetContext->priv().stencilPath(
- *args.fClip, args.fDoStencilMSAA, *args.fViewMatrix, p.get());
+ *args.fClip, args.fDoStencilMSAA, *args.fViewMatrix, std::move(p));
}
bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
@@ -120,7 +120,7 @@
// Just ignore the analytic FPs (if any) during the stencil pass. They will still clip the
// final draw and it is meaningless to multiply by coverage when drawing to stencil.
args.fRenderTargetContext->priv().stencilPath(
- stencilClip, GrAA(doStencilMSAA), viewMatrix, path.get());
+ stencilClip, GrAA(doStencilMSAA), viewMatrix, std::move(path));
{
static constexpr GrUserStencilSettings kInvertedCoverPass(
@@ -162,7 +162,8 @@
}
} else {
std::unique_ptr<GrDrawOp> op = GrDrawPathOp::Make(
- args.fContext, viewMatrix, std::move(args.fPaint), GrAA(doStencilMSAA), path.get());
+ args.fContext, viewMatrix, std::move(args.fPaint), GrAA(doStencilMSAA),
+ std::move(path));
args.fRenderTargetContext->addDrawOp(*args.fClip, std::move(op));
}
diff --git a/src/gpu/ops/GrStencilPathOp.cpp b/src/gpu/ops/GrStencilPathOp.cpp
index f0b9f5a..0707678 100644
--- a/src/gpu/ops/GrStencilPathOp.cpp
+++ b/src/gpu/ops/GrStencilPathOp.cpp
@@ -17,14 +17,13 @@
std::unique_ptr<GrOp> GrStencilPathOp::Make(GrRecordingContext* context,
const SkMatrix& viewMatrix,
bool useHWAA,
- GrPathRendering::FillType fillType,
bool hasStencilClip,
const GrScissorState& scissor,
- const GrPath* path) {
+ sk_sp<const GrPath> path) {
GrOpMemoryPool* pool = context->priv().opMemoryPool();
- return pool->allocate<GrStencilPathOp>(viewMatrix, useHWAA, fillType,
- hasStencilClip, scissor, path);
+ return pool->allocate<GrStencilPathOp>(viewMatrix, useHWAA,
+ hasStencilClip, scissor, std::move(path));
}
void GrStencilPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
@@ -32,7 +31,7 @@
SkASSERT(rt);
int numStencilBits = rt->renderTargetPriv().numStencilBits();
- GrStencilSettings stencil(GrPathRendering::GetStencilPassSettings(fFillType),
+ GrStencilSettings stencil(GrPathRendering::GetStencilPassSettings(fPath->getFillType()),
fHasStencilClip, numStencilBits);
GrPathRendering::StencilPathArgs args(fUseHWAA, state->drawOpArgs().fProxy,
diff --git a/src/gpu/ops/GrStencilPathOp.h b/src/gpu/ops/GrStencilPathOp.h
index f78356b..958c5c0 100644
--- a/src/gpu/ops/GrStencilPathOp.h
+++ b/src/gpu/ops/GrStencilPathOp.h
@@ -23,10 +23,9 @@
static std::unique_ptr<GrOp> Make(GrRecordingContext* context,
const SkMatrix& viewMatrix,
bool useHWAA,
- GrPathRendering::FillType fillType,
bool hasStencilClip,
const GrScissorState& scissor,
- const GrPath* path);
+ sk_sp<const GrPath> path);
const char* name() const override { return "StencilPathOp"; }
@@ -44,30 +43,27 @@
GrStencilPathOp(const SkMatrix& viewMatrix,
bool useHWAA,
- GrPathRendering::FillType fillType,
bool hasStencilClip,
const GrScissorState& scissor,
- const GrPath* path)
+ sk_sp<const GrPath> path)
: INHERITED(ClassID())
, fViewMatrix(viewMatrix)
, fUseHWAA(useHWAA)
- , fFillType(fillType)
, fHasStencilClip(hasStencilClip)
, fScissor(scissor)
- , fPath(path) {
- this->setBounds(path->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
+ , fPath(std::move(path)) {
+ this->setBounds(fPath->getBounds(), HasAABloat::kNo, IsZeroArea::kNo);
}
void onPrepare(GrOpFlushState*) override {}
void onExecute(GrOpFlushState*, const SkRect& chainBounds) override;
- SkMatrix fViewMatrix;
- bool fUseHWAA;
- GrPathRendering::FillType fFillType;
- bool fHasStencilClip;
- GrScissorState fScissor;
- GrPendingIOResource<const GrPath, kRead_GrIOType> fPath;
+ SkMatrix fViewMatrix;
+ bool fUseHWAA;
+ bool fHasStencilClip;
+ GrScissorState fScissor;
+ sk_sp<const GrPath> fPath;
typedef GrOp INHERITED;
};