Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: src/effects/gradients/SkRadialGradient.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkRadialGradient.cpp
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index a0fee273d7b4e02546044a1c179dee671d1c7806..c7e665654992cec0642634143b930877b2dbc8ba 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -264,11 +264,11 @@ private:
class GrRadialGradient : public GrGradientEffect {
public:
- static GrFragmentProcessor* Create(GrContext* ctx,
- const SkRadialGradient& shader,
- const SkMatrix& matrix,
- SkShader::TileMode tm) {
- return new GrRadialGradient(ctx, shader, matrix, tm);
+ static sk_sp<GrFragmentProcessor> Make(GrContext* ctx,
+ const SkRadialGradient& shader,
+ const SkMatrix& matrix,
+ SkShader::TileMode tm) {
+ return sk_sp<GrFragmentProcessor>(new GrRadialGradient(ctx, shader, matrix, tm));
}
virtual ~GrRadialGradient() { }
@@ -302,7 +302,7 @@ private:
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient);
-const GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d) {
+sk_sp<GrFragmentProcessor> GrRadialGradient::TestCreate(GrProcessorTestData* d) {
SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
SkScalar radius = d->fRandom->nextUScalar1();
@@ -312,7 +312,7 @@ const GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d)
SkShader::TileMode tm;
int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm);
auto shader = SkGradientShader::MakeRadial(center, radius, colors, stops, colorCount, tm);
- const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
+ sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(d->fContext,
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
SkSourceGammaTreatment::kRespect);
GrAlwaysAssert(fp);
@@ -338,7 +338,7 @@ void GrGLRadialGradient::emitCode(EmitArgs& args) {
/////////////////////////////////////////////////////////////////////
-const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
+sk_sp<GrFragmentProcessor> SkRadialGradient::asFragmentProcessor(
GrContext* context,
const SkMatrix& viewM,
const SkMatrix* localMatrix,
@@ -358,9 +358,8 @@ const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
matrix.postConcat(inv);
}
matrix.postConcat(fPtsToUnit);
- SkAutoTUnref<const GrFragmentProcessor> inner(
- GrRadialGradient::Create(context, *this, matrix, fTileMode));
- return GrFragmentProcessor::MulOutputByInputAlpha(inner);
+ sk_sp<GrFragmentProcessor> inner(GrRadialGradient::Make(context, *this, matrix, fTileMode));
+ return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
}
#endif
« no previous file with comments | « src/effects/gradients/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698