| Index: src/gpu/effects/GrRRectEffect.cpp
|
| diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
|
| index d1d811da902212fc1b39232b04497b3ecd108fdb..14d03dd9ed704b13157d18066232436d6402636b 100644
|
| --- a/src/gpu/effects/GrRRectEffect.cpp
|
| +++ b/src/gpu/effects/GrRRectEffect.cpp
|
| @@ -45,8 +45,8 @@ public:
|
|
|
| // The flags are used to indicate which corners are circluar (unflagged corners are assumed to
|
| // be square).
|
| - static GrFragmentProcessor* Create(GrPrimitiveEdgeType, uint32_t circularCornerFlags,
|
| - const SkRRect&);
|
| + static sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType, uint32_t circularCornerFlags,
|
| + const SkRRect&);
|
|
|
| virtual ~CircularRRectEffect() {};
|
|
|
| @@ -78,13 +78,14 @@ private:
|
| typedef GrFragmentProcessor INHERITED;
|
| };
|
|
|
| -GrFragmentProcessor* CircularRRectEffect::Create(GrPrimitiveEdgeType edgeType,
|
| - uint32_t circularCornerFlags,
|
| - const SkRRect& rrect) {
|
| +sk_sp<GrFragmentProcessor> CircularRRectEffect::Make(GrPrimitiveEdgeType edgeType,
|
| + uint32_t circularCornerFlags,
|
| + const SkRRect& rrect) {
|
| if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
|
| return nullptr;
|
| }
|
| - return new CircularRRectEffect(edgeType, circularCornerFlags, rrect);
|
| + return sk_sp<GrFragmentProcessor>(
|
| + new CircularRRectEffect(edgeType, circularCornerFlags, rrect));
|
| }
|
|
|
| void CircularRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
|
| @@ -110,17 +111,17 @@ bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
|
|
| GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect);
|
|
|
| -const GrFragmentProcessor* CircularRRectEffect::TestCreate(GrProcessorTestData* d) {
|
| +sk_sp<GrFragmentProcessor> CircularRRectEffect::TestCreate(GrProcessorTestData* d) {
|
| SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f);
|
| SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f);
|
| SkScalar r = d->fRandom->nextRangeF(kRadiusMin, 9.f);
|
| SkRRect rrect;
|
| rrect.setRectXY(SkRect::MakeWH(w, h), r, r);
|
| - GrFragmentProcessor* fp;
|
| + sk_sp<GrFragmentProcessor> fp;
|
| do {
|
| GrPrimitiveEdgeType et =
|
| (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
|
| - fp = GrRRectEffect::Create(et, rrect);
|
| + fp = GrRRectEffect::Make(et, rrect);
|
| } while (nullptr == fp);
|
| return fp;
|
| }
|
| @@ -387,7 +388,7 @@ GrGLSLFragmentProcessor* CircularRRectEffect::onCreateGLSLInstance() const {
|
|
|
| class EllipticalRRectEffect : public GrFragmentProcessor {
|
| public:
|
| - static GrFragmentProcessor* Create(GrPrimitiveEdgeType, const SkRRect&);
|
| + static sk_sp<GrFragmentProcessor> Make(GrPrimitiveEdgeType, const SkRRect&);
|
|
|
| virtual ~EllipticalRRectEffect() {};
|
|
|
| @@ -416,12 +417,12 @@ private:
|
| typedef GrFragmentProcessor INHERITED;
|
| };
|
|
|
| -GrFragmentProcessor*
|
| -EllipticalRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
|
| +sk_sp<GrFragmentProcessor>
|
| +EllipticalRRectEffect::Make(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
|
| if (kFillAA_GrProcessorEdgeType != edgeType && kInverseFillAA_GrProcessorEdgeType != edgeType) {
|
| return nullptr;
|
| }
|
| - return new EllipticalRRectEffect(edgeType, rrect);
|
| + return sk_sp<GrFragmentProcessor>(new EllipticalRRectEffect(edgeType, rrect));
|
| }
|
|
|
| void EllipticalRRectEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
|
| @@ -444,7 +445,7 @@ bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const {
|
|
|
| GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect);
|
|
|
| -const GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) {
|
| +sk_sp<GrFragmentProcessor> EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) {
|
| SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f);
|
| SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f);
|
| SkVector r[4];
|
| @@ -471,11 +472,11 @@ const GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData
|
| rrect.setRectXY(SkRect::MakeWH(w, h), r[SkRRect::kUpperLeft_Corner].fX,
|
| r[SkRRect::kUpperLeft_Corner].fY);
|
| }
|
| - GrFragmentProcessor* fp;
|
| + sk_sp<GrFragmentProcessor> fp;
|
| do {
|
| GrPrimitiveEdgeType et =
|
| (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt);
|
| - fp = GrRRectEffect::Create(et, rrect);
|
| + fp = GrRRectEffect::Make(et, rrect);
|
| } while (nullptr == fp);
|
| return fp;
|
| }
|
| @@ -680,26 +681,26 @@ GrGLSLFragmentProcessor* EllipticalRRectEffect::onCreateGLSLInstance() const {
|
|
|
| //////////////////////////////////////////////////////////////////////////////
|
|
|
| -GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
|
| +sk_sp<GrFragmentProcessor> GrRRectEffect::Make(GrPrimitiveEdgeType edgeType, const SkRRect& rrect) {
|
| if (rrect.isRect()) {
|
| - return GrConvexPolyEffect::Create(edgeType, rrect.getBounds());
|
| + return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
|
| }
|
|
|
| if (rrect.isOval()) {
|
| - return GrOvalEffect::Create(edgeType, rrect.getBounds());
|
| + return GrOvalEffect::Make(edgeType, rrect.getBounds());
|
| }
|
|
|
| if (rrect.isSimple()) {
|
| if (rrect.getSimpleRadii().fX < kRadiusMin || rrect.getSimpleRadii().fY < kRadiusMin) {
|
| // In this case the corners are extremely close to rectangular and we collapse the
|
| // clip to a rectangular clip.
|
| - return GrConvexPolyEffect::Create(edgeType, rrect.getBounds());
|
| + return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
|
| }
|
| if (rrect.getSimpleRadii().fX == rrect.getSimpleRadii().fY) {
|
| - return CircularRRectEffect::Create(edgeType, CircularRRectEffect::kAll_CornerFlags,
|
| + return CircularRRectEffect::Make(edgeType, CircularRRectEffect::kAll_CornerFlags,
|
| rrect);
|
| } else {
|
| - return EllipticalRRectEffect::Create(edgeType, rrect);
|
| + return EllipticalRRectEffect::Make(edgeType, rrect);
|
| }
|
| }
|
|
|
| @@ -755,10 +756,10 @@ GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
|
| if (squashedRadii) {
|
| rr.writable()->setRectRadii(rrect.getBounds(), radii);
|
| }
|
| - return CircularRRectEffect::Create(edgeType, cornerFlags, *rr);
|
| + return CircularRRectEffect::Make(edgeType, cornerFlags, *rr);
|
| }
|
| case CircularRRectEffect::kNone_CornerFlags:
|
| - return GrConvexPolyEffect::Create(edgeType, rrect.getBounds());
|
| + return GrConvexPolyEffect::Make(edgeType, rrect.getBounds());
|
| default: {
|
| if (squashedRadii) {
|
| // If we got here then we squashed some but not all the radii to zero. (If all
|
| @@ -767,7 +768,7 @@ GrFragmentProcessor* GrRRectEffect::Create(GrPrimitiveEdgeType edgeType, const S
|
| return nullptr;
|
| }
|
| if (rrect.isNinePatch()) {
|
| - return EllipticalRRectEffect::Create(edgeType, rrect);
|
| + return EllipticalRRectEffect::Make(edgeType, rrect);
|
| }
|
| return nullptr;
|
| }
|
|
|