diff options
author | 2017-06-15 12:07:18 -0400 | |
---|---|---|
committer | 2017-06-15 17:18:19 +0000 | |
commit | fbcef6eb8abad142daf45418516550f7635b4a52 (patch) | |
tree | 1fb2b2a1df72ba87ec05a91bd1cd271e24b5544e /src/gpu/effects | |
parent | baaf439eb5d08097d794f13800e5bf7ce8885f95 (diff) |
Clean up GrResourceProvider usage
The only substantive changes are the removal of GrProxy instantiation in:
SkGpuBlurUtils::GaussianBlur
GrSimpleTextureEffect::Make*
Change-Id: I10970609693bd6ff5b3a3c21b41d82642bb277bc
Reviewed-on: https://skia-review.googlesource.com/19965
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects')
20 files changed, 133 insertions, 202 deletions
diff --git a/src/gpu/effects/Gr1DKernelEffect.h b/src/gpu/effects/Gr1DKernelEffect.h index c8d6a55f32..bc05e45933 100644 --- a/src/gpu/effects/Gr1DKernelEffect.h +++ b/src/gpu/effects/Gr1DKernelEffect.h @@ -28,9 +28,9 @@ public: kY_Direction, }; - Gr1DKernelEffect(GrResourceProvider* resourceProvider, OptimizationFlags optFlags, + Gr1DKernelEffect(OptimizationFlags optFlags, sk_sp<GrTextureProxy> proxy, Direction direction, int radius) - : INHERITED(resourceProvider, optFlags, std::move(proxy), nullptr, SkMatrix::I()) + : INHERITED(optFlags, std::move(proxy), nullptr, SkMatrix::I()) , fDirection(direction) , fRadius(radius) { } diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index d54f4df6fe..6d8072f231 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -132,28 +132,27 @@ void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman, } } -GrBicubicEffect::GrBicubicEffect(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, +GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix &matrix, const SkShader::TileMode tileModes[2]) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), - GR_PROXY_MOVE(proxy), - std::move(colorSpaceXform), - matrix, - GrSamplerParams(tileModes, GrSamplerParams::kNone_FilterMode)} - , fDomain(GrTextureDomain::IgnoredDomain()) { + : INHERITED{ModulationFlags(proxy->config()), + GR_PROXY_MOVE(proxy), + std::move(colorSpaceXform), + matrix, + GrSamplerParams(tileModes, GrSamplerParams::kNone_FilterMode)} + , fDomain(GrTextureDomain::IgnoredDomain()) { this->initClassID<GrBicubicEffect>(); } -GrBicubicEffect::GrBicubicEffect(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, +GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix &matrix, const SkRect& domain) - : INHERITED(resourceProvider, ModulationFlags(proxy->config()), proxy, - std::move(colorSpaceXform), matrix, - GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode)) - , fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode) { + : INHERITED(ModulationFlags(proxy->config()), proxy, + std::move(colorSpaceXform), matrix, + GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode)) + , fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode) { this->initClassID<GrBicubicEffect>(); } @@ -183,8 +182,7 @@ sk_sp<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) { sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom); static const SkShader::TileMode kClampClamp[] = { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode }; - return GrBicubicEffect::Make(d->resourceProvider(), - d->textureProxy(texIdx), std::move(colorSpaceXform), + return GrBicubicEffect::Make(d->textureProxy(texIdx), std::move(colorSpaceXform), SkMatrix::I(), kClampClamp); } #endif diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h index 7cc8c1ef79..de9468b1b2 100644 --- a/src/gpu/effects/GrBicubicEffect.h +++ b/src/gpu/effects/GrBicubicEffect.h @@ -29,12 +29,11 @@ public: /** * Create a Mitchell filter effect with specified texture matrix and x/y tile modes. */ - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const SkShader::TileMode tileModes[2]) { - return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(resourceProvider, std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(std::move(proxy), std::move(colorSpaceXform), matrix, tileModes)); } @@ -42,12 +41,11 @@ public: /** * Create a Mitchell filter effect with a texture matrix and a domain. */ - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const SkRect& domain) { - return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(resourceProvider, std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(std::move(proxy), std::move(colorSpaceXform), matrix, domain)); } @@ -63,9 +61,9 @@ public: GrSamplerParams::FilterMode* filterMode); private: - GrBicubicEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, + GrBicubicEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix &matrix, const SkShader::TileMode tileModes[2]); - GrBicubicEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, + GrBicubicEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix &matrix, const SkRect& domain); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index eb9b7b8c7d..9de3b463c4 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -114,14 +114,14 @@ private: /////////////////////////////////////////////////////////////////////////////// -GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrResourceProvider* resourceProvider, GrColor color, +GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords) : fColor(color) , fLocalMatrix(localMatrix) , fUsesLocalCoords(usesLocalCoords) - , fTextureSampler(resourceProvider, std::move(proxy), params) + , fTextureSampler(std::move(proxy), params) , fInColor(nullptr) , fMaskFormat(format) { this->initClassID<GrBitmapTextGeoProc>(); @@ -181,8 +181,7 @@ sk_sp<GrGeometryProcessor> GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* break; } - return GrBitmapTextGeoProc::Make(d->resourceProvider(), GrRandomColor(d->fRandom), - std::move(proxy), + return GrBitmapTextGeoProc::Make(GrRandomColor(d->fRandom), std::move(proxy), params, format, GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } diff --git a/src/gpu/effects/GrBitmapTextGeoProc.h b/src/gpu/effects/GrBitmapTextGeoProc.h index aa9afc2e5c..c3ddadcc8e 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.h +++ b/src/gpu/effects/GrBitmapTextGeoProc.h @@ -21,12 +21,12 @@ class GrInvariantOutput; */ class GrBitmapTextGeoProc : public GrGeometryProcessor { public: - static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color, + static sk_sp<GrGeometryProcessor> Make(GrColor color, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& p, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( - new GrBitmapTextGeoProc(resourceProvider, color, std::move(proxy), p, format, + new GrBitmapTextGeoProc(color, std::move(proxy), p, format, localMatrix, usesLocalCoords)); } @@ -48,7 +48,7 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override; private: - GrBitmapTextGeoProc(GrResourceProvider*, GrColor, sk_sp<GrTextureProxy>, + GrBitmapTextGeoProc(GrColor, sk_sp<GrTextureProxy>, const GrSamplerParams& params, GrMaskFormat format, const SkMatrix& localMatrix, bool usesLocalCoords); diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index 41c7e6f56c..e4989de507 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -137,8 +137,8 @@ bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context desc.fHeight = kSize; desc.fConfig = kConfig; - GrResourceProvider* resourceProvider = context->resourceProvider(); - sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(resourceProvider, desc, + sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(), + desc, SkBudgeted::kYes, data, 0); if (!dataProxy) { return false; @@ -156,7 +156,7 @@ bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context sk_sp<GrFragmentProcessor> pmToUPM(new GrConfigConversionEffect(kToUnpremul_PMConversion)); sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(kToPremul_PMConversion)); - paint1.addColorTextureProcessor(resourceProvider, dataProxy, nullptr, SkMatrix::I()); + paint1.addColorTextureProcessor(dataProxy, nullptr, SkMatrix::I()); paint1.addColorFragmentProcessor(pmToUPM); paint1.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -165,14 +165,14 @@ bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context return false; } - paint2.addColorTextureProcessor(resourceProvider, readRTC->asTextureProxyRef(), nullptr, + paint2.addColorTextureProcessor(readRTC->asTextureProxyRef(), nullptr, SkMatrix::I()); paint2.addColorFragmentProcessor(std::move(upmToPM)); paint2.setPorterDuffXPFactory(SkBlendMode::kSrc); tempRTC->fillRectToRect(GrNoClip(), std::move(paint2), GrAA::kNo, SkMatrix::I(), kRect, kRect); - paint3.addColorTextureProcessor(resourceProvider, tempRTC->asTextureProxyRef(), nullptr, + paint3.addColorTextureProcessor(tempRTC->asTextureProxyRef(), nullptr, SkMatrix::I()); paint3.addColorFragmentProcessor(std::move(pmToUPM)); paint3.setPorterDuffXPFactory(SkBlendMode::kSrc); diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index 51c4b55c83..f0f4ec4fa3 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -222,8 +222,7 @@ private: /////////////////////////////////////////////////////////////////////////////// -GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrResourceProvider* resourceProvider, - GrColor color, +GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, @@ -234,7 +233,7 @@ GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrResourceProvider* r bool usesLocalCoords) : fColor(color) , fViewMatrix(viewMatrix) - , fTextureSampler(resourceProvider, std::move(proxy), params) + , fTextureSampler(std::move(proxy), params) #ifdef SK_GAMMA_APPLY_TO_A8 , fDistanceAdjust(distanceAdjust) #endif @@ -289,8 +288,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorT flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0; } - return GrDistanceFieldA8TextGeoProc::Make(d->resourceProvider(), - GrRandomColor(d->fRandom), + return GrDistanceFieldA8TextGeoProc::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), std::move(proxy), params, #ifdef SK_GAMMA_APPLY_TO_A8 @@ -472,20 +470,18 @@ private: }; /////////////////////////////////////////////////////////////////////////////// -GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( - GrResourceProvider* resourceProvider, - GrColor color, - const SkMatrix& viewMatrix, - sk_sp<GrTextureProxy> proxy, - const GrSamplerParams& params, - uint32_t flags, - bool usesLocalCoords) - : fColor(color) - , fViewMatrix(viewMatrix) - , fTextureSampler(resourceProvider, std::move(proxy), params) - , fFlags(flags & kNonLCD_DistanceFieldEffectMask) - , fInColor(nullptr) - , fUsesLocalCoords(usesLocalCoords) { +GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc(GrColor color, + const SkMatrix& viewMatrix, + sk_sp<GrTextureProxy> proxy, + const GrSamplerParams& params, + uint32_t flags, + bool usesLocalCoords) + : fColor(color) + , fViewMatrix(viewMatrix) + , fTextureSampler(std::move(proxy), params) + , fFlags(flags & kNonLCD_DistanceFieldEffectMask) + , fInColor(nullptr) + , fUsesLocalCoords(usesLocalCoords) { SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); this->initClassID<GrDistanceFieldPathGeoProc>(); fInPosition = &this->addVertexAttrib("inPosition", kVec2f_GrVertexAttribType, @@ -533,8 +529,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTes flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0; } - return GrDistanceFieldPathGeoProc::Make(d->resourceProvider(), - GrRandomColor(d->fRandom), + return GrDistanceFieldPathGeoProc::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), std::move(proxy), params, @@ -776,7 +771,6 @@ private: /////////////////////////////////////////////////////////////////////////////// GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( - GrResourceProvider* resourceProvider, GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, @@ -784,7 +778,7 @@ GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( uint32_t flags, bool usesLocalCoords) : fColor(color) , fViewMatrix(viewMatrix) - , fTextureSampler(resourceProvider, std::move(proxy), params) + , fTextureSampler(std::move(proxy), params) , fDistanceAdjust(distanceAdjust) , fFlags(flags & kLCD_DistanceFieldEffectMask) , fUsesLocalCoords(usesLocalCoords) { @@ -835,8 +829,7 @@ sk_sp<GrGeometryProcessor> GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessor flags |= d->fRandom->nextBool() ? kScaleOnly_DistanceFieldEffectFlag : 0; } flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; - return GrDistanceFieldLCDTextGeoProc::Make(d->resourceProvider(), - GrRandomColor(d->fRandom), + return GrDistanceFieldLCDTextGeoProc::Make(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), std::move(proxy), params, wa, diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h index 1384d2fc63..c0cc2e9e13 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.h +++ b/src/gpu/effects/GrDistanceFieldGeoProc.h @@ -49,23 +49,21 @@ enum GrDistanceFieldEffectFlags { class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor { public: #ifdef SK_GAMMA_APPLY_TO_A8 - static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, - GrColor color, const SkMatrix& viewMatrix, + static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, float lum, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( - new GrDistanceFieldA8TextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy), + new GrDistanceFieldA8TextGeoProc(color, viewMatrix, std::move(proxy), params, lum, flags, usesLocalCoords)); } #else - static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, - GrColor color, const SkMatrix& viewMatrix, + static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( - new GrDistanceFieldA8TextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy), + new GrDistanceFieldA8TextGeoProc(color, viewMatrix, std::move(proxy), params, flags, usesLocalCoords)); } #endif @@ -90,7 +88,7 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: - GrDistanceFieldA8TextGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix, + GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, #ifdef SK_GAMMA_APPLY_TO_A8 float distanceAdjust, @@ -123,12 +121,12 @@ private: */ class GrDistanceFieldPathGeoProc : public GrGeometryProcessor { public: - static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color, + static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( - new GrDistanceFieldPathGeoProc(resourceProvider, color, viewMatrix, std::move(proxy), + new GrDistanceFieldPathGeoProc(color, viewMatrix, std::move(proxy), params, flags, usesLocalCoords)); } @@ -149,7 +147,7 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: - GrDistanceFieldPathGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix, + GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy>, const GrSamplerParams&, uint32_t flags, bool usesLocalCoords); @@ -190,14 +188,15 @@ public: } }; - static sk_sp<GrGeometryProcessor> Make(GrResourceProvider* resourceProvider, GrColor color, + static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, - DistanceAdjust distanceAdjust, uint32_t flags, + DistanceAdjust distanceAdjust, + uint32_t flags, bool usesLocalCoords) { return sk_sp<GrGeometryProcessor>( - new GrDistanceFieldLCDTextGeoProc(resourceProvider, color, viewMatrix, std::move(proxy), + new GrDistanceFieldLCDTextGeoProc(color, viewMatrix, std::move(proxy), params, distanceAdjust, flags, usesLocalCoords)); } @@ -220,7 +219,7 @@ public: GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps&) const override; private: - GrDistanceFieldLCDTextGeoProc(GrResourceProvider*, GrColor, const SkMatrix& viewMatrix, + GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix, sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, DistanceAdjust wa, uint32_t flags, bool usesLocalCoords); diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index ae4de1bfa2..b089409afa 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -168,15 +168,13 @@ static void fill_in_1D_guassian_kernel(float* kernel, int width, float gaussianS } GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, Direction direction, int radius, float gaussianSigma, bool useBounds, int bounds[2]) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), direction, radius} @@ -237,8 +235,7 @@ sk_sp<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate( int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius); float sigma = radius / 3.f; - return GrGaussianConvolutionFragmentProcessor::Make( - d->resourceProvider(), d->textureProxy(texIdx), - dir, radius, sigma, useBounds, bounds); + return GrGaussianConvolutionFragmentProcessor::Make(d->textureProxy(texIdx), + dir, radius, sigma, useBounds, bounds); } #endif diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h index dfe423466d..d6398726b5 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h @@ -18,15 +18,14 @@ class GrGaussianConvolutionFragmentProcessor : public Gr1DKernelEffect { public: /// Convolve with a Gaussian kernel - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, Direction dir, int halfWidth, float gaussianSigma, bool useBounds, int* bounds) { return sk_sp<GrFragmentProcessor>(new GrGaussianConvolutionFragmentProcessor( - resourceProvider, std::move(proxy), dir, halfWidth, gaussianSigma, useBounds, bounds)); + std::move(proxy), dir, halfWidth, gaussianSigma, useBounds, bounds)); } ~GrGaussianConvolutionFragmentProcessor() override; @@ -49,7 +48,7 @@ public: private: /// Convolve with a Gaussian kernel - GrGaussianConvolutionFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, Direction, + GrGaussianConvolutionFragmentProcessor(sk_sp<GrTextureProxy>, Direction, int halfWidth, float gaussianSigma, bool useBounds, int bounds[2]); diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index d1726a0122..bc1537c8b4 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -148,8 +148,7 @@ void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma fDomain.setData(pdman, conv.domain(), texture); } -GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy, const SkIRect& bounds, const SkISize& kernelSize, const SkScalar* kernel, @@ -160,7 +159,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrResourceProvider* resourc bool convolveAlpha) // To advertise either the modulation or opaqueness optimizations we'd have to examine the // parameters. - : INHERITED(resourceProvider, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I()) + : INHERITED(kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I()) , fKernelSize(kernelSize) , fGain(SkScalarToFloat(gain)) , fBias(SkScalarToFloat(bias) / 255.0f) @@ -226,7 +225,6 @@ static void fill_in_2D_gaussian_kernel(float* kernel, int width, int height, // Static function to create a 2D convolution sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, const SkIRect& bounds, const SkISize& kernelSize, @@ -242,7 +240,7 @@ sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian( fill_in_2D_gaussian_kernel(kernel, kernelSize.width(), kernelSize.height(), sigmaX, sigmaY); return sk_sp<GrFragmentProcessor>( - new GrMatrixConvolutionEffect(resourceProvider, std::move(proxy), bounds, kernelSize, + new GrMatrixConvolutionEffect(std::move(proxy), bounds, kernelSize, kernel, gain, bias, kernelOffset, tileMode, convolveAlpha)); } @@ -272,8 +270,7 @@ sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTest GrTextureDomain::Mode tileMode = static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2)); bool convolveAlpha = d->fRandom->nextBool(); - return GrMatrixConvolutionEffect::Make(d->resourceProvider(), - std::move(proxy), + return GrMatrixConvolutionEffect::Make(std::move(proxy), bounds, kernelSize, kernel.get(), diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h index 6104f11402..ffd05fa06f 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.h +++ b/src/gpu/effects/GrMatrixConvolutionEffect.h @@ -17,8 +17,7 @@ class GrMatrixConvolutionEffect : public GrSingleTextureEffect { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, const SkIRect& bounds, const SkISize& kernelSize, const SkScalar* kernel, @@ -28,12 +27,11 @@ public: GrTextureDomain::Mode tileMode, bool convolveAlpha) { return sk_sp<GrFragmentProcessor>( - new GrMatrixConvolutionEffect(resourceProvider, std::move(proxy), bounds, kernelSize, + new GrMatrixConvolutionEffect(std::move(proxy), bounds, kernelSize, kernel, gain, bias, kernelOffset, tileMode, convolveAlpha)); } - static sk_sp<GrFragmentProcessor> MakeGaussian(GrResourceProvider*, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> MakeGaussian(sk_sp<GrTextureProxy> proxy, const SkIRect& bounds, const SkISize& kernelSize, SkScalar gain, @@ -56,8 +54,7 @@ public: const char* name() const override { return "MatrixConvolution"; } private: - GrMatrixConvolutionEffect(GrResourceProvider*, - sk_sp<GrTextureProxy> proxy, + GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy, const SkIRect& bounds, const SkISize& kernelSize, const SkScalar* kernel, diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 307188b96a..938fb04ab9 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -11,13 +11,11 @@ #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" -GrSimpleTextureEffect::GrSimpleTextureEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrSimpleTextureEffect::GrSimpleTextureEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, GrSamplerParams::FilterMode filterMode) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), std::move(colorSpaceXform), matrix, @@ -25,13 +23,11 @@ GrSimpleTextureEffect::GrSimpleTextureEffect(GrResourceProvider* resourceProvide this->initClassID<GrSimpleTextureEffect>(); } -GrSimpleTextureEffect::GrSimpleTextureEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrSimpleTextureEffect::GrSimpleTextureEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const GrSamplerParams& params) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), std::move(colorSpaceXform), matrix, @@ -109,7 +105,7 @@ sk_sp<GrFragmentProcessor> GrSimpleTextureEffect::TestCreate(GrProcessorTestData const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom); - return GrSimpleTextureEffect::Make(d->resourceProvider(), d->textureProxy(texIdx), + return GrSimpleTextureEffect::Make(d->textureProxy(texIdx), std::move(colorSpaceXform), matrix); } #endif diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index 0b01ac79a3..0bf2dcce68 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -21,56 +21,31 @@ class GrInvariantOutput; class GrSimpleTextureEffect : public GrSingleTextureEffect { public: /* unfiltered, clamp mode */ - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix) { - // MDB TODO: remove this instantiation once instantiation is pushed past the - // TextureSamplers. Instantiation failure in the TextureSampler is difficult to - // recover from. - if (!proxy->instantiate(resourceProvider)) { - return nullptr; - } - return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(resourceProvider, std::move(proxy), + new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, GrSamplerParams::kNone_FilterMode)); } /* clamp mode */ - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, GrSamplerParams::FilterMode filterMode) { - // MDB TODO: remove this instantiation once instantiation is pushed past the - // TextureSamplers. Instantiation failure in the TextureSampler is difficult to - // recover from. - if (!proxy->instantiate(resourceProvider)) { - return nullptr; - } - return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(resourceProvider, std::move(proxy), + new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, filterMode)); } - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const GrSamplerParams& p) { - // MDB TODO: remove this instantiation once instantiation is pushed past the - // TextureSamplers. Instantiation failure in the TextureSampler is difficult to - // recover from. - if (!proxy->instantiate(resourceProvider)) { - return nullptr; - } - - return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(resourceProvider, - std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, p)); } @@ -80,11 +55,11 @@ public: const char* name() const override { return "SimpleTexture"; } private: - GrSimpleTextureEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrSimpleTextureEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, GrSamplerParams::FilterMode); - GrSimpleTextureEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrSimpleTextureEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, const GrSamplerParams&); diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp index f5d70003e6..9dbf32d9c9 100644 --- a/src/gpu/effects/GrSingleTextureEffect.cpp +++ b/src/gpu/effects/GrSingleTextureEffect.cpp @@ -9,41 +9,38 @@ #include "GrTextureProxy.h" -GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider, - OptimizationFlags optFlags, +GrSingleTextureEffect::GrSingleTextureEffect(OptimizationFlags optFlags, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m) : INHERITED(optFlags) - , fCoordTransform(resourceProvider, m, proxy.get()) - , fTextureSampler(resourceProvider, std::move(proxy)) + , fCoordTransform(m, proxy.get()) + , fTextureSampler(std::move(proxy)) , fColorSpaceXform(std::move(colorSpaceXform)) { this->addCoordTransform(&fCoordTransform); this->addTextureSampler(&fTextureSampler); } -GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider, - OptimizationFlags optFlags, +GrSingleTextureEffect::GrSingleTextureEffect(OptimizationFlags optFlags, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m, GrSamplerParams::FilterMode filterMode) : INHERITED(optFlags) - , fCoordTransform(resourceProvider, m, proxy.get()) - , fTextureSampler(resourceProvider, std::move(proxy), filterMode) + , fCoordTransform(m, proxy.get()) + , fTextureSampler(std::move(proxy), filterMode) , fColorSpaceXform(std::move(colorSpaceXform)) { this->addCoordTransform(&fCoordTransform); this->addTextureSampler(&fTextureSampler); } -GrSingleTextureEffect::GrSingleTextureEffect(GrResourceProvider* resourceProvider, - OptimizationFlags optFlags, +GrSingleTextureEffect::GrSingleTextureEffect(OptimizationFlags optFlags, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& m, const GrSamplerParams& params) : INHERITED(optFlags) - , fCoordTransform(resourceProvider, m, proxy.get()) - , fTextureSampler(resourceProvider, std::move(proxy), params) + , fCoordTransform(m, proxy.get()) + , fTextureSampler(std::move(proxy), params) , fColorSpaceXform(std::move(colorSpaceXform)) { this->addCoordTransform(&fCoordTransform); this->addTextureSampler(&fTextureSampler); diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h index 5c7c0bd034..eab29c61e8 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -11,9 +11,9 @@ #include "GrFragmentProcessor.h" #include "GrColorSpaceXform.h" #include "GrCoordTransform.h" -#include "SkMatrix.h" class GrTextureProxy; +class SkMatrix; /** * A base class for effects that draw a single texture with a texture matrix. This effect has no @@ -31,13 +31,13 @@ public: protected: /** unfiltered, clamp mode */ - GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>, + GrSingleTextureEffect(OptimizationFlags, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&); /** clamp mode */ - GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>, + GrSingleTextureEffect(OptimizationFlags, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&, GrSamplerParams::FilterMode filterMode); - GrSingleTextureEffect(GrResourceProvider*, OptimizationFlags, sk_sp<GrTextureProxy>, + GrSingleTextureEffect(OptimizationFlags, sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&, const GrSamplerParams&); /** @@ -56,8 +56,8 @@ protected: } private: - GrCoordTransform fCoordTransform; - TextureSampler fTextureSampler; + GrCoordTransform fCoordTransform; + TextureSampler fTextureSampler; sk_sp<GrColorSpaceXform> fColorSpaceXform; typedef GrFragmentProcessor INHERITED; diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 3269f4136e..dce16a868e 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -243,8 +243,7 @@ inline GrFragmentProcessor::OptimizationFlags GrTextureDomainEffect::OptFlags( } } -sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const SkRect& domain, @@ -252,24 +251,23 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(GrResourceProvider* resou GrSamplerParams::FilterMode filterMode) { if (GrTextureDomain::kIgnore_Mode == mode || (GrTextureDomain::kClamp_Mode == mode && can_ignore_rect(proxy.get(), domain))) { - return GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy), + return GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), matrix, filterMode); } else { return sk_sp<GrFragmentProcessor>( - new GrTextureDomainEffect(resourceProvider, std::move(proxy), + new GrTextureDomainEffect(std::move(proxy), std::move(colorSpaceXform), matrix, domain, mode, filterMode)); } } -GrTextureDomainEffect::GrTextureDomainEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrTextureDomainEffect::GrTextureDomainEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const SkRect& domain, GrTextureDomain::Mode mode, GrSamplerParams::FilterMode filterMode) - : GrSingleTextureEffect(resourceProvider, OptFlags(proxy->config(), mode), proxy, + : GrSingleTextureEffect(OptFlags(proxy->config(), mode), proxy, std::move(colorSpaceXform), matrix, filterMode) , fTextureDomain(proxy.get(), domain, mode) { SkASSERT(mode != GrTextureDomain::kRepeat_Mode || @@ -350,8 +348,7 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom); - return GrTextureDomainEffect::Make(d->resourceProvider(), - std::move(proxy), + return GrTextureDomainEffect::Make(std::move(proxy), std::move(colorSpaceXform), matrix, domain, @@ -363,21 +360,19 @@ sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData /////////////////////////////////////////////////////////////////////////////// sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, const SkIRect& subset, const SkIPoint& deviceSpaceOffset) { return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProcessor( - resourceProvider, std::move(proxy), subset, deviceSpaceOffset)); + std::move(proxy), subset, deviceSpaceOffset)); } GrDeviceSpaceTextureDecalFragmentProcessor::GrDeviceSpaceTextureDecalFragmentProcessor( - GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, - const SkIRect& subset, - const SkIPoint& deviceSpaceOffset) + sk_sp<GrTextureProxy> proxy, + const SkIRect& subset, + const SkIPoint& deviceSpaceOffset) : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag) - , fTextureSampler(resourceProvider, proxy, GrSamplerParams::ClampNoFilter()) + , fTextureSampler(proxy, GrSamplerParams::ClampNoFilter()) , fTextureDomain(proxy.get(), GrTextureDomain::MakeTexelDomain(subset), GrTextureDomain::kDecal_Mode) { this->addTextureSampler(&fTextureSampler); @@ -465,7 +460,6 @@ sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreat SkIPoint pt; pt.fX = d->fRandom->nextULessThan(2048); pt.fY = d->fRandom->nextULessThan(2048); - return GrDeviceSpaceTextureDecalFragmentProcessor::Make(d->resourceProvider(), - std::move(proxy), subset, pt); + return GrDeviceSpaceTextureDecalFragmentProcessor::Make(std::move(proxy), subset, pt); } #endif diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h index d8cd69569b..afd4d5f1a0 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -153,8 +153,7 @@ protected: class GrTextureDomainEffect : public GrSingleTextureEffect { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, - sk_sp<GrTextureProxy>, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&, const SkRect& domain, @@ -175,8 +174,7 @@ public: private: GrTextureDomain fTextureDomain; - GrTextureDomainEffect(GrResourceProvider*, - sk_sp<GrTextureProxy>, + GrTextureDomainEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&, const SkRect& domain, @@ -198,7 +196,7 @@ private: class GrDeviceSpaceTextureDecalFragmentProcessor : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, sk_sp<GrTextureProxy>, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy>, const SkIRect& subset, const SkIPoint& deviceSpaceOffset); @@ -219,7 +217,7 @@ private: GrTextureDomain fTextureDomain; SkIPoint fDeviceSpaceOffset; - GrDeviceSpaceTextureDecalFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrDeviceSpaceTextureDecalFragmentProcessor(sk_sp<GrTextureProxy>, const SkIRect&, const SkIPoint&); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp index be4d6c2d5c..feb2670b02 100644 --- a/src/gpu/effects/GrYUVEffect.cpp +++ b/src/gpu/effects/GrYUVEffect.cpp @@ -62,8 +62,7 @@ static const float kRec709InverseConversionMatrix[16] = { class YUVtoRGBEffect : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> yProxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy, sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3], SkYUVColorSpace colorSpace, bool nv12) { @@ -87,7 +86,7 @@ public: GrSamplerParams::kBilerp_FilterMode : GrSamplerParams::kNone_FilterMode; return sk_sp<GrFragmentProcessor>(new YUVtoRGBEffect( - resourceProvider, std::move(yProxy), std::move(uProxy), std::move(vProxy), + std::move(yProxy), std::move(uProxy), std::move(vProxy), yuvMatrix, uvFilterMode, colorSpace, nv12)); } @@ -153,16 +152,15 @@ public: }; private: - YUVtoRGBEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy, + YUVtoRGBEffect(sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy, sk_sp<GrTextureProxy> vProxy, const SkMatrix yuvMatrix[3], GrSamplerParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace, bool nv12) : INHERITED(kPreservesOpaqueInput_OptimizationFlag) - , fYTransform(resourceProvider, yuvMatrix[0], yProxy.get()) - , fYSampler(resourceProvider, std::move(yProxy)) - , fUTransform(resourceProvider, yuvMatrix[1], uProxy.get()) - , fUSampler(resourceProvider, std::move(uProxy), uvFilterMode) - , fVSampler(resourceProvider, vProxy, uvFilterMode) + , fYTransform(yuvMatrix[0], yProxy.get()) + , fYSampler(std::move(yProxy)) + , fUTransform(yuvMatrix[1], uProxy.get()) + , fUSampler(std::move(uProxy), uvFilterMode) + , fVSampler(vProxy, uvFilterMode) , fColorSpace(colorSpace) , fNV12(nv12) { this->initClassID<YUVtoRGBEffect>(); @@ -171,7 +169,7 @@ private: this->addCoordTransform(&fUTransform); this->addTextureSampler(&fUSampler); if (!fNV12) { - fVTransform = GrCoordTransform(resourceProvider, yuvMatrix[2], vProxy.get()); + fVTransform = GrCoordTransform(yuvMatrix[2], vProxy.get()); this->addCoordTransform(&fVTransform); this->addTextureSampler(&fVSampler); } @@ -360,15 +358,13 @@ private: ////////////////////////////////////////////////////////////////////////////// -sk_sp<GrFragmentProcessor> GrYUVEffect::MakeYUVToRGB(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> yProxy, +sk_sp<GrFragmentProcessor> GrYUVEffect::MakeYUVToRGB(sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy, sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3], SkYUVColorSpace colorSpace, bool nv12) { SkASSERT(yProxy && uProxy && vProxy && sizes); - return YUVtoRGBEffect::Make(resourceProvider, - std::move(yProxy), std::move(uProxy), std::move(vProxy), + return YUVtoRGBEffect::Make(std::move(yProxy), std::move(uProxy), std::move(vProxy), sizes, colorSpace, nv12); } diff --git a/src/gpu/effects/GrYUVEffect.h b/src/gpu/effects/GrYUVEffect.h index 7b05f90548..ae62a16562 100644 --- a/src/gpu/effects/GrYUVEffect.h +++ b/src/gpu/effects/GrYUVEffect.h @@ -10,7 +10,6 @@ #include "SkImageInfo.h" -class GrResourceProvider; class GrFragmentProcessor; class GrTextureProxy; @@ -19,8 +18,7 @@ namespace GrYUVEffect { * Creates an effect that performs color conversion from YUV to RGB. The input textures are * assumed to be kA8_GrPixelConfig. */ - sk_sp<GrFragmentProcessor> MakeYUVToRGB(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> yProxy, + sk_sp<GrFragmentProcessor> MakeYUVToRGB(sk_sp<GrTextureProxy> yProxy, sk_sp<GrTextureProxy> uProxy, sk_sp<GrTextureProxy> vProxy, const SkISize sizes[3], SkYUVColorSpace colorSpace, bool nv12); |