diff options
author | Brian Salomon <bsalomon@google.com> | 2017-08-11 09:40:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-08-11 14:13:26 +0000 |
commit | aff329b8e9b239bca1d93b13a914fbef45ccf7fe (patch) | |
tree | 06ba42a557c6695f145bcf4956c981fc87af55ff /gm | |
parent | e2cbd0451832ec71d1b498e0f64d02b7d096b2b7 (diff) |
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>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/bigrrectaaeffect.cpp | 2 | ||||
-rw-r--r-- | gm/constcolorprocessor.cpp | 2 | ||||
-rw-r--r-- | gm/convexpolyeffect.cpp | 4 | ||||
-rw-r--r-- | gm/rrects.cpp | 2 | ||||
-rw-r--r-- | gm/texturedomaineffect.cpp | 10 | ||||
-rw-r--r-- | gm/windowrectangles.cpp | 16 | ||||
-rw-r--r-- | gm/yuvtorgbeffect.cpp | 9 |
7 files changed, 22 insertions, 23 deletions
diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index e60cfdf7b8..da89f45e1f 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -77,7 +77,7 @@ protected: SkRRect rrect = fRRect; rrect.offset(SkIntToScalar(x + kGap), SkIntToScalar(y + kGap)); - sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrect)); + std::unique_ptr<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrect)); SkASSERT(fp); if (fp) { GrPaint grPaint; diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index 39926a98eb..6e6ed0dc18 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -106,7 +106,7 @@ protected: GrConstColorProcessor::InputMode mode = (GrConstColorProcessor::InputMode) m; GrColor4f color = GrColor4f::FromGrColor(kColors[procColor]); - sk_sp<GrFragmentProcessor> fp(GrConstColorProcessor::Make(color, mode)); + auto fp = GrConstColorProcessor::Make(color, mode); grPaint.addColorFragmentProcessor(std::move(fp)); renderTargetContext->priv().testingOnly_addDrawOp( diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index 414acaac5b..dcde1045c9 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -191,7 +191,7 @@ protected: path->transform(m, &p); GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; - sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, p)); + std::unique_ptr<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, p)); if (!fp) { continue; } @@ -231,7 +231,7 @@ protected: SkRect rect = *iter.get(); rect.offset(x, y); GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; - sk_sp<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, rect)); + std::unique_ptr<GrFragmentProcessor> fp(GrConvexPolyEffect::Make(edgeType, rect)); if (!fp) { continue; } diff --git a/gm/rrects.cpp b/gm/rrects.cpp index 3124895a49..399085034a 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -106,7 +106,7 @@ protected: SkRRect rrect = fRRects[curRRect]; rrect.offset(SkIntToScalar(x), SkIntToScalar(y)); GrPrimitiveEdgeType edgeType = (GrPrimitiveEdgeType) et; - sk_sp<GrFragmentProcessor> fp(GrRRectEffect::Make(edgeType, rrect)); + auto fp = GrRRectEffect::Make(edgeType, rrect); if (fp) { GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index 68260dee0f..930e2682c6 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -122,12 +122,10 @@ protected: GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m; GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); - sk_sp<GrFragmentProcessor> fp( - GrTextureDomainEffect::Make( - proxy, - nullptr, textureMatrices[tm], - GrTextureDomain::MakeTexelDomainForMode(texelDomains[d], mode), - mode, GrSamplerParams::kNone_FilterMode)); + auto fp = GrTextureDomainEffect::Make( + proxy, nullptr, textureMatrices[tm], + GrTextureDomain::MakeTexelDomainForMode(texelDomains[d], mode), mode, + GrSamplerParams::kNone_FilterMode); if (!fp) { continue; diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index dc5b93dbe0..f656b23aa0 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -149,18 +149,20 @@ private: */ class AlphaOnlyClip final : public MaskOnlyClipBase { public: - AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) { - int w = mask->width(), h = mask->height(); - fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(std::move(mask), - SkIRect::MakeWH(w, h), {x, y}); - } + AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) : fMask(mask), fX(x), fY(y) {} + private: bool apply(GrContext*, GrRenderTargetContext*, bool, bool, GrAppliedClip* out, SkRect* bounds) const override { - out->addCoverageFP(fFP); + int w = fMask->width(); + int h = fMask->height(); + out->addCoverageFP(GrDeviceSpaceTextureDecalFragmentProcessor::Make( + fMask, SkIRect::MakeWH(w, h), {fX, fY})); return true; } - sk_sp<GrFragmentProcessor> fFP; + sk_sp<GrTextureProxy> fMask; + int fX; + int fY; }; /** diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index 5a9ccddb71..001c53d701 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -118,7 +118,7 @@ protected: {1, 2, 0}, {2, 0, 1}, {2, 1, 0}}; for (int i = 0; i < 6; ++i) { - sk_sp<GrFragmentProcessor> fp( + std::unique_ptr<GrFragmentProcessor> fp( GrYUVEffect::MakeYUVToRGB(proxy[indices[i][0]], proxy[indices[i][1]], proxy[indices[i][2]], @@ -247,13 +247,12 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); - sk_sp<GrFragmentProcessor> fp( - GrYUVEffect::MakeYUVToRGB(proxy[0], proxy[1], proxy[2], sizes, - static_cast<SkYUVColorSpace>(space), true)); + auto fp = GrYUVEffect::MakeYUVToRGB(proxy[0], proxy[1], proxy[2], sizes, + static_cast<SkYUVColorSpace>(space), true); if (fp) { SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); - grPaint.addColorFragmentProcessor(fp); + grPaint.addColorFragmentProcessor(std::move(fp)); renderTargetContext->priv().testingOnly_addDrawOp(GrRectOpFactory::MakeNonAAFill( std::move(grPaint), viewMatrix, renderRect, GrAAType::kNone)); } |