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/GrDrawOpTest.cpp b/src/gpu/GrDrawOpTest.cpp
index bb26acc..3cf1a90 100644
--- a/src/gpu/GrDrawOpTest.cpp
+++ b/src/gpu/GrDrawOpTest.cpp
@@ -12,7 +12,8 @@
#ifdef GR_TEST_UTILS
-#define DRAW_OP_TEST_EXTERN(Op) extern sk_sp<GrDrawOp> Op##__Test(SkRandom*, GrContext* context);
+#define DRAW_OP_TEST_EXTERN(Op) \
+ extern std::unique_ptr<GrDrawOp> Op##__Test(SkRandom*, GrContext* context);
#define DRAW_OP_TEST_ENTRY(Op) Op##__Test
@@ -37,8 +38,8 @@
DRAW_OP_TEST_EXTERN(TextBlobOp);
DRAW_OP_TEST_EXTERN(VerticesOp);
-sk_sp<GrDrawOp> GrRandomDrawOp(SkRandom* random, GrContext* context) {
- using MakeTestDrawOpFn = sk_sp<GrDrawOp>(SkRandom* random, GrContext* context);
+std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom* random, GrContext* context) {
+ using MakeTestDrawOpFn = std::unique_ptr<GrDrawOp>(SkRandom* random, GrContext* context);
static constexpr MakeTestDrawOpFn* gFactories[] = {
DRAW_OP_TEST_ENTRY(AAConvexPathOp),
DRAW_OP_TEST_ENTRY(AADistanceFieldPathOp),
diff --git a/src/gpu/GrDrawOpTest.h b/src/gpu/GrDrawOpTest.h
index 0d88a40..46abf18 100644
--- a/src/gpu/GrDrawOpTest.h
+++ b/src/gpu/GrDrawOpTest.h
@@ -18,14 +18,15 @@
class SkRandom;
/** This function returns a randomly configured GrDrawOp for testing purposes. */
-sk_sp<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*);
+std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*);
/** GrDrawOp subclasses should define test factory functions using this macro. */
-#define DRAW_OP_TEST_DEFINE(Op) sk_sp<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context)
+#define DRAW_OP_TEST_DEFINE(Op) \
+ std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context)
/** This macro may be used if the test factory function must be made a friend of a class. */
#define DRAW_OP_TEST_FRIEND(Op) \
- friend sk_sp<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context);
+ friend std::unique_ptr<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context);
#endif
#endif
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 93e8607..e9325fa 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -284,8 +284,8 @@
// This path doesn't handle coalescing of full screen clears b.c. it
// has to clear the entire render target - not just the content area.
// It could be done but will take more finagling.
- sk_sp<GrOp> op(GrClearOp::Make(rtRect, color, fRenderTargetContext->accessRenderTarget(),
- !clearRect));
+ std::unique_ptr<GrOp> op(GrClearOp::Make(
+ rtRect, color, fRenderTargetContext->accessRenderTarget(), !clearRect));
if (!op) {
return;
}
@@ -340,7 +340,7 @@
if (!this->accessRenderTarget()) {
return;
}
- sk_sp<GrOp> op(GrClearOp::Make(clip, color, this->accessRenderTarget()));
+ std::unique_ptr<GrOp> op(GrClearOp::Make(clip, color, this->accessRenderTarget()));
if (!op) {
return;
}
@@ -464,7 +464,7 @@
return true;
}
- sk_sp<GrDrawOp> op;
+ std::unique_ptr<GrDrawOp> op;
GrAAType aaType;
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
@@ -593,7 +593,7 @@
}
bool snapToPixelCenters = false;
- sk_sp<GrDrawOp> op;
+ std::unique_ptr<GrDrawOp> op;
GrColor color = paint.getColor();
GrAAType aaType = this->decideAAType(aa);
@@ -731,8 +731,9 @@
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- sk_sp<GrDrawOp> op(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
- croppedLocalRect, aa, fInstancedPipelineInfo, &aaType));
+ std::unique_ptr<GrDrawOp> op(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
+ croppedLocalRect, aa, fInstancedPipelineInfo,
+ &aaType));
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -748,8 +749,8 @@
}
if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- sk_sp<GrDrawOp> op = GrAAFillRectOp::MakeWithLocalRect(paint.getColor(), viewMatrix,
- croppedRect, croppedLocalRect);
+ std::unique_ptr<GrDrawOp> op = GrAAFillRectOp::MakeWithLocalRect(
+ paint.getColor(), viewMatrix, croppedRect, croppedLocalRect);
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->addDrawOp(pipelineBuilder, clip, std::move(op));
return;
@@ -789,8 +790,9 @@
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- sk_sp<GrDrawOp> op(ir->recordRect(croppedRect, viewMatrix, paint.getColor(), localMatrix,
- aa, fInstancedPipelineInfo, &aaType));
+ std::unique_ptr<GrDrawOp> op(ir->recordRect(croppedRect, viewMatrix, paint.getColor(),
+ localMatrix, aa, fInstancedPipelineInfo,
+ &aaType));
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -806,7 +808,7 @@
}
if (view_matrix_ok_for_aa_fill_rect(viewMatrix)) {
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
GrAAFillRectOp::Make(paint.getColor(), viewMatrix, localMatrix, croppedRect);
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -853,7 +855,7 @@
viewMatrix.mapRect(&bounds);
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
GrDrawVerticesOp::Make(paint.getColor(), primitiveType, viewMatrix, positions,
vertexCount, indices, indexCount, colors, texCoords, bounds);
@@ -877,7 +879,7 @@
AutoCheckFlush acf(fDrawingManager);
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
GrDrawAtlasOp::Make(paint.getColor(), viewMatrix, spriteCount, xform, texRect, colors);
GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -921,8 +923,8 @@
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() &&
stroke.isFillStyle()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- sk_sp<GrDrawOp> op(ir->recordRRect(rrect, viewMatrix, paint.getColor(), aa,
- fInstancedPipelineInfo, &aaType));
+ std::unique_ptr<GrDrawOp> op(ir->recordRRect(rrect, viewMatrix, paint.getColor(), aa,
+ fInstancedPipelineInfo, &aaType));
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, *clip, std::move(op));
@@ -933,12 +935,12 @@
aaType = this->decideAAType(aa);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- sk_sp<GrDrawOp> op = GrOvalOpFactory::MakeRRectOp(paint.getColor(),
- paint.usesDistanceVectorField(),
- viewMatrix,
- rrect,
- stroke,
- shaderCaps);
+ std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeRRectOp(paint.getColor(),
+ paint.usesDistanceVectorField(),
+ viewMatrix,
+ rrect,
+ stroke,
+ shaderCaps);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, *clip, std::move(op));
@@ -975,8 +977,8 @@
// TODO: add instancing support?
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- sk_sp<GrDrawOp> op = GrShadowRRectOp::Make(paint.getColor(), viewMatrix, rrect, blurRadius,
- stroke, shaderCaps);
+ std::unique_ptr<GrDrawOp> op = GrShadowRRectOp::Make(paint.getColor(), viewMatrix, rrect,
+ blurRadius, stroke, shaderCaps);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -998,8 +1000,9 @@
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- sk_sp<GrDrawOp> op(ir->recordDRRect(origOuter, origInner, viewMatrix, paintIn.getColor(),
- aa, fInstancedPipelineInfo, &aaType));
+ std::unique_ptr<GrDrawOp> op(ir->recordDRRect(origOuter, origInner, viewMatrix,
+ paintIn.getColor(), aa,
+ fInstancedPipelineInfo, &aaType));
if (op) {
GrPipelineBuilder pipelineBuilder(paintIn, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -1121,7 +1124,7 @@
return this->drawPath(clip, paint, aa, viewMatrix, path, style);
}
- sk_sp<GrDrawOp> op = GrRegionOp::Make(paint.getColor(), viewMatrix, region);
+ std::unique_ptr<GrDrawOp> op = GrRegionOp::Make(paint.getColor(), viewMatrix, region);
GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
}
@@ -1150,8 +1153,8 @@
if (GrCaps::InstancedSupport::kNone != fContext->caps()->instancedSupport() &&
stroke.isFillStyle()) {
InstancedRendering* ir = this->getOpList()->instancedRendering();
- sk_sp<GrDrawOp> op(ir->recordOval(oval, viewMatrix, paint.getColor(), aa,
- fInstancedPipelineInfo, &aaType));
+ std::unique_ptr<GrDrawOp> op(ir->recordOval(oval, viewMatrix, paint.getColor(), aa,
+ fInstancedPipelineInfo, &aaType));
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -1162,7 +1165,7 @@
aaType = this->decideAAType(aa);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
GrOvalOpFactory::MakeOvalOp(paint.getColor(), viewMatrix, oval, stroke, shaderCaps);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
@@ -1189,14 +1192,14 @@
GrAAType aaType = this->decideAAType(aa);
if (GrAAType::kCoverage == aaType) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- sk_sp<GrDrawOp> op = GrOvalOpFactory::MakeArcOp(paint.getColor(),
- viewMatrix,
- oval,
- startAngle,
- sweepAngle,
- useCenter,
- style,
- shaderCaps);
+ std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeArcOp(paint.getColor(),
+ viewMatrix,
+ oval,
+ startAngle,
+ sweepAngle,
+ useCenter,
+ style,
+ shaderCaps);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -1223,8 +1226,8 @@
AutoCheckFlush acf(fDrawingManager);
- sk_sp<GrDrawOp> op = GrLatticeOp::MakeNonAA(paint.getColor(), viewMatrix, imageWidth,
- imageHeight, std::move(iter), dst);
+ std::unique_ptr<GrDrawOp> op = GrLatticeOp::MakeNonAA(paint.getColor(), viewMatrix, imageWidth,
+ imageHeight, std::move(iter), dst);
GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone);
this->getOpList()->addDrawOp(pipelineBuilder, this, clip, std::move(op));
@@ -1258,8 +1261,8 @@
GrAAType hwOrNoneAAType) {
SkASSERT(GrAAType::kCoverage != hwOrNoneAAType);
SkASSERT(hwOrNoneAAType == GrAAType::kNone || this->isStencilBufferMultisampled());
- sk_sp<GrDrawOp> op = GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewMatrix, rect,
- localRect, localMatrix);
+ std::unique_ptr<GrDrawOp> op = GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewMatrix,
+ rect, localRect, localMatrix);
GrPipelineBuilder pipelineBuilder(paint, hwOrNoneAAType);
if (ss) {
pipelineBuilder.setUserStencil(ss);
@@ -1387,7 +1390,7 @@
SkRect rects[2];
if (fills_as_nested_rects(viewMatrix, path, rects)) {
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
GrRectOpFactory::MakeAAFillNestedRects(paint.getColor(), viewMatrix, rects);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
@@ -1401,7 +1404,7 @@
if (isOval && !path.isInverseFillType()) {
const GrShaderCaps* shaderCaps = fContext->caps()->shaderCaps();
- sk_sp<GrDrawOp> op = GrOvalOpFactory::MakeOvalOp(
+ std::unique_ptr<GrDrawOp> op = GrOvalOpFactory::MakeOvalOp(
paint.getColor(), viewMatrix, ovalRect, style.strokeRec(), shaderCaps);
if (op) {
GrPipelineBuilder pipelineBuilder(paint, aaType);
@@ -1580,7 +1583,7 @@
}
void GrRenderTargetContext::addDrawOp(const GrPipelineBuilder& pipelineBuilder, const GrClip& clip,
- sk_sp<GrDrawOp> op) {
+ std::unique_ptr<GrDrawOp> op) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h
index f1548cc..19ee9da 100644
--- a/src/gpu/GrRenderTargetContextPriv.h
+++ b/src/gpu/GrRenderTargetContextPriv.h
@@ -110,7 +110,7 @@
void testingOnly_addDrawOp(const GrPaint&,
GrAAType,
- sk_sp<GrDrawOp>,
+ std::unique_ptr<GrDrawOp>,
const GrUserStencilSettings* = nullptr,
bool snapToCenters = false);
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 =
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index a666860..216a330 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -79,9 +79,9 @@
const GrCaps* caps() const { return fGpu->caps(); }
void addDrawOp(const GrPipelineBuilder&, GrRenderTargetContext*, const GrClip&,
- sk_sp<GrDrawOp>);
+ std::unique_ptr<GrDrawOp>);
- void addOp(sk_sp<GrOp> op, GrRenderTargetContext* renderTargetContext) {
+ void addOp(std::unique_ptr<GrOp> op, GrRenderTargetContext* renderTargetContext) {
this->recordOp(std::move(op), renderTargetContext);
}
@@ -133,13 +133,13 @@
// If the input op is combined with an earlier op, this returns the combined op. Otherwise, it
// returns the input op.
- GrOp* recordOp(sk_sp<GrOp> op, GrRenderTargetContext* renderTargetContext) {
+ GrOp* recordOp(std::unique_ptr<GrOp> op, GrRenderTargetContext* renderTargetContext) {
SkRect bounds = op->bounds();
return this->recordOp(std::move(op), renderTargetContext, bounds);
}
// Variant that allows an explicit bounds (computed from the Op's bounds and a clip).
- GrOp* recordOp(sk_sp<GrOp>, GrRenderTargetContext*, const SkRect& clippedBounds);
+ GrOp* recordOp(std::unique_ptr<GrOp>, GrRenderTargetContext*, const SkRect& clippedBounds);
void forwardCombine();
@@ -155,7 +155,7 @@
void clearStencilClip(const GrFixedClip&, bool insideStencilMask, GrRenderTargetContext*);
struct RecordedOp {
- sk_sp<GrOp> fOp;
+ std::unique_ptr<GrOp> fOp;
SkRect fClippedBounds;
// TODO: Use proxy ID instead of instantiated render target ID.
GrGpuResource::UniqueID fRenderTargetID;
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index be56ad5..10343a3 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -190,7 +190,7 @@
maskMatrix,
GrSamplerParams::kNone_FilterMode));
- sk_sp<GrDrawOp> op = GrRectOpFactory::MakeNonAAFill(paint.getColor(), SkMatrix::I(), dstRect,
- nullptr, &invert);
+ std::unique_ptr<GrDrawOp> op = GrRectOpFactory::MakeNonAAFill(paint.getColor(), SkMatrix::I(),
+ dstRect, nullptr, &invert);
renderTargetContext->addDrawOp(pipelineBuilder, clip, std::move(op));
}
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index fc529ba..490d00e 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -77,8 +77,8 @@
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
- sk_sp<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewMatrix, rect, nullptr,
- &localMatrix));
+ std::unique_ptr<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewMatrix, rect,
+ nullptr, &localMatrix));
GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone);
pipelineBuilder.setUserStencil(&userStencilSettings);
diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp
index 2aaa8ca..61990de 100644
--- a/src/gpu/GrTextureOpList.cpp
+++ b/src/gpu/GrTextureOpList.cpp
@@ -82,7 +82,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;
}
@@ -95,7 +95,7 @@
return true;
}
-void GrTextureOpList::recordOp(sk_sp<GrOp> op, GrGpuResource::UniqueID renderTargetID) {
+void GrTextureOpList::recordOp(std::unique_ptr<GrOp> op, GrGpuResource::UniqueID renderTargetID) {
// A closed GrOpList should never receive new/more ops
SkASSERT(!this->isClosed());
diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h
index ccfa1fb..325ab5d 100644
--- a/src/gpu/GrTextureOpList.h
+++ b/src/gpu/GrTextureOpList.h
@@ -62,9 +62,9 @@
private:
// The unique ID is only needed for the audit trail. This should be removed with MDB.
- void recordOp(sk_sp<GrOp>, GrGpuResource::UniqueID renderTargetID);
+ void recordOp(std::unique_ptr<GrOp>, GrGpuResource::UniqueID renderTargetID);
- SkSTArray<2, sk_sp<GrOp>, true> fRecordedOps;
+ SkSTArray<2, std::unique_ptr<GrOp>, true> fRecordedOps;
GrGpu* fGpu;
typedef GrOpList INHERITED;
diff --git a/src/gpu/instanced/GLInstancedRendering.cpp b/src/gpu/instanced/GLInstancedRendering.cpp
index da764b2..0d2a2dd 100644
--- a/src/gpu/instanced/GLInstancedRendering.cpp
+++ b/src/gpu/instanced/GLInstancedRendering.cpp
@@ -60,7 +60,9 @@
return static_cast<GrGLGpu*>(this->gpu());
}
-sk_sp<InstancedRendering::Op> GLInstancedRendering::makeOp() { return sk_sp<Op>(new GLOp(this)); }
+std::unique_ptr<InstancedRendering::Op> GLInstancedRendering::makeOp() {
+ return std::unique_ptr<Op>(new GLOp(this));
+}
void GLInstancedRendering::onBeginFlush(GrResourceProvider* rp) {
// Count what there is to draw.
diff --git a/src/gpu/instanced/GLInstancedRendering.h b/src/gpu/instanced/GLInstancedRendering.h
index c77b61d..0088217 100644
--- a/src/gpu/instanced/GLInstancedRendering.h
+++ b/src/gpu/instanced/GLInstancedRendering.h
@@ -33,7 +33,7 @@
GrGLGpu* glGpu() const;
- sk_sp<Op> makeOp() override;
+ std::unique_ptr<Op> makeOp() override;
void onBeginFlush(GrResourceProvider*) override;
void onDraw(const GrPipeline&, const InstanceProcessor&, const Op*) override;
diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp
index 08fdf3e..52a48cb 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -21,30 +21,33 @@
fDrawPool(1024, 1024) {
}
-sk_sp<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix,
- GrColor color, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect,
+ const SkMatrix& viewMatrix, GrColor color,
+ GrAA aa,
+ const GrInstancedPipelineInfo& info,
+ GrAAType* aaType) {
return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect, aa, info, aaType);
}
-sk_sp<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix,
- GrColor color, const SkRect& localRect, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect,
+ const SkMatrix& viewMatrix, GrColor color,
+ const SkRect& localRect, GrAA aa,
+ const GrInstancedPipelineInfo& info,
+ GrAAType* aaType) {
return this->recordShape(ShapeType::kRect, rect, viewMatrix, color, localRect, aa, info,
aaType);
}
-sk_sp<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect, const SkMatrix& viewMatrix,
- GrColor color, const SkMatrix& localMatrix, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordRect(const SkRect& rect,
+ const SkMatrix& viewMatrix, GrColor color,
+ const SkMatrix& localMatrix, GrAA aa,
+ const GrInstancedPipelineInfo& info,
+ GrAAType* aaType) {
if (localMatrix.hasPerspective()) {
return nullptr; // Perspective is not yet supported in the local matrix.
}
- if (sk_sp<Op> op = this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect, aa, info,
- aaType)) {
+ if (std::unique_ptr<Op> op = this->recordShape(ShapeType::kRect, rect, viewMatrix, color, rect,
+ aa, info, aaType)) {
op->getSingleInstance().fInfo |= kLocalMatrix_InfoFlag;
op->appendParamsTexel(localMatrix.getScaleX(), localMatrix.getSkewX(),
localMatrix.getTranslateX());
@@ -56,37 +59,40 @@
return nullptr;
}
-sk_sp<GrDrawOp> InstancedRendering::recordOval(const SkRect& oval, const SkMatrix& viewMatrix,
- GrColor color, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordOval(const SkRect& oval,
+ const SkMatrix& viewMatrix, GrColor color,
+ GrAA aa,
+ const GrInstancedPipelineInfo& info,
+ GrAAType* aaType) {
return this->recordShape(ShapeType::kOval, oval, viewMatrix, color, oval, aa, info, aaType);
}
-sk_sp<GrDrawOp> InstancedRendering::recordRRect(const SkRRect& rrect, const SkMatrix& viewMatrix,
- GrColor color, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
- if (sk_sp<Op> op = this->recordShape(GetRRectShapeType(rrect), rrect.rect(), viewMatrix, color,
- rrect.rect(), aa, info, aaType)) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordRRect(const SkRRect& rrect,
+ const SkMatrix& viewMatrix, GrColor color,
+ GrAA aa,
+ const GrInstancedPipelineInfo& info,
+ GrAAType* aaType) {
+ if (std::unique_ptr<Op> op =
+ this->recordShape(GetRRectShapeType(rrect), rrect.rect(), viewMatrix, color,
+ rrect.rect(), aa, info, aaType)) {
op->appendRRectParams(rrect);
return std::move(op);
}
return nullptr;
}
-sk_sp<GrDrawOp> InstancedRendering::recordDRRect(const SkRRect& outer, const SkRRect& inner,
- const SkMatrix& viewMatrix, GrColor color, GrAA aa,
- const GrInstancedPipelineInfo& info,
- GrAAType* aaType) {
+std::unique_ptr<GrDrawOp> InstancedRendering::recordDRRect(
+ const SkRRect& outer, const SkRRect& inner, const SkMatrix& viewMatrix, GrColor color,
+ GrAA aa, const GrInstancedPipelineInfo& info, GrAAType* aaType) {
if (inner.getType() > SkRRect::kSimple_Type) {
return nullptr; // Complex inner round rects are not yet supported.
}
if (SkRRect::kEmpty_Type == inner.getType()) {
return this->recordRRect(outer, viewMatrix, color, aa, info, aaType);
}
- if (sk_sp<Op> op = this->recordShape(GetRRectShapeType(outer), outer.rect(), viewMatrix, color,
- outer.rect(), aa, info, aaType)) {
+ if (std::unique_ptr<Op> op =
+ this->recordShape(GetRRectShapeType(outer), outer.rect(), viewMatrix, color,
+ outer.rect(), aa, info, aaType)) {
op->appendRRectParams(outer);
ShapeType innerShapeType = GetRRectShapeType(inner);
op->fInfo.fInnerShapeTypes |= GetShapeFlag(innerShapeType);
@@ -98,7 +104,7 @@
return nullptr;
}
-sk_sp<InstancedRendering::Op> InstancedRendering::recordShape(
+std::unique_ptr<InstancedRendering::Op> InstancedRendering::recordShape(
ShapeType type, const SkRect& bounds, const SkMatrix& viewMatrix, GrColor color,
const SkRect& localRect, GrAA aa, const GrInstancedPipelineInfo& info, GrAAType* aaType) {
SkASSERT(State::kRecordingDraws == fState);
@@ -112,7 +118,7 @@
return nullptr;
}
- sk_sp<Op> op = this->makeOp();
+ std::unique_ptr<Op> op = this->makeOp();
op->fInfo.fAntialiasMode = antialiasMode;
op->fInfo.fShapeTypes = GetShapeFlag(type);
op->fInfo.fCannotDiscard = !info.fCanDiscard;
diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h
index 20d0617..1defcc7 100644
--- a/src/gpu/instanced/InstancedRendering.h
+++ b/src/gpu/instanced/InstancedRendering.h
@@ -45,27 +45,36 @@
* this class before attempting to flush ops returned by it. It is invalid to record new
* draws between beginFlush() and endFlush().
*/
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor, GrAA,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&,
+ GrColor, GrAA,
+ const GrInstancedPipelineInfo&,
+ GrAAType*);
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor,
- const SkRect& localRect, GrAA,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&,
+ GrColor, const SkRect& localRect,
+ GrAA, const GrInstancedPipelineInfo&,
+ GrAAType*);
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&, GrColor,
- const SkMatrix& localMatrix, GrAA,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordRect(const SkRect&, const SkMatrix&,
+ GrColor, const SkMatrix& localMatrix,
+ GrAA, const GrInstancedPipelineInfo&,
+ GrAAType*);
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordOval(const SkRect&, const SkMatrix&, GrColor, GrAA,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordOval(const SkRect&, const SkMatrix&,
+ GrColor, GrAA,
+ const GrInstancedPipelineInfo&,
+ GrAAType*);
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordRRect(const SkRRect&, const SkMatrix&, GrColor,
- GrAA, const GrInstancedPipelineInfo&,
- GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordRRect(const SkRRect&, const SkMatrix&,
+ GrColor, GrAA,
+ const GrInstancedPipelineInfo&,
+ GrAAType*);
- sk_sp<GrDrawOp> SK_WARN_UNUSED_RESULT recordDRRect(const SkRRect& outer, const SkRRect& inner,
- const SkMatrix&, GrColor, GrAA,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<GrDrawOp> SK_WARN_UNUSED_RESULT recordDRRect(const SkRRect& outer,
+ const SkRRect& inner,
+ const SkMatrix&, GrColor, GrAA,
+ const GrInstancedPipelineInfo&,
+ GrAAType*);
/**
* Compiles all recorded draws into GPU buffers and allows the client to begin flushing the
@@ -175,15 +184,16 @@
kFlushing
};
- sk_sp<Op> SK_WARN_UNUSED_RESULT recordShape(ShapeType, const SkRect& bounds,
- const SkMatrix& viewMatrix, GrColor,
- const SkRect& localRect, GrAA aa,
- const GrInstancedPipelineInfo&, GrAAType*);
+ std::unique_ptr<Op> SK_WARN_UNUSED_RESULT recordShape(ShapeType, const SkRect& bounds,
+ const SkMatrix& viewMatrix, GrColor,
+ const SkRect& localRect, GrAA aa,
+ const GrInstancedPipelineInfo&,
+ GrAAType*);
bool selectAntialiasMode(const SkMatrix& viewMatrix, GrAA aa, const GrInstancedPipelineInfo&,
GrAAType*, AntialiasMode*);
- virtual sk_sp<Op> makeOp() = 0;
+ virtual std::unique_ptr<Op> makeOp() = 0;
const sk_sp<GrGpu> fGpu;
State fState;
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 2d25ff5..38e60c7 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -735,8 +735,9 @@
class AAConvexPathOp final : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkPath& path) {
- return sk_sp<GrDrawOp>(new AAConvexPathOp(color, viewMatrix, path));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ const SkPath& path) {
+ return std::unique_ptr<GrDrawOp>(new AAConvexPathOp(color, viewMatrix, path));
}
const char* name() const override { return "AAConvexPathOp"; }
@@ -989,7 +990,8 @@
SkPath path;
args.fShape->asPath(&path);
- sk_sp<GrDrawOp> op = AAConvexPathOp::Make(args.fPaint->getColor(), *args.fViewMatrix, path);
+ std::unique_ptr<GrDrawOp> op =
+ AAConvexPathOp::Make(args.fPaint->getColor(), *args.fViewMatrix, path);
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index b97d35e..a21d40b 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -126,11 +126,12 @@
using ShapeCache = SkTDynamicHash<ShapeData, ShapeData::Key>;
using ShapeDataList = GrAADistanceFieldPathRenderer::ShapeDataList;
- static sk_sp<GrDrawOp> Make(GrColor color, const GrShape& shape, const SkMatrix& viewMatrix,
- GrDrawOpAtlas* atlas, ShapeCache* shapeCache,
- ShapeDataList* shapeList, bool gammaCorrect) {
- return sk_sp<GrDrawOp>(new AADistanceFieldPathOp(color, shape, viewMatrix, atlas,
- shapeCache, shapeList, gammaCorrect));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const GrShape& shape,
+ const SkMatrix& viewMatrix, GrDrawOpAtlas* atlas,
+ ShapeCache* shapeCache, ShapeDataList* shapeList,
+ bool gammaCorrect) {
+ return std::unique_ptr<GrDrawOp>(new AADistanceFieldPathOp(
+ color, shape, viewMatrix, atlas, shapeCache, shapeList, gammaCorrect));
}
const char* name() const override { return "AADistanceFieldPathOp"; }
@@ -521,9 +522,9 @@
}
}
- sk_sp<GrDrawOp> op = AADistanceFieldPathOp::Make(args.fPaint->getColor(), *args.fShape,
- *args.fViewMatrix, fAtlas.get(), &fShapeCache,
- &fShapeList, args.fGammaCorrect);
+ std::unique_ptr<GrDrawOp> op = AADistanceFieldPathOp::Make(
+ args.fPaint->getColor(), *args.fShape, *args.fViewMatrix, fAtlas.get(), &fShapeCache,
+ &fShapeList, args.fGammaCorrect);
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index 0158d60..2189d86 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -343,34 +343,35 @@
namespace GrAAFillRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& devRect) {
- return sk_sp<GrDrawOp>(new AAFillRectOp(color, viewMatrix, rect, devRect, nullptr));
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& devRect) {
+ return std::unique_ptr<GrDrawOp>(new AAFillRectOp(color, viewMatrix, rect, devRect, nullptr));
}
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkMatrix& localMatrix,
- const SkRect& rect,
- const SkRect& devRect) {
- return sk_sp<GrDrawOp>(new AAFillRectOp(color, viewMatrix, rect, devRect, &localMatrix));
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect,
+ const SkRect& devRect) {
+ return std::unique_ptr<GrDrawOp>(
+ new AAFillRectOp(color, viewMatrix, rect, devRect, &localMatrix));
}
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkMatrix& localMatrix,
- const SkRect& rect) {
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect) {
SkRect devRect;
viewMatrix.mapRect(&devRect, rect);
return Make(color, viewMatrix, localMatrix, rect, devRect);
}
-sk_sp<GrDrawOp> MakeWithLocalRect(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& localRect) {
+std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& localRect) {
SkRect devRect;
viewMatrix.mapRect(&devRect, rect);
SkMatrix localMatrix;
diff --git a/src/gpu/ops/GrAAFillRectOp.h b/src/gpu/ops/GrAAFillRectOp.h
index b611ff9..ff9844e 100644
--- a/src/gpu/ops/GrAAFillRectOp.h
+++ b/src/gpu/ops/GrAAFillRectOp.h
@@ -16,26 +16,26 @@
struct SkRect;
namespace GrAAFillRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& devRect);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& devRect);
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkMatrix& localMatrix,
- const SkRect& rect);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect);
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkMatrix& localMatrix,
- const SkRect& rect,
- const SkRect& devRect);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect,
+ const SkRect& devRect);
-sk_sp<GrDrawOp> MakeWithLocalRect(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& localRect);
+std::unique_ptr<GrDrawOp> MakeWithLocalRect(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& localRect);
};
#endif
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index affef55..6edef91 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -679,18 +679,18 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkPath& path,
- const GrStyle& style,
- const SkIRect& devClipBounds) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ const GrStyle& style,
+ const SkIRect& devClipBounds) {
SkScalar hairlineCoverage;
uint8_t newCoverage = 0xff;
if (GrPathRenderer::IsStrokeHairlineOrEquivalent(style, viewMatrix, &hairlineCoverage)) {
newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff);
}
- return sk_sp<GrDrawOp>(
+ return std::unique_ptr<GrDrawOp>(
new AAHairlineOp(color, newCoverage, viewMatrix, path, devClipBounds));
}
@@ -956,8 +956,8 @@
&devClipBounds);
SkPath path;
args.fShape->asPath(&path);
- sk_sp<GrDrawOp> op = AAHairlineOp::Make(args.fPaint->getColor(), *args.fViewMatrix, path,
- args.fShape->style(), devClipBounds);
+ std::unique_ptr<GrDrawOp> op = AAHairlineOp::Make(args.fPaint->getColor(), *args.fViewMatrix,
+ path, args.fShape->style(), devClipBounds);
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, std::move(op));
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index b96e90a..aa46ed3 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -126,15 +126,15 @@
class AAFlatteningConvexPathOp final : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkPath& path,
- SkScalar strokeWidth,
- SkStrokeRec::Style style,
- SkPaint::Join join,
- SkScalar miterLimit) {
- return sk_sp<GrDrawOp>(new AAFlatteningConvexPathOp(color, viewMatrix, path, strokeWidth,
- style, join, miterLimit));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkPath& path,
+ SkScalar strokeWidth,
+ SkStrokeRec::Style style,
+ SkPaint::Join join,
+ SkScalar miterLimit) {
+ return std::unique_ptr<GrDrawOp>(new AAFlatteningConvexPathOp(
+ color, viewMatrix, path, strokeWidth, style, join, miterLimit));
}
const char* name() const override { return "AAFlatteningConvexPathOp"; }
@@ -353,7 +353,7 @@
SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin();
SkScalar miterLimit = stroke.getMiter();
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
AAFlatteningConvexPathOp::Make(args.fPaint->getColor(), *args.fViewMatrix, path,
strokeWidth, stroke.getStyle(), join, miterLimit);
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index 1c70059..1ececb3 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -125,8 +125,8 @@
fMiterStroke = true;
}
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect,
- const SkStrokeRec& stroke) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ const SkRect& rect, const SkStrokeRec& stroke) {
bool isMiter;
if (!allowed_stroke(stroke, &isMiter)) {
return nullptr;
@@ -140,7 +140,7 @@
info.fColor = color;
op->setBounds(info.fDevOutside, HasAABloat::kYes, IsZeroArea::kNo);
op->fViewMatrix = viewMatrix;
- return sk_sp<GrDrawOp>(op);
+ return std::unique_ptr<GrDrawOp>(op);
}
const char* name() const override { return "AAStrokeRect"; }
@@ -565,17 +565,17 @@
namespace GrAAStrokeRectOp {
-sk_sp<GrDrawOp> MakeFillBetweenRects(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& devOutside,
- const SkRect& devInside) {
- return sk_sp<GrDrawOp>(new AAStrokeRectOp(color, viewMatrix, devOutside, devInside));
+std::unique_ptr<GrDrawOp> MakeFillBetweenRects(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& devOutside,
+ const SkRect& devInside) {
+ return std::unique_ptr<GrDrawOp>(new AAStrokeRectOp(color, viewMatrix, devOutside, devInside));
}
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec& stroke) {
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec& stroke) {
return AAStrokeRectOp::Make(color, viewMatrix, rect, stroke);
}
}
diff --git a/src/gpu/ops/GrAAStrokeRectOp.h b/src/gpu/ops/GrAAStrokeRectOp.h
index fe8f55c..d9f830e 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.h
+++ b/src/gpu/ops/GrAAStrokeRectOp.h
@@ -18,15 +18,15 @@
namespace GrAAStrokeRectOp {
-sk_sp<GrDrawOp> MakeFillBetweenRects(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& devOutside,
- const SkRect& devInside);
+std::unique_ptr<GrDrawOp> MakeFillBetweenRects(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& devOutside,
+ const SkRect& devInside);
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec& stroke);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec& stroke);
}
#endif
diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp
index 01e9e33..52934ff 100644
--- a/src/gpu/ops/GrAnalyticRectOp.cpp
+++ b/src/gpu/ops/GrAnalyticRectOp.cpp
@@ -376,12 +376,13 @@
typedef GrMeshDrawOp INHERITED;
};
-sk_sp<GrDrawOp> GrAnalyticRectOp::Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& croppedRect,
- const SkRect& bounds) {
- return sk_sp<GrDrawOp>(new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds));
+std::unique_ptr<GrDrawOp> GrAnalyticRectOp::Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& croppedRect,
+ const SkRect& bounds) {
+ return std::unique_ptr<GrDrawOp>(
+ new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds));
}
#ifdef GR_TEST_UTILS
@@ -392,7 +393,8 @@
SkRect rect = GrTest::TestSquare(random);
SkRect croppedRect = GrTest::TestSquare(random);
SkRect bounds = GrTest::TestSquare(random);
- return sk_sp<GrDrawOp>(new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds));
+ return std::unique_ptr<GrDrawOp>(
+ new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds));
}
#endif
diff --git a/src/gpu/ops/GrAnalyticRectOp.h b/src/gpu/ops/GrAnalyticRectOp.h
index 77d17ed..1266879 100644
--- a/src/gpu/ops/GrAnalyticRectOp.h
+++ b/src/gpu/ops/GrAnalyticRectOp.h
@@ -27,11 +27,11 @@
*/
class GrAnalyticRectOp {
public:
- static sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& croppedRect,
- const SkRect& bounds);
+ static std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& croppedRect,
+ const SkRect& bounds);
};
#endif // GrAnalyticRectOp_DEFINED
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 961c4fb..ef72477 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -17,6 +17,12 @@
public:
DEFINE_OP_CLASS_ID
+ ~GrAtlasTextOp() override {
+ for (int i = 0; i < fGeoCount; i++) {
+ fGeoData[i].fBlob->unref();
+ }
+ }
+
static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph;
static const int kIndicesPerGlyph = 6;
@@ -31,9 +37,9 @@
GrColor fColor;
};
- static sk_sp<GrAtlasTextOp> MakeBitmap(GrMaskFormat maskFormat, int glyphCount,
- GrAtlasGlyphCache* fontCache) {
- sk_sp<GrAtlasTextOp> op(new GrAtlasTextOp);
+ static std::unique_ptr<GrAtlasTextOp> MakeBitmap(GrMaskFormat maskFormat, int glyphCount,
+ GrAtlasGlyphCache* fontCache) {
+ std::unique_ptr<GrAtlasTextOp> op(new GrAtlasTextOp);
op->fFontCache = fontCache;
switch (maskFormat) {
@@ -55,11 +61,11 @@
return op;
}
- static sk_sp<GrAtlasTextOp> MakeDistanceField(
+ static std::unique_ptr<GrAtlasTextOp> MakeDistanceField(
int glyphCount, GrAtlasGlyphCache* fontCache,
const GrDistanceFieldAdjustTable* distanceAdjustTable,
bool useGammaCorrectDistanceTable, SkColor filteredColor, bool isLCD, bool useBGR) {
- sk_sp<GrAtlasTextOp> op(new GrAtlasTextOp);
+ std::unique_ptr<GrAtlasTextOp> op(new GrAtlasTextOp);
op->fFontCache = fontCache;
op->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistanceField_MaskType;
@@ -108,12 +114,6 @@
GrAtlasTextOp() : INHERITED(ClassID()) {} // initialized in factory functions.
- ~GrAtlasTextOp() {
- for (int i = 0; i < fGeoCount; i++) {
- fGeoData[i].fBlob->unref();
- }
- }
-
GrMaskFormat maskFormat() const {
switch (fMaskType) {
case kLCDCoverageMask_MaskType:
diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h
index 8137188..b40b615 100644
--- a/src/gpu/ops/GrClearOp.h
+++ b/src/gpu/ops/GrClearOp.h
@@ -19,17 +19,18 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrClearOp> Make(const GrFixedClip& clip, GrColor color, GrRenderTarget* rt) {
- sk_sp<GrClearOp> op(new GrClearOp(clip, color, rt));
+ static std::unique_ptr<GrClearOp> Make(const GrFixedClip& clip, GrColor color,
+ GrRenderTarget* rt) {
+ std::unique_ptr<GrClearOp> op(new GrClearOp(clip, color, rt));
if (!op->fRenderTarget) {
return nullptr; // The clip did not contain any pixels within the render target.
}
return op;
}
- static sk_sp<GrClearOp> Make(const SkIRect& rect, GrColor color, GrRenderTarget* rt,
- bool fullScreen) {
- return sk_sp<GrClearOp>(new GrClearOp(rect, color, rt, fullScreen));
+ static std::unique_ptr<GrClearOp> Make(const SkIRect& rect, GrColor color, GrRenderTarget* rt,
+ bool fullScreen) {
+ return std::unique_ptr<GrClearOp>(new GrClearOp(rect, color, rt, fullScreen));
}
const char* name() const override { return "Clear"; }
diff --git a/src/gpu/ops/GrClearStencilClipOp.h b/src/gpu/ops/GrClearStencilClipOp.h
index 7f3f68a..afbd72d 100644
--- a/src/gpu/ops/GrClearStencilClipOp.h
+++ b/src/gpu/ops/GrClearStencilClipOp.h
@@ -19,8 +19,9 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrOp> Make(const GrFixedClip& clip, bool insideStencilMask, GrRenderTarget* rt) {
- return sk_sp<GrOp>(new GrClearStencilClipOp(clip, insideStencilMask, rt));
+ static std::unique_ptr<GrOp> Make(const GrFixedClip& clip, bool insideStencilMask,
+ GrRenderTarget* rt) {
+ return std::unique_ptr<GrOp>(new GrClearStencilClipOp(clip, insideStencilMask, rt));
}
const char* name() const override { return "ClearStencilClip"; }
diff --git a/src/gpu/ops/GrCopySurfaceOp.cpp b/src/gpu/ops/GrCopySurfaceOp.cpp
index 3283517..87c490b 100644
--- a/src/gpu/ops/GrCopySurfaceOp.cpp
+++ b/src/gpu/ops/GrCopySurfaceOp.cpp
@@ -58,8 +58,8 @@
return !clippedSrcRect->isEmpty();
}
-sk_sp<GrOp> GrCopySurfaceOp::Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
- const SkIPoint& dstPoint) {
+std::unique_ptr<GrOp> GrCopySurfaceOp::Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint) {
SkASSERT(dst);
SkASSERT(src);
if (GrPixelConfigIsSint(dst->config()) != GrPixelConfigIsSint(src->config())) {
@@ -74,5 +74,5 @@
if (!ClipSrcRectAndDstPoint(dst, src, srcRect, dstPoint, &clippedSrcRect, &clippedDstPoint)) {
return nullptr;
}
- return sk_sp<GrOp>(new GrCopySurfaceOp(dst, src, clippedSrcRect, clippedDstPoint));
+ return std::unique_ptr<GrOp>(new GrCopySurfaceOp(dst, src, clippedSrcRect, clippedDstPoint));
}
diff --git a/src/gpu/ops/GrCopySurfaceOp.h b/src/gpu/ops/GrCopySurfaceOp.h
index 1f4fbfa..e74b7e5 100644
--- a/src/gpu/ops/GrCopySurfaceOp.h
+++ b/src/gpu/ops/GrCopySurfaceOp.h
@@ -27,8 +27,8 @@
SkIRect* clippedSrcRect,
SkIPoint* clippedDstPoint);
- static sk_sp<GrOp> Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
- const SkIPoint& dstPoint);
+ static std::unique_ptr<GrOp> Make(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
+ const SkIPoint& dstPoint);
const char* name() const override { return "CopySurface"; }
diff --git a/src/gpu/ops/GrDashLinePathRenderer.cpp b/src/gpu/ops/GrDashLinePathRenderer.cpp
index 10e4342..e381165 100644
--- a/src/gpu/ops/GrDashLinePathRenderer.cpp
+++ b/src/gpu/ops/GrDashLinePathRenderer.cpp
@@ -45,7 +45,7 @@
}
SkPoint pts[2];
SkAssertResult(args.fShape->asLine(pts, nullptr));
- sk_sp<GrDrawOp> op = GrDashOp::MakeDashLineOp(
+ std::unique_ptr<GrDrawOp> op = GrDashOp::MakeDashLineOp(
args.fPaint->getColor(), *args.fViewMatrix, pts, aaMode, args.fShape->style());
if (!op) {
return false;
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 8a9dfe8..5ff3230 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -252,9 +252,9 @@
SkScalar fPerpendicularScale;
};
- static sk_sp<GrDrawOp> Make(const LineData& geometry, GrColor color, SkPaint::Cap cap,
- AAMode aaMode, bool fullDash) {
- return sk_sp<GrDrawOp>(new DashOp(geometry, color, cap, aaMode, fullDash));
+ static std::unique_ptr<GrDrawOp> Make(const LineData& geometry, GrColor color, SkPaint::Cap cap,
+ AAMode aaMode, bool fullDash) {
+ return std::unique_ptr<GrDrawOp>(new DashOp(geometry, color, cap, aaMode, fullDash));
}
const char* name() const override { return "DashOp"; }
@@ -688,11 +688,11 @@
typedef GrMeshDrawOp INHERITED;
};
-sk_sp<GrDrawOp> GrDashOp::MakeDashLineOp(GrColor color,
- const SkMatrix& viewMatrix,
- const SkPoint pts[2],
- AAMode aaMode,
- const GrStyle& style) {
+std::unique_ptr<GrDrawOp> GrDashOp::MakeDashLineOp(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkPoint pts[2],
+ AAMode aaMode,
+ const GrStyle& style) {
SkASSERT(GrDashOp::CanDrawDashLine(pts, style, viewMatrix));
const SkScalar* intervals = style.dashIntervals();
SkScalar phase = style.dashPhase();
diff --git a/src/gpu/ops/GrDashOp.h b/src/gpu/ops/GrDashOp.h
index ff04f91..2f4a30f 100644
--- a/src/gpu/ops/GrDashOp.h
+++ b/src/gpu/ops/GrDashOp.h
@@ -23,8 +23,8 @@
};
static const int kAAModeCnt = static_cast<int>(AAMode::kCoverageWithMSAA) + 1;
-sk_sp<GrDrawOp> MakeDashLineOp(GrColor, const SkMatrix& viewMatrix, const SkPoint pts[2], AAMode,
- const GrStyle& style);
+std::unique_ptr<GrDrawOp> MakeDashLineOp(GrColor, const SkMatrix& viewMatrix, const SkPoint pts[2],
+ AAMode, const GrStyle& style);
bool CanDrawDashLine(const SkPoint pts[2], const GrStyle& style, const SkMatrix& viewMatrix);
}
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 47c7ada..c20a3d5 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -98,11 +98,11 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkPath& path, SkScalar tolerance,
- uint8_t coverage, const SkMatrix& viewMatrix, bool isHairline,
- const SkRect& devBounds) {
- return sk_sp<GrDrawOp>(new DefaultPathOp(color, path, tolerance, coverage, viewMatrix,
- isHairline, devBounds));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkPath& path, SkScalar tolerance,
+ uint8_t coverage, const SkMatrix& viewMatrix,
+ bool isHairline, const SkRect& devBounds) {
+ return std::unique_ptr<GrDrawOp>(new DefaultPathOp(color, path, tolerance, coverage,
+ viewMatrix, isHairline, devBounds));
}
const char* name() const override { return "DefaultPathOp"; }
@@ -555,8 +555,8 @@
}
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
- sk_sp<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewM, bounds,
- nullptr, &localMatrix));
+ std::unique_ptr<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(
+ paint.getColor(), viewM, bounds, nullptr, &localMatrix));
SkASSERT(GrDrawFace::kBoth == drawFace[p]);
GrPipelineBuilder pipelineBuilder(paint, aaType);
@@ -564,7 +564,7 @@
pipelineBuilder.setUserStencil(passes[p]);
renderTargetContext->addDrawOp(pipelineBuilder, clip, std::move(op));
} else {
- sk_sp<GrDrawOp> op =
+ std::unique_ptr<GrDrawOp> op =
DefaultPathOp::Make(paint.getColor(), path, srcSpaceTol, newCoverage,
viewMatrix, isHairline, devBounds);
GrPipelineBuilder pipelineBuilder(paint, aaType);
diff --git a/src/gpu/ops/GrDiscardOp.h b/src/gpu/ops/GrDiscardOp.h
index 6923be2..f9be33d 100644
--- a/src/gpu/ops/GrDiscardOp.h
+++ b/src/gpu/ops/GrDiscardOp.h
@@ -16,7 +16,9 @@
class GrDiscardOp final : public GrOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrOp> Make(GrRenderTarget* rt) { return sk_sp<GrOp>(new GrDiscardOp(rt)); }
+ static std::unique_ptr<GrOp> Make(GrRenderTarget* rt) {
+ return std::unique_ptr<GrOp>(new GrDiscardOp(rt));
+ }
const char* name() const override { return "Discard"; }
diff --git a/src/gpu/ops/GrDrawAtlasOp.h b/src/gpu/ops/GrDrawAtlasOp.h
index ec21162..60158e0 100644
--- a/src/gpu/ops/GrDrawAtlasOp.h
+++ b/src/gpu/ops/GrDrawAtlasOp.h
@@ -16,10 +16,10 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, int spriteCount,
- const SkRSXform* xforms, const SkRect* rects,
- const SkColor* colors) {
- return sk_sp<GrDrawOp>(
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ int spriteCount, const SkRSXform* xforms,
+ const SkRect* rects, const SkColor* colors) {
+ return std::unique_ptr<GrDrawOp>(
new GrDrawAtlasOp(color, viewMatrix, spriteCount, xforms, rects, colors));
}
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index 95cbc7e..b34f15e 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -61,8 +61,9 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(const SkMatrix& viewMatrix, GrColor color, const GrPath* path) {
- return sk_sp<GrDrawOp>(new GrDrawPathOp(viewMatrix, color, path));
+ static std::unique_ptr<GrDrawOp> Make(const SkMatrix& viewMatrix, GrColor color,
+ const GrPath* path) {
+ return std::unique_ptr<GrDrawOp>(new GrDrawPathOp(viewMatrix, color, path));
}
const char* name() const override { return "DrawPath"; }
@@ -91,7 +92,7 @@
DEFINE_OP_CLASS_ID
- struct InstanceData : public SkNoncopyable {
+ struct InstanceData : private ::SkNoncopyable {
public:
static InstanceData* Alloc(TransformType transformType, int reserveCnt) {
int transformSize = GrPathRendering::PathTransformSize(transformType);
@@ -150,11 +151,12 @@
SkDEBUGCODE(int fReserveCnt;)
};
- static sk_sp<GrDrawOp> Make(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x, SkScalar y,
- GrColor color, GrPathRendering::FillType fill, GrPathRange* range,
- const InstanceData* instanceData, const SkRect& bounds) {
- return sk_sp<GrDrawOp>(new GrDrawPathRangeOp(viewMatrix, scale, x, y, color, fill, range,
- instanceData, bounds));
+ static std::unique_ptr<GrDrawOp> Make(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x,
+ SkScalar y, GrColor color, GrPathRendering::FillType fill,
+ GrPathRange* range, const InstanceData* instanceData,
+ const SkRect& bounds) {
+ return std::unique_ptr<GrDrawOp>(new GrDrawPathRangeOp(viewMatrix, scale, x, y, color, fill,
+ range, instanceData, bounds));
}
const char* name() const override { return "DrawPathRange"; }
diff --git a/src/gpu/ops/GrDrawVerticesOp.h b/src/gpu/ops/GrDrawVerticesOp.h
index 2c1580d..b0697f4 100644
--- a/src/gpu/ops/GrDrawVerticesOp.h
+++ b/src/gpu/ops/GrDrawVerticesOp.h
@@ -22,14 +22,14 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, GrPrimitiveType primitiveType,
- const SkMatrix& viewMatrix, const SkPoint* positions,
- int vertexCount, const uint16_t* indices, int indexCount,
- const GrColor* colors, const SkPoint* localCoords,
- const SkRect& bounds) {
- return sk_sp<GrDrawOp>(new GrDrawVerticesOp(color, primitiveType, viewMatrix, positions,
- vertexCount, indices, indexCount, colors,
- localCoords, bounds));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, GrPrimitiveType primitiveType,
+ const SkMatrix& viewMatrix, const SkPoint* positions,
+ int vertexCount, const uint16_t* indices, int indexCount,
+ const GrColor* colors, const SkPoint* localCoords,
+ const SkRect& bounds) {
+ return std::unique_ptr<GrDrawOp>(
+ new GrDrawVerticesOp(color, primitiveType, viewMatrix, positions, vertexCount,
+ indices, indexCount, colors, localCoords, bounds));
}
const char* name() const override { return "DrawVerticesOp"; }
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index af83aa6..e3881ba 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -176,9 +176,10 @@
};
namespace GrLatticeOp {
-sk_sp<GrDrawOp> MakeNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth,
- int imageHeight, std::unique_ptr<SkLatticeIter> iter, const SkRect& dst) {
- return sk_sp<GrDrawOp>(
+std::unique_ptr<GrDrawOp> MakeNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth,
+ int imageHeight, std::unique_ptr<SkLatticeIter> iter,
+ const SkRect& dst) {
+ return std::unique_ptr<GrDrawOp>(
new NonAALatticeOp(color, viewMatrix, imageWidth, imageHeight, std::move(iter), dst));
}
};
diff --git a/src/gpu/ops/GrLatticeOp.h b/src/gpu/ops/GrLatticeOp.h
index 2908461..2ed3b9c 100644
--- a/src/gpu/ops/GrLatticeOp.h
+++ b/src/gpu/ops/GrLatticeOp.h
@@ -17,8 +17,9 @@
struct SkRect;
namespace GrLatticeOp {
-sk_sp<GrDrawOp> MakeNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth,
- int imageHeight, std::unique_ptr<SkLatticeIter> iter, const SkRect& dst);
+std::unique_ptr<GrDrawOp> MakeNonAA(GrColor color, const SkMatrix& viewMatrix, int imageWidth,
+ int imageHeight, std::unique_ptr<SkLatticeIter> iter,
+ const SkRect& dst);
};
#endif
diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp
index 1a73ca2..0774fdb 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -217,8 +217,8 @@
class MSAAPathOp final : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkPath& path, const SkMatrix& viewMatrix,
- const SkRect& devBounds) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkPath& path,
+ const SkMatrix& viewMatrix, const SkRect& devBounds) {
int contourCount;
int maxLineVertices;
int maxQuadVertices;
@@ -229,8 +229,8 @@
return nullptr;
}
- return sk_sp<GrDrawOp>(new MSAAPathOp(color, path, viewMatrix, devBounds, maxLineVertices,
- maxQuadVertices, isIndexed));
+ return std::unique_ptr<GrDrawOp>(new MSAAPathOp(
+ color, path, viewMatrix, devBounds, maxLineVertices, maxQuadVertices, isIndexed));
}
const char* name() const override { return "MSAAPathOp"; }
@@ -663,15 +663,16 @@
}
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
- sk_sp<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(paint.getColor(), viewM, bounds,
- nullptr, &localMatrix));
+ std::unique_ptr<GrDrawOp> op(GrRectOpFactory::MakeNonAAFill(
+ paint.getColor(), viewM, bounds, nullptr, &localMatrix));
GrPipelineBuilder pipelineBuilder(paint, aaType);
pipelineBuilder.setUserStencil(passes[p]);
renderTargetContext->addDrawOp(pipelineBuilder, clip, std::move(op));
} else {
- sk_sp<GrDrawOp> op = MSAAPathOp::Make(paint.getColor(), path, viewMatrix, devBounds);
+ std::unique_ptr<GrDrawOp> op =
+ MSAAPathOp::Make(paint.getColor(), path, viewMatrix, devBounds);
if (!op) {
return false;
}
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index afef8e6..26bee83 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -188,12 +188,13 @@
namespace GrNonAAFillRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
- return sk_sp<GrDrawOp>(new NonAAFillRectOp(color, viewMatrix, rect, localRect, localMatrix));
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
+ return std::unique_ptr<GrDrawOp>(
+ new NonAAFillRectOp(color, viewMatrix, rect, localRect, localMatrix));
}
};
diff --git a/src/gpu/ops/GrNonAAFillRectOp.h b/src/gpu/ops/GrNonAAFillRectOp.h
index 3d983e1..e699221 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.h
+++ b/src/gpu/ops/GrNonAAFillRectOp.h
@@ -17,17 +17,17 @@
namespace GrNonAAFillRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix);
-sk_sp<GrDrawOp> MakeWithPerspective(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix);
+std::unique_ptr<GrDrawOp> MakeWithPerspective(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix);
};
#endif
diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
index 9b6a857..10053fe 100644
--- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
@@ -230,12 +230,12 @@
namespace GrNonAAFillRectOp {
-sk_sp<GrDrawOp> MakeWithPerspective(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
- return sk_sp<GrDrawOp>(
+std::unique_ptr<GrDrawOp> MakeWithPerspective(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
+ return std::unique_ptr<GrDrawOp>(
new NonAAFillRectPerspectiveOp(color, viewMatrix, rect, localRect, localMatrix));
}
};
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index 1600241..3f63a91 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -62,8 +62,9 @@
return string;
}
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect,
- const SkStrokeRec& stroke, bool snapToPixelCenters) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ const SkRect& rect, const SkStrokeRec& stroke,
+ bool snapToPixelCenters) {
if (!allowed_stroke(stroke)) {
return nullptr;
}
@@ -94,7 +95,7 @@
} else {
op->setTransformedBounds(bounds, op->fViewMatrix, HasAABloat::kNo, IsZeroArea::kNo);
}
- return sk_sp<GrDrawOp>(op);
+ return std::unique_ptr<GrDrawOp>(op);
}
private:
@@ -184,11 +185,11 @@
namespace GrNonAAStrokeRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec& stroke,
- bool snapToPixelCenters) {
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec& stroke,
+ bool snapToPixelCenters) {
return NonAAStrokeRectOp::Make(color, viewMatrix, rect, stroke, snapToPixelCenters);
}
}
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.h b/src/gpu/ops/GrNonAAStrokeRectOp.h
index 1e067fa..9c46f40 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.h
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.h
@@ -18,11 +18,11 @@
namespace GrNonAAStrokeRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec&,
- bool snapToPixelCenters);
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec&,
+ bool snapToPixelCenters);
}
#endif
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index 87748f5..3a37ad5 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -56,7 +56,7 @@
return kClassID; \
}
-class GrOp : public GrNonAtomicRef<GrOp> {
+class GrOp : private SkNoncopyable {
public:
GrOp(uint32_t classID);
virtual ~GrOp();
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 5a9a077..a014020 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -613,9 +613,9 @@
SkScalar fSweepAngleRadians;
bool fUseCenter;
};
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, SkPoint center,
- SkScalar radius, const GrStyle& style,
- const ArcParams* arcParams = nullptr) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, SkPoint center,
+ SkScalar radius, const GrStyle& style,
+ const ArcParams* arcParams = nullptr) {
SkASSERT(circle_stays_circle(viewMatrix));
const SkStrokeRec& stroke = style.strokeRec();
if (style.hasPathEffect()) {
@@ -672,7 +672,7 @@
outerRadius += SK_ScalarHalf;
innerRadius -= SK_ScalarHalf;
bool stroked = isStrokeOnly && innerRadius > 0.0f;
- sk_sp<CircleOp> op(new CircleOp());
+ std::unique_ptr<CircleOp> op(new CircleOp());
op->fViewMatrixIfUsingLocalCoords = viewMatrix;
// This makes every point fully inside the intersection plane.
@@ -1148,8 +1148,8 @@
class EllipseOp : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRect& ellipse,
- const SkStrokeRec& stroke) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ const SkRect& ellipse, const SkStrokeRec& stroke) {
SkASSERT(viewMatrix.rectStaysRect());
// do any matrix crunching before we reset the draw state for device coords
@@ -1208,7 +1208,7 @@
yRadius += scaledStroke.fY;
}
- sk_sp<EllipseOp> op(new EllipseOp());
+ std::unique_ptr<EllipseOp> op(new EllipseOp());
op->fGeoData.emplace_back(
Geometry{color, xRadius, yRadius, innerXRadius, innerYRadius,
SkRect::MakeLTRB(center.fX - xRadius, center.fY - yRadius,
@@ -1370,10 +1370,10 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& ellipse,
- const SkStrokeRec& stroke) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& ellipse,
+ const SkStrokeRec& stroke) {
SkPoint center = SkPoint::Make(ellipse.centerX(), ellipse.centerY());
SkScalar xRadius = SkScalarHalf(ellipse.width());
SkScalar yRadius = SkScalarHalf(ellipse.height());
@@ -1430,7 +1430,7 @@
SkScalar geoDx = SK_ScalarHalf / SkScalarSqrt(a * a + c * c);
SkScalar geoDy = SK_ScalarHalf / SkScalarSqrt(b * b + d * d);
- sk_sp<DIEllipseOp> op(new DIEllipseOp());
+ std::unique_ptr<DIEllipseOp> op(new DIEllipseOp());
op->fGeoData.emplace_back(Geometry{
viewMatrix, color, xRadius, yRadius, innerXRadius, innerYRadius, geoDx, geoDy,
dieStyle,
@@ -2054,9 +2054,9 @@
// If devStrokeWidths values are <= 0 indicates then fill only. Otherwise, strokeOnly indicates
// whether the rrect is only stroked or stroked and filled.
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRect& devRect,
- float devXRadius, float devYRadius, SkVector devStrokeWidths,
- bool strokeOnly) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix,
+ const SkRect& devRect, float devXRadius, float devYRadius,
+ SkVector devStrokeWidths, bool strokeOnly) {
SkASSERT(devXRadius > 0.5);
SkASSERT(devYRadius > 0.5);
SkASSERT((devStrokeWidths.fX > 0) == (devStrokeWidths.fY > 0));
@@ -2101,7 +2101,7 @@
bounds.outset(devStrokeWidths.fX, devStrokeWidths.fY);
}
- sk_sp<EllipticalRRectOp> op(new EllipticalRRectOp());
+ std::unique_ptr<EllipticalRRectOp> op(new EllipticalRRectOp());
op->fStroked = stroked;
op->fViewMatrixIfUsingLocalCoords = viewMatrix;
op->setBounds(bounds, HasAABloat::kYes, IsZeroArea::kNo);
@@ -2266,11 +2266,11 @@
typedef GrMeshDrawOp INHERITED;
};
-static sk_sp<GrDrawOp> make_rrect_op(GrColor color,
- bool needsDistance,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkStrokeRec& stroke) {
+static std::unique_ptr<GrDrawOp> make_rrect_op(GrColor color,
+ bool needsDistance,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkStrokeRec& stroke) {
SkASSERT(viewMatrix.rectStaysRect());
SkASSERT(rrect.isSimple());
SkASSERT(!rrect.isOval());
@@ -2328,8 +2328,8 @@
// if the corners are circles, use the circle renderer
if (isCircular) {
- return sk_sp<GrDrawOp>(new CircularRRectOp(color, needsDistance, viewMatrix, bounds,
- xRadius, scaledStroke.fX, isStrokeOnly));
+ return std::unique_ptr<GrDrawOp>(new CircularRRectOp(
+ color, needsDistance, viewMatrix, bounds, xRadius, scaledStroke.fX, isStrokeOnly));
// otherwise we use the ellipse renderer
} else {
return EllipticalRRectOp::Make(color, viewMatrix, bounds, xRadius, yRadius, scaledStroke,
@@ -2337,12 +2337,12 @@
}
}
-sk_sp<GrDrawOp> GrOvalOpFactory::MakeRRectOp(GrColor color,
- bool needsDistance,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps) {
+std::unique_ptr<GrDrawOp> GrOvalOpFactory::MakeRRectOp(GrColor color,
+ bool needsDistance,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps) {
if (rrect.isOval()) {
return MakeOvalOp(color, viewMatrix, rrect.getBounds(), stroke, shaderCaps);
}
@@ -2356,11 +2356,11 @@
///////////////////////////////////////////////////////////////////////////////
-sk_sp<GrDrawOp> GrOvalOpFactory::MakeOvalOp(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps) {
+std::unique_ptr<GrDrawOp> GrOvalOpFactory::MakeOvalOp(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps) {
// we can draw circles
SkScalar width = oval.width();
if (SkScalarNearlyEqual(width, oval.height()) && circle_stays_circle(viewMatrix)) {
@@ -2383,10 +2383,11 @@
///////////////////////////////////////////////////////////////////////////////
-sk_sp<GrDrawOp> GrOvalOpFactory::MakeArcOp(GrColor color, const SkMatrix& viewMatrix,
- const SkRect& oval, SkScalar startAngle,
- SkScalar sweepAngle, bool useCenter,
- const GrStyle& style, const GrShaderCaps* shaderCaps) {
+std::unique_ptr<GrDrawOp> GrOvalOpFactory::MakeArcOp(GrColor color, const SkMatrix& viewMatrix,
+ const SkRect& oval, SkScalar startAngle,
+ SkScalar sweepAngle, bool useCenter,
+ const GrStyle& style,
+ const GrShaderCaps* shaderCaps) {
SkASSERT(!oval.isEmpty());
SkASSERT(sweepAngle);
SkScalar width = oval.width();
@@ -2429,8 +2430,8 @@
arcParamsTmp.fUseCenter = random->nextBool();
arcParams = &arcParamsTmp;
}
- sk_sp<GrDrawOp> op = CircleOp::Make(color, viewMatrix, center, radius,
- GrStyle(stroke, nullptr), arcParams);
+ std::unique_ptr<GrDrawOp> op = CircleOp::Make(color, viewMatrix, center, radius,
+ GrStyle(stroke, nullptr), arcParams);
if (op) {
return op;
}
diff --git a/src/gpu/ops/GrOvalOpFactory.h b/src/gpu/ops/GrOvalOpFactory.h
index dfe7ebf..0ddcc9b 100644
--- a/src/gpu/ops/GrOvalOpFactory.h
+++ b/src/gpu/ops/GrOvalOpFactory.h
@@ -24,26 +24,26 @@
*/
class GrOvalOpFactory {
public:
- static sk_sp<GrDrawOp> MakeOvalOp(GrColor,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps);
- static sk_sp<GrDrawOp> MakeRRectOp(GrColor,
- bool needsDistance,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps);
+ static std::unique_ptr<GrDrawOp> MakeOvalOp(GrColor,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps);
+ static std::unique_ptr<GrDrawOp> MakeRRectOp(GrColor,
+ bool needsDistance,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps);
- static sk_sp<GrDrawOp> MakeArcOp(GrColor,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- SkScalar startAngle,
- SkScalar sweepAngle,
- bool useCenter,
- const GrStyle&,
- const GrShaderCaps* shaderCaps);
+ static std::unique_ptr<GrDrawOp> MakeArcOp(GrColor,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ SkScalar startAngle,
+ SkScalar sweepAngle,
+ bool useCenter,
+ const GrStyle&,
+ const GrShaderCaps* shaderCaps);
};
#endif // GrOvalOpFactory_DEFINED
diff --git a/src/gpu/ops/GrPLSPathRenderer.cpp b/src/gpu/ops/GrPLSPathRenderer.cpp
index 47c54d7..637b4b7 100644
--- a/src/gpu/ops/GrPLSPathRenderer.cpp
+++ b/src/gpu/ops/GrPLSPathRenderer.cpp
@@ -766,8 +766,9 @@
class PLSPathOp final : public GrMeshDrawOp {
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkPath& path, const SkMatrix& viewMatrix) {
- return sk_sp<GrDrawOp>(new PLSPathOp(color, path, viewMatrix));
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkPath& path,
+ const SkMatrix& viewMatrix) {
+ return std::unique_ptr<GrDrawOp>(new PLSPathOp(color, path, viewMatrix));
}
const char* name() const override { return "PLSPathOp"; }
@@ -931,7 +932,8 @@
SkPath path;
args.fShape->asPath(&path);
- sk_sp<GrDrawOp> op = PLSPathOp::Make(args.fPaint->getColor(), path, *args.fViewMatrix);
+ std::unique_ptr<GrDrawOp> op =
+ PLSPathOp::Make(args.fPaint->getColor(), path, *args.fViewMatrix);
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
diff --git a/src/gpu/ops/GrRectOpFactory.cpp b/src/gpu/ops/GrRectOpFactory.cpp
index fd73624..5c8d344 100644
--- a/src/gpu/ops/GrRectOpFactory.cpp
+++ b/src/gpu/ops/GrRectOpFactory.cpp
@@ -13,9 +13,9 @@
namespace GrRectOpFactory {
-sk_sp<GrDrawOp> MakeAAFillNestedRects(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect rects[2]) {
+std::unique_ptr<GrDrawOp> MakeAAFillNestedRects(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect rects[2]) {
SkASSERT(viewMatrix.rectStaysRect());
SkASSERT(!rects[0].isEmpty() && !rects[1].isEmpty());
diff --git a/src/gpu/ops/GrRectOpFactory.h b/src/gpu/ops/GrRectOpFactory.h
index 90263a0..3f42008 100644
--- a/src/gpu/ops/GrRectOpFactory.h
+++ b/src/gpu/ops/GrRectOpFactory.h
@@ -27,11 +27,11 @@
*/
namespace GrRectOpFactory {
-inline sk_sp<GrDrawOp> MakeNonAAFill(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
+inline std::unique_ptr<GrDrawOp> MakeNonAAFill(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective())) {
return GrNonAAFillRectOp::MakeWithPerspective(color, viewMatrix, rect, localRect,
localMatrix);
@@ -40,11 +40,11 @@
}
}
-inline sk_sp<GrDrawOp> MakeAAFill(const GrPaint& paint,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& croppedRect,
- const SkRect& devRect) {
+inline std::unique_ptr<GrDrawOp> MakeAAFill(const GrPaint& paint,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect& croppedRect,
+ const SkRect& devRect) {
if (!paint.usesDistanceVectorField()) {
return GrAAFillRectOp::Make(paint.getColor(), viewMatrix, croppedRect, devRect);
} else {
@@ -52,31 +52,32 @@
}
}
-inline sk_sp<GrDrawOp> MakeAAFill(GrColor color,
- const SkMatrix& viewMatrix,
- const SkMatrix& localMatrix,
- const SkRect& rect,
- const SkRect& devRect) {
+inline std::unique_ptr<GrDrawOp> MakeAAFill(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect,
+ const SkRect& devRect) {
return GrAAFillRectOp::Make(color, viewMatrix, localMatrix, rect, devRect);
}
-inline sk_sp<GrDrawOp> MakeNonAAStroke(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec& strokeRec,
- bool snapToPixelCenters) {
+inline std::unique_ptr<GrDrawOp> MakeNonAAStroke(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec& strokeRec,
+ bool snapToPixelCenters) {
return GrNonAAStrokeRectOp::Make(color, viewMatrix, rect, strokeRec, snapToPixelCenters);
}
-inline sk_sp<GrDrawOp> MakeAAStroke(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkStrokeRec& stroke) {
+inline std::unique_ptr<GrDrawOp> MakeAAStroke(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkStrokeRec& stroke) {
return GrAAStrokeRectOp::Make(color, viewMatrix, rect, stroke);
}
// First rect is outer; second rect is inner
-sk_sp<GrDrawOp> MakeAAFillNestedRects(GrColor, const SkMatrix& viewMatrix, const SkRect rects[2]);
+std::unique_ptr<GrDrawOp> MakeAAFillNestedRects(GrColor, const SkMatrix& viewMatrix,
+ const SkRect rects[2]);
};
#endif
diff --git a/src/gpu/ops/GrRegionOp.cpp b/src/gpu/ops/GrRegionOp.cpp
index 4d45d80..7fbdd75 100644
--- a/src/gpu/ops/GrRegionOp.cpp
+++ b/src/gpu/ops/GrRegionOp.cpp
@@ -154,7 +154,7 @@
namespace GrRegionOp {
-sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region) {
- return sk_sp<GrDrawOp>(new RegionOp(color, viewMatrix, region));
+std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region) {
+ return std::unique_ptr<GrDrawOp>(new RegionOp(color, viewMatrix, region));
}
}
diff --git a/src/gpu/ops/GrRegionOp.h b/src/gpu/ops/GrRegionOp.h
index 2423060..e4b8f3e 100644
--- a/src/gpu/ops/GrRegionOp.h
+++ b/src/gpu/ops/GrRegionOp.h
@@ -16,7 +16,7 @@
class SkRegion;
namespace GrRegionOp {
-sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region);
+std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, const SkRegion& region);
}
#endif
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index b5829f4..1882aad 100755
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -67,8 +67,9 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, SkPoint center,
- SkScalar radius, SkScalar blurRadius, const GrStyle& style) {
+ static std::unique_ptr<GrDrawOp> Make(GrColor color, const SkMatrix& viewMatrix, SkPoint center,
+ SkScalar radius, SkScalar blurRadius,
+ const GrStyle& style) {
SkASSERT(viewMatrix.isSimilarity());
const SkStrokeRec& stroke = style.strokeRec();
if (style.hasPathEffect()) {
@@ -108,7 +109,7 @@
outerRadius += SK_ScalarHalf;
innerRadius -= SK_ScalarHalf;
bool stroked = isStrokeOnly && innerRadius > 0.0f;
- sk_sp<ShadowCircleOp> op(new ShadowCircleOp());
+ std::unique_ptr<ShadowCircleOp> op(new ShadowCircleOp());
op->fViewMatrixIfUsingLocalCoords = viewMatrix;
SkRect devBounds = SkRect::MakeLTRB(center.fX - outerRadius, center.fY - outerRadius,
@@ -826,12 +827,12 @@
///////////////////////////////////////////////////////////////////////////////
-sk_sp<GrDrawOp> make_shadow_circle_op(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& oval,
- SkScalar blurRadius,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps) {
+std::unique_ptr<GrDrawOp> make_shadow_circle_op(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& oval,
+ SkScalar blurRadius,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps) {
// we can only draw circles
SkScalar width = oval.width();
SkASSERT(SkScalarNearlyEqual(width, oval.height()) && viewMatrix.isSimilarity());
@@ -840,11 +841,11 @@
GrStyle(stroke, nullptr));
}
-static sk_sp<GrDrawOp> make_shadow_rrect_op(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- SkScalar blurRadius,
- const SkStrokeRec& stroke) {
+static std::unique_ptr<GrDrawOp> make_shadow_rrect_op(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ SkScalar blurRadius,
+ const SkStrokeRec& stroke) {
SkASSERT(viewMatrix.rectStaysRect());
SkASSERT(rrect.isSimple());
SkASSERT(!rrect.isOval());
@@ -897,17 +898,17 @@
return nullptr;
}
- return sk_sp<GrDrawOp>(new ShadowCircularRRectOp(color, viewMatrix, bounds, xRadius, blurRadius,
- scaledStroke.fX, isStrokeOnly));
+ return std::unique_ptr<GrDrawOp>(new ShadowCircularRRectOp(
+ color, viewMatrix, bounds, xRadius, blurRadius, scaledStroke.fX, isStrokeOnly));
}
namespace GrShadowRRectOp {
-sk_sp<GrDrawOp> Make(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRRect& rrect,
- const SkScalar blurRadius,
- const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps) {
+std::unique_ptr<GrDrawOp> Make(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRRect& rrect,
+ const SkScalar blurRadius,
+ const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps) {
if (rrect.isOval()) {
return make_shadow_circle_op(color, viewMatrix, rrect.getBounds(), blurRadius, stroke,
shaderCaps);
@@ -940,8 +941,8 @@
SkScalar radius = circle.width() / 2.f;
SkStrokeRec stroke = GrTest::TestStrokeRec(random);
SkScalar blurRadius = random->nextSScalar1() * 72.f;
- sk_sp<GrDrawOp> op = ShadowCircleOp::Make(color, viewMatrix, center, radius, blurRadius,
- GrStyle(stroke, nullptr));
+ std::unique_ptr<GrDrawOp> op = ShadowCircleOp::Make(color, viewMatrix, center, radius,
+ blurRadius, GrStyle(stroke, nullptr));
if (op) {
return op;
}
diff --git a/src/gpu/ops/GrShadowRRectOp.h b/src/gpu/ops/GrShadowRRectOp.h
index 3508cb8..50e0102 100755
--- a/src/gpu/ops/GrShadowRRectOp.h
+++ b/src/gpu/ops/GrShadowRRectOp.h
@@ -19,9 +19,9 @@
namespace GrShadowRRectOp {
-sk_sp<GrDrawOp> Make(GrColor, const SkMatrix& viewMatrix, const SkRRect& rrect,
- const SkScalar blurRadius, const SkStrokeRec& stroke,
- const GrShaderCaps* shaderCaps);
+std::unique_ptr<GrDrawOp> Make(GrColor, const SkMatrix& viewMatrix, const SkRRect& rrect,
+ const SkScalar blurRadius, const SkStrokeRec& stroke,
+ const GrShaderCaps* shaderCaps);
}
#endif
diff --git a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
index 16765e0..5a83e0e 100644
--- a/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
+++ b/src/gpu/ops/GrStencilAndCoverPathRenderer.cpp
@@ -112,8 +112,8 @@
}
const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
- sk_sp<GrDrawOp> coverOp(GrRectOpFactory::MakeNonAAFill(args.fPaint->getColor(), viewM,
- bounds, nullptr, &invert));
+ std::unique_ptr<GrDrawOp> coverOp(GrRectOpFactory::MakeNonAAFill(
+ args.fPaint->getColor(), viewM, bounds, nullptr, &invert));
// fake inverse with a stencil and cover
args.fRenderTargetContext->priv().stencilPath(*args.fClip, args.fAAType, viewMatrix,
@@ -154,7 +154,8 @@
0xffff>()
);
- sk_sp<GrDrawOp> op = GrDrawPathOp::Make(viewMatrix, args.fPaint->getColor(), path.get());
+ std::unique_ptr<GrDrawOp> op =
+ GrDrawPathOp::Make(viewMatrix, args.fPaint->getColor(), path.get());
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(&kCoverPass);
diff --git a/src/gpu/ops/GrStencilPathOp.h b/src/gpu/ops/GrStencilPathOp.h
index 03dc7ee..f21b524 100644
--- a/src/gpu/ops/GrStencilPathOp.h
+++ b/src/gpu/ops/GrStencilPathOp.h
@@ -19,16 +19,17 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrOp> Make(const SkMatrix& viewMatrix,
- bool useHWAA,
- GrPathRendering::FillType fillType,
- bool hasStencilClip,
- int numStencilBits,
- const GrScissorState& scissor,
- GrRenderTarget* renderTarget,
- const GrPath* path) {
- return sk_sp<GrOp>(new GrStencilPathOp(viewMatrix, useHWAA, fillType, hasStencilClip,
- numStencilBits, scissor, renderTarget, path));
+ static std::unique_ptr<GrOp> Make(const SkMatrix& viewMatrix,
+ bool useHWAA,
+ GrPathRendering::FillType fillType,
+ bool hasStencilClip,
+ int numStencilBits,
+ const GrScissorState& scissor,
+ GrRenderTarget* renderTarget,
+ const GrPath* path) {
+ return std::unique_ptr<GrOp>(new GrStencilPathOp(viewMatrix, useHWAA, fillType,
+ hasStencilClip, numStencilBits, scissor,
+ renderTarget, path));
}
const char* name() const override { return "StencilPathOp"; }
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index 7774798..81a982c 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -160,12 +160,12 @@
public:
DEFINE_OP_CLASS_ID
- static sk_sp<GrDrawOp> Make(const GrColor& color,
- const GrShape& shape,
- const SkMatrix& viewMatrix,
- SkIRect devClipBounds,
- bool antiAlias) {
- return sk_sp<GrDrawOp>(
+ static std::unique_ptr<GrDrawOp> Make(const GrColor& color,
+ const GrShape& shape,
+ const SkMatrix& viewMatrix,
+ SkIRect devClipBounds,
+ bool antiAlias) {
+ return std::unique_ptr<GrDrawOp>(
new TessellatingPathOp(color, shape, viewMatrix, devClipBounds, antiAlias));
}
@@ -358,11 +358,11 @@
args.fClip->getConservativeBounds(args.fRenderTargetContext->width(),
args.fRenderTargetContext->height(),
&clipBoundsI);
- sk_sp<GrDrawOp> op = TessellatingPathOp::Make(args.fPaint->getColor(),
- *args.fShape,
- *args.fViewMatrix,
- clipBoundsI,
- GrAAType::kCoverage == args.fAAType);
+ std::unique_ptr<GrDrawOp> op = TessellatingPathOp::Make(args.fPaint->getColor(),
+ *args.fShape,
+ *args.fViewMatrix,
+ clipBoundsI,
+ GrAAType::kCoverage == args.fAAType);
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fAAType);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);
args.fRenderTargetContext->addDrawOp(pipelineBuilder, *args.fClip, std::move(op));
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 9aca37a..d4e4f5f 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -254,7 +254,7 @@
return false;
}
-inline sk_sp<GrDrawOp> GrAtlasTextBlob::makeOp(
+inline std::unique_ptr<GrDrawOp> GrAtlasTextBlob::makeOp(
const Run::SubRunInfo& info, int glyphCount, int run, int subRun,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color, const SkPaint& skPaint,
const SkSurfaceProps& props, const GrDistanceFieldAdjustTable* distanceAdjustTable,
@@ -268,7 +268,7 @@
subRunColor = color;
}
- sk_sp<GrAtlasTextOp> op;
+ std::unique_ptr<GrAtlasTextOp> op;
if (info.drawAsDistanceFields()) {
SkColor filteredColor;
SkColorFilter* colorFilter = skPaint.getColorFilter();
@@ -313,9 +313,9 @@
GrColor color = grPaint.getColor();
- sk_sp<GrDrawOp> op(this->makeOp(info, glyphCount, run, subRun, viewMatrix, x, y, color,
- skPaint, props, distanceAdjustTable, rtc->isGammaCorrect(),
- cache));
+ std::unique_ptr<GrDrawOp> op(this->makeOp(info, glyphCount, run, subRun, viewMatrix, x, y,
+ color, skPaint, props, distanceAdjustTable,
+ rtc->isGammaCorrect(), cache));
GrPipelineBuilder pipelineBuilder(grPaint, GrAAType::kNone);
rtc->addDrawOp(pipelineBuilder, clip, std::move(op));
@@ -451,12 +451,10 @@
this->flushBigGlyphs(context, rtc, clip, skPaint, viewMatrix, x, y, clipBounds);
}
-sk_sp<GrDrawOp> GrAtlasTextBlob::test_makeOp(int glyphCount, int run, int subRun,
- const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
- GrColor color, const SkPaint& skPaint,
- const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable,
- GrAtlasGlyphCache* cache) {
+std::unique_ptr<GrDrawOp> GrAtlasTextBlob::test_makeOp(
+ int glyphCount, int run, int subRun, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
+ GrColor color, const SkPaint& skPaint, const SkSurfaceProps& props,
+ const GrDistanceFieldAdjustTable* distanceAdjustTable, GrAtlasGlyphCache* cache) {
const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[run].fSubRunInfo[subRun];
return this->makeOp(info, glyphCount, run, subRun, viewMatrix, x, y, color, skPaint, props,
distanceAdjustTable, false, cache);
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 9b3f59c..340b52a 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -279,11 +279,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////
// Internal test methods
- sk_sp<GrDrawOp> test_makeOp(int glyphCount, int run, int subRun, const SkMatrix& viewMatrix,
- SkScalar x, SkScalar y, GrColor color, const SkPaint& skPaint,
- const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable,
- GrAtlasGlyphCache* cache);
+ std::unique_ptr<GrDrawOp> test_makeOp(int glyphCount, int run, int subRun,
+ const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
+ GrColor color, const SkPaint& skPaint,
+ const SkSurfaceProps& props,
+ const GrDistanceFieldAdjustTable* distanceAdjustTable,
+ GrAtlasGlyphCache* cache);
private:
GrAtlasTextBlob()
@@ -500,11 +501,13 @@
Run* run, Run::SubRunInfo* info, SkAutoGlyphCache*, int glyphCount,
size_t vertexStride, GrColor color, SkScalar transX, SkScalar transY) const;
- inline sk_sp<GrDrawOp> makeOp(const Run::SubRunInfo& info, int glyphCount, int run, int subRun,
- const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color,
- const SkPaint& skPaint, const SkSurfaceProps& props,
- const GrDistanceFieldAdjustTable* distanceAdjustTable,
- bool useGammaCorrectDistanceTable, GrAtlasGlyphCache* cache);
+ inline std::unique_ptr<GrDrawOp> makeOp(const Run::SubRunInfo& info, int glyphCount, int run,
+ int subRun, const SkMatrix& viewMatrix, SkScalar x,
+ SkScalar y, GrColor color, const SkPaint& skPaint,
+ const SkSurfaceProps& props,
+ const GrDistanceFieldAdjustTable* distanceAdjustTable,
+ bool useGammaCorrectDistanceTable,
+ GrAtlasGlyphCache* cache);
struct BigGlyph {
BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, bool treatAsBMP)
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index e3ad1a7..e58b082 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -633,10 +633,10 @@
const SkRect bounds = SkRect::MakeIWH(renderTargetContext->width(),
renderTargetContext->height());
- sk_sp<GrDrawOp> op = GrDrawPathRangeOp::Make(viewMatrix, fTextRatio, fTextInverseRatio * x,
- fTextInverseRatio * y, grPaint.getColor(),
- GrPathRendering::kWinding_FillType,
- glyphs.get(), fInstanceData.get(), bounds);
+ std::unique_ptr<GrDrawOp> op = GrDrawPathRangeOp::Make(
+ viewMatrix, fTextRatio, fTextInverseRatio * x, fTextInverseRatio * y,
+ grPaint.getColor(), GrPathRendering::kWinding_FillType, glyphs.get(),
+ fInstanceData.get(), bounds);
// The run's "font" overrides the anti-aliasing of the passed in SkPaint!
GrAAType aaType = GrAAType::kNone;