Remove ref counting from GrOp.
Instead use std::unique_ptr to manage GrOp lifetime.
Change-Id: Ic1dc1e0ffd7254c3994221f498677af5bbf66a71
Reviewed-on: https://skia-review.googlesource.com/6479
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 0e74ad1..9fb2dcb 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -264,7 +264,8 @@
void GrRenderTargetOpList::addDrawOp(const GrPipelineBuilder& pipelineBuilder,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- sk_sp<GrDrawOp> op) {
+ std::unique_ptr<GrDrawOp>
+ op) {
// Setup clip
SkRect bounds;
op_bounds(&bounds, op.get());
@@ -384,14 +385,14 @@
return;
}
- sk_sp<GrOp> op = GrStencilPathOp::Make(viewMatrix,
- useHWAA,
- path->getFillType(),
- appliedClip.hasStencilClip(),
- stencilAttachment->bits(),
- appliedClip.scissorState(),
- renderTargetContext->accessRenderTarget(),
- path);
+ std::unique_ptr<GrOp> op = GrStencilPathOp::Make(viewMatrix,
+ useHWAA,
+ path->getFillType(),
+ appliedClip.hasStencilClip(),
+ stencilAttachment->bits(),
+ appliedClip.scissorState(),
+ renderTargetContext->accessRenderTarget(),
+ path);
this->recordOp(std::move(op), renderTargetContext, appliedClip.clippedDrawBounds());
}
@@ -408,7 +409,7 @@
fLastFullClearOp->setColor(color);
return;
}
- sk_sp<GrClearOp> op(GrClearOp::Make(GrFixedClip::Disabled(), color, renderTarget));
+ std::unique_ptr<GrClearOp> op(GrClearOp::Make(GrFixedClip::Disabled(), color, renderTarget));
if (GrOp* clearOp = this->recordOp(std::move(op), renderTargetContext)) {
// This is either the clear op we just created or another one that it combined with.
fLastFullClearOp = static_cast<GrClearOp*>(clearOp);
@@ -431,7 +432,7 @@
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
- sk_sp<GrOp> op = GrCopySurfaceOp::Make(dst, src, srcRect, dstPoint);
+ std::unique_ptr<GrOp> op = GrCopySurfaceOp::Make(dst, src, srcRect, dstPoint);
if (!op) {
return false;
}
@@ -460,7 +461,8 @@
out->fBottom = SkTMax(a.fBottom, b.fBottom);
}
-GrOp* GrRenderTargetOpList::recordOp(sk_sp<GrOp> op, GrRenderTargetContext* renderTargetContext,
+GrOp* GrRenderTargetOpList::recordOp(std::unique_ptr<GrOp> op,
+ GrRenderTargetContext* renderTargetContext,
const SkRect& clippedBounds) {
// TODO: Should be proxy ID.
GrGpuResource::UniqueID renderTargetID =