Make GrFragmentProcessor be non-refcounted and use std::unique_ptr.
Change-Id: I985e54a071338e99292a5aa2f42c92bc115b4008
Reviewed-on: https://skia-review.googlesource.com/32760
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index bb61cc1..e61923c 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -19,15 +19,16 @@
public:
const SkRect& getRect() const { return fRect; }
- static sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType edgeType, const SkRect& rect) {
- return sk_sp<GrFragmentProcessor>(new AARectEffect(edgeType, rect));
+ static std::unique_ptr<GrFragmentProcessor> Make(GrPrimitiveEdgeType edgeType,
+ const SkRect& rect) {
+ return std::unique_ptr<GrFragmentProcessor>(new AARectEffect(edgeType, rect));
}
GrPrimitiveEdgeType getEdgeType() const { return fEdgeType; }
const char* name() const override { return "AARect"; }
- sk_sp<GrFragmentProcessor> clone() const override { return Make(fEdgeType, fRect); }
+ std::unique_ptr<GrFragmentProcessor> clone() const override { return Make(fEdgeType, fRect); }
private:
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
@@ -58,12 +59,12 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect);
#if GR_TEST_UTILS
-sk_sp<GrFragmentProcessor> AARectEffect::TestCreate(GrProcessorTestData* d) {
+std::unique_ptr<GrFragmentProcessor> AARectEffect::TestCreate(GrProcessorTestData* d) {
SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(),
d->fRandom->nextSScalar1(),
d->fRandom->nextSScalar1(),
d->fRandom->nextSScalar1());
- sk_sp<GrFragmentProcessor> fp;
+ std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));
@@ -236,7 +237,8 @@
//////////////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType type, const SkPath& path) {
+std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType type,
+ const SkPath& path) {
if (kHairlineAA_GrProcessorEdgeType == type) {
return nullptr;
}
@@ -306,8 +308,8 @@
return Make(type, n, edges);
}
-sk_sp<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType edgeType,
- const SkRect& rect) {
+std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrPrimitiveEdgeType edgeType,
+ const SkRect& rect) {
if (kHairlineAA_GrProcessorEdgeType == edgeType){
return nullptr;
}
@@ -348,8 +350,8 @@
memcpy(fEdges, that.fEdges, 3 * that.fEdgeCount * sizeof(SkScalar));
}
-sk_sp<GrFragmentProcessor> GrConvexPolyEffect::clone() const {
- return sk_sp<GrFragmentProcessor>(new GrConvexPolyEffect(*this));
+std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::clone() const {
+ return std::unique_ptr<GrFragmentProcessor>(new GrConvexPolyEffect(*this));
}
bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const {
@@ -364,14 +366,14 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect);
#if GR_TEST_UTILS
-sk_sp<GrFragmentProcessor> GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) {
+std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) {
int count = d->fRandom->nextULessThan(kMaxEdges) + 1;
SkScalar edges[kMaxEdges * 3];
for (int i = 0; i < 3 * count; ++i) {
edges[i] = d->fRandom->nextSScalar1();
}
- sk_sp<GrFragmentProcessor> fp;
+ std::unique_ptr<GrFragmentProcessor> fp;
do {
GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(
d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt));