diff options
99 files changed, 384 insertions, 611 deletions
diff --git a/gm/texdata.cpp b/gm/texdata.cpp index 7bb7173f13..42723e4436 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -117,8 +117,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) { } else { vm.reset(); } - paint.addColorTextureProcessor(context->resourceProvider(), tContext->asTextureProxyRef(), - nullptr, vm); + paint.addColorTextureProcessor(tContext->asTextureProxyRef(), nullptr, vm); renderTargetContext->drawRect(clip, GrPaint(paint), GrAA::kNo, vm, SkRect::MakeWH(2 * S, 2 * S)); diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index e54404ef64..3fa835bd65 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -123,7 +123,7 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); sk_sp<GrFragmentProcessor> fp( GrTextureDomainEffect::Make( - context->resourceProvider(), proxy, + proxy, nullptr, textureMatrices[tm], GrTextureDomain::MakeTexelDomainForMode(texelDomains[d], mode), mode, GrSamplerParams::kNone_FilterMode)); diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp index 8738c3fd6a..7c054a0db9 100644 --- a/gm/windowrectangles.cpp +++ b/gm/windowrectangles.cpp @@ -12,10 +12,10 @@ #if SK_SUPPORT_GPU # include "GrAppliedClip.h" -# include "GrRenderTargetContext.h" -# include "GrRenderTargetContextPriv.h" # include "GrFixedClip.h" # include "GrReducedClip.h" +# include "GrRenderTargetContext.h" +# include "GrRenderTargetContextPriv.h" # include "GrResourceProvider.h" # include "effects/GrTextureDomain.h" #endif @@ -149,9 +149,9 @@ private: */ class AlphaOnlyClip final : public MaskOnlyClipBase { public: - AlphaOnlyClip(GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> mask, int x, int y) { + AlphaOnlyClip(sk_sp<GrTextureProxy> mask, int x, int y) { int w = mask->width(), h = mask->height(); - fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(resourceProvider, std::move(mask), + fFP = GrDeviceSpaceTextureDecalFragmentProcessor::Make(std::move(mask), SkIRect::MakeWH(w, h), {x, y}); } private: @@ -225,7 +225,7 @@ void WindowRectanglesMaskGM::visualizeAlphaMask(GrContext* ctx, GrRenderTargetCo // Now visualize the alpha mask by drawing a rect over the area where it is defined. The regions // inside window rectangles or outside the scissor should still have the initial checkerboard // intact. (This verifies we didn't spend any time modifying those pixels in the mask.) - AlphaOnlyClip clip(ctx->resourceProvider(), maskRTC->asTextureProxyRef(), x, y); + AlphaOnlyClip clip(maskRTC->asTextureProxyRef(), x, y); rtc->drawRect(clip, std::move(paint), GrAA::kYes, SkMatrix::I(), SkRect::Make(SkIRect::MakeXYWH(x, y, maskRTC->width(), maskRTC->height()))); } diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index c6effed793..5a9ccddb71 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -119,8 +119,7 @@ protected: for (int i = 0; i < 6; ++i) { sk_sp<GrFragmentProcessor> fp( - GrYUVEffect::MakeYUVToRGB(context->resourceProvider(), - proxy[indices[i][0]], + GrYUVEffect::MakeYUVToRGB(proxy[indices[i][0]], proxy[indices[i][1]], proxy[indices[i][2]], sizes, @@ -249,8 +248,7 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); sk_sp<GrFragmentProcessor> fp( - GrYUVEffect::MakeYUVToRGB(context->resourceProvider(), - proxy[0], proxy[1], proxy[2], sizes, + GrYUVEffect::MakeYUVToRGB(proxy[0], proxy[1], proxy[2], sizes, static_cast<SkYUVColorSpace>(space), true)); if (fp) { SkMatrix viewMatrix; diff --git a/gn/gpu.gni b/gn/gpu.gni index 2a1ed00c75..9dee9f5a54 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -69,7 +69,6 @@ skia_gpu_sources = [ "$_src/gpu/GrColorSpaceXform.h", "$_src/gpu/GrContext.cpp", "$_src/gpu/GrContextPriv.h", - "$_src/gpu/GrCoordTransform.cpp", "$_src/gpu/GrCoordTransform.h", "$_src/gpu/GrDefaultGeoProcFactory.cpp", "$_src/gpu/GrDefaultGeoProcFactory.h", @@ -239,6 +238,7 @@ skia_gpu_sources = [ "$_src/gpu/ops/GrAnalyticRectOp.h", "$_src/gpu/ops/GrAtlasTextOp.cpp", "$_src/gpu/ops/GrAtlasTextOp.h", + "$_src/gpu/ops/GrClearOp.cpp", "$_src/gpu/ops/GrClearOp.h", "$_src/gpu/ops/GrClearStencilClipOp.h", "$_src/gpu/ops/GrCopySurfaceOp.cpp", diff --git a/src/core/SkColorSpaceXformImageGenerator.cpp b/src/core/SkColorSpaceXformImageGenerator.cpp index 5d97a024bc..79b4650625 100644 --- a/src/core/SkColorSpaceXformImageGenerator.cpp +++ b/src/core/SkColorSpaceXformImageGenerator.cpp @@ -71,8 +71,8 @@ sk_sp<GrTextureProxy> SkColorSpaceXformImageGenerator::onGenerateTexture(GrConte SkASSERT(ctx); - sk_sp<GrTextureProxy> proxy = - GrUploadBitmapToTextureProxy(ctx->resourceProvider(), fSrc, nullptr); + sk_sp<GrTextureProxy> proxy = GrUploadBitmapToTextureProxy(ctx->resourceProvider(), + fSrc, nullptr); sk_sp<SkColorSpace> srcSpace = fSrc.colorSpace() ? sk_ref_sp(fSrc.colorSpace()) : SkColorSpace::MakeSRGB(); @@ -89,8 +89,8 @@ sk_sp<GrTextureProxy> SkColorSpaceXformImageGenerator::onGenerateTexture(GrConte GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); - paint.addColorTextureProcessor(ctx->resourceProvider(), proxy, nullptr, - SkMatrix::MakeTrans(origin.fX, origin.fY)); + paint.addColorTextureProcessor(std::move(proxy), nullptr, + SkMatrix::MakeTrans(origin.fX, origin.fY)); paint.addColorFragmentProcessor(std::move(xform)); const SkRect rect = SkRect::MakeWH(info.width(), info.height()); diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp index 64bf203fd3..40a6c24706 100644 --- a/src/core/SkGpuBlurUtils.cpp +++ b/src/core/SkGpuBlurUtils.cpp @@ -79,10 +79,8 @@ static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext, GrPaint paint; paint.setGammaCorrect(renderTargetContext->isGammaCorrect()); - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - sk_sp<GrFragmentProcessor> conv(GrGaussianConvolutionFragmentProcessor::Make( - resourceProvider, std::move(proxy), direction, radius, sigma, useBounds, bounds)); + std::move(proxy), direction, radius, sigma, useBounds, bounds)); paint.addColorFragmentProcessor(std::move(conv)); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); SkMatrix localMatrix = SkMatrix::MakeTrans(-SkIntToScalar(srcOffset.x()), @@ -109,10 +107,8 @@ static void convolve_gaussian_2d(GrRenderTargetContext* renderTargetContext, paint.setGammaCorrect(renderTargetContext->isGammaCorrect()); SkIRect bounds = srcBounds ? *srcBounds : SkIRect::EmptyIRect(); - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - sk_sp<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::MakeGaussian( - resourceProvider, std::move(proxy), bounds, size, 1.0, 0.0, kernelOffset, + std::move(proxy), bounds, size, 1.0, 0.0, kernelOffset, srcBounds ? GrTextureDomain::kDecal_Mode : GrTextureDomain::kIgnore_Mode, true, sigmaX, sigmaY)); paint.addColorFragmentProcessor(std::move(conv)); @@ -197,16 +193,6 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, SkBackingFit fit) { SkASSERT(context); - { - // MDB TODO: remove this - // Chrome is crashing with proxies when they need to be instantiated. - // Force an instantiation here (where, in olden days, we used to require a GrTexture) - // to see if the input is already un-instantiable. - if (!srcProxy->instantiate(context->resourceProvider())) { - return nullptr; - } - } - SkIRect clearRect; int scaleFactorX, radiusX; int scaleFactorY, radiusY; @@ -280,7 +266,6 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, domain.inset((i < scaleFactorX) ? SK_ScalarHalf : 0.0f, (i < scaleFactorY) ? SK_ScalarHalf : 0.0f); sk_sp<GrFragmentProcessor> fp(GrTextureDomainEffect::Make( - context->resourceProvider(), std::move(srcProxy), nullptr, SkMatrix::I(), @@ -292,7 +277,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, srcOffset.set(0, 0); } else { GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kBilerp_FilterMode); - paint.addColorTextureProcessor(context->resourceProvider(), std::move(srcProxy), + paint.addColorTextureProcessor(std::move(srcProxy), nullptr, SkMatrix::I(), params); } paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -379,7 +364,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, return nullptr; } - paint.addColorTextureProcessor(context->resourceProvider(), std::move(proxy), + paint.addColorTextureProcessor(std::move(proxy), nullptr, SkMatrix::I(), params); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index de1b74e4ce..2a45c5bd92 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -27,7 +27,6 @@ inline GrFragmentProcessor::OptimizationFlags GrAlphaThresholdFragmentProcessor: } GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, sk_sp<GrTextureProxy> maskProxy, @@ -37,14 +36,13 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( : INHERITED(OptFlags(outerThreshold)) , fInnerThreshold(innerThreshold) , fOuterThreshold(outerThreshold) - , fImageCoordTransform(resourceProvider, SkMatrix::I(), proxy.get()) - , fImageTextureSampler(resourceProvider, std::move(proxy)) + , fImageCoordTransform(SkMatrix::I(), proxy.get()) + , fImageTextureSampler(std::move(proxy)) , fColorSpaceXform(std::move(colorSpaceXform)) , fMaskCoordTransform( - resourceProvider, SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), maskProxy.get()) - , fMaskTextureSampler(resourceProvider, maskProxy) { + , fMaskTextureSampler(std::move(maskProxy)) { this->initClassID<GrAlphaThresholdFragmentProcessor>(); this->addCoordTransform(&fImageCoordTransform); this->addTextureSampler(&fImageTextureSampler); @@ -159,8 +157,7 @@ sk_sp<GrFragmentProcessor> GrAlphaThresholdFragmentProcessor::TestCreate(GrProce uint32_t y = d->fRandom->nextULessThan(kMaxHeight - height); SkIRect bounds = SkIRect::MakeXYWH(x, y, width, height); sk_sp<GrColorSpaceXform> colorSpaceXform = GrTest::TestColorXform(d->fRandom); - return GrAlphaThresholdFragmentProcessor::Make(d->resourceProvider(), - std::move(bmpProxy), + return GrAlphaThresholdFragmentProcessor::Make(std::move(bmpProxy), std::move(colorSpaceXform), std::move(maskProxy), innerThresh, outerThresh, diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h index f7690d3b97..de58bbfc62 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.h +++ b/src/effects/GrAlphaThresholdFragmentProcessor.h @@ -20,15 +20,13 @@ class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, sk_sp<GrTextureProxy> maskProxy, float innerThreshold, float outerThreshold, const SkIRect& bounds) { return sk_sp<GrFragmentProcessor>(new GrAlphaThresholdFragmentProcessor( - resourceProvider, std::move(proxy), std::move(colorSpaceXform), std::move(maskProxy), @@ -46,8 +44,7 @@ public: private: static OptimizationFlags OptFlags(float outerThreshold); - GrAlphaThresholdFragmentProcessor(GrResourceProvider*, - sk_sp<GrTextureProxy> proxy, + GrAlphaThresholdFragmentProcessor(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, sk_sp<GrTextureProxy> maskProxy, float innerThreshold, diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp index 56dd456253..d99f0c78ba 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.cpp +++ b/src/effects/GrCircleBlurFragmentProcessor.cpp @@ -82,8 +82,7 @@ void GrCircleBlurFragmentProcessor::GLSLProcessor::onSetData(const GrGLSLProgram /////////////////////////////////////////////////////////////////////////////// -GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(GrResourceProvider* resourceProvider, - const SkRect& circle, +GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(const SkRect& circle, float textureRadius, float solidRadius, sk_sp<GrTextureProxy> blurProfile) @@ -91,8 +90,7 @@ GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(GrResourceProvider* , fCircle(circle) , fSolidRadius(solidRadius) , fTextureRadius(textureRadius) - , fBlurProfileSampler(resourceProvider, std::move(blurProfile), - GrSamplerParams::kBilerp_FilterMode) { + , fBlurProfileSampler(std::move(blurProfile), GrSamplerParams::kBilerp_FilterMode) { this->initClassID<GrCircleBlurFragmentProcessor>(); this->addTextureSampler(&fBlurProfileSampler); } @@ -340,8 +338,7 @@ sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrResourceProvide if (!profile) { return nullptr; } - return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(resourceProvider, - circle, + return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(circle, textureRadius, solidRadius, std::move(profile))); } diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h index c6cf3ba923..f25bd8c085 100644 --- a/src/effects/GrCircleBlurFragmentProcessor.h +++ b/src/effects/GrCircleBlurFragmentProcessor.h @@ -45,7 +45,7 @@ private: * The x texture coord should map from 0 to 1 across the radius range of solidRadius to * solidRadius + textureRadius. */ - GrCircleBlurFragmentProcessor(GrResourceProvider*, const SkRect& circle, + GrCircleBlurFragmentProcessor(const SkRect& circle, float textureRadius, float innerRadius, sk_sp<GrTextureProxy> blurProfile); diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index b725257f59..4918859bf6 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -173,7 +173,6 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage* outProps.colorSpace()); sk_sp<GrFragmentProcessor> fp(GrAlphaThresholdFragmentProcessor::Make( - context->resourceProvider(), std::move(inputProxy), std::move(colorSpaceXform), std::move(maskProxy), diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp index eebaa9570b..94be346122 100644 --- a/src/effects/SkArithmeticImageFilter.cpp +++ b/src/effects/SkArithmeticImageFilter.cpp @@ -324,11 +324,9 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ArithmeticFP); sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU( SkSpecialImage* source, - sk_sp<SkSpecialImage> - background, + sk_sp<SkSpecialImage> background, const SkIPoint& backgroundOffset, - sk_sp<SkSpecialImage> - foreground, + sk_sp<SkSpecialImage> foreground, const SkIPoint& foregroundOffset, const SkIRect& bounds, const OutputProperties& outputProperties) const { @@ -355,7 +353,7 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU( sk_sp<GrColorSpaceXform> bgXform = GrColorSpaceXform::Make(background->getColorSpace(), outputProperties.colorSpace()); bgFP = GrTextureDomainEffect::Make( - context->resourceProvider(), std::move(backgroundProxy), std::move(bgXform), + std::move(backgroundProxy), std::move(bgXform), backgroundMatrix, GrTextureDomain::MakeTexelDomain(background->subset()), GrTextureDomain::kDecal_Mode, GrSamplerParams::kNone_FilterMode); } else { @@ -371,7 +369,7 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU( sk_sp<GrFragmentProcessor> foregroundFP; foregroundFP = GrTextureDomainEffect::Make( - context->resourceProvider(), std::move(foregroundProxy), std::move(fgXform), + std::move(foregroundProxy), std::move(fgXform), foregroundMatrix, GrTextureDomain::MakeTexelDomain(foreground->subset()), GrTextureDomain::kDecal_Mode, GrSamplerParams::kNone_FilterMode); diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 93f335bfb9..665abcb742 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -802,8 +802,7 @@ public: precision = kDefault_GrSLPrecision; } - return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(resourceProvider, - rect, sigma, + return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(rect, sigma, std::move(blurProfile), precision)); } @@ -812,7 +811,7 @@ public: GrSLPrecision precision() const { return fPrecision; } private: - GrRectBlurEffect(GrResourceProvider*, const SkRect& rect, float sigma, + GrRectBlurEffect(const SkRect& rect, float sigma, sk_sp<GrTextureProxy> blurProfile, GrSLPrecision fPrecision); GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; @@ -973,14 +972,13 @@ sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture( return blurProfile; } -GrRectBlurEffect::GrRectBlurEffect(GrResourceProvider* resourceProvider, - const SkRect& rect, float sigma, +GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, sk_sp<GrTextureProxy> blurProfile, GrSLPrecision precision) : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag) , fRect(rect) , fSigma(sigma) - , fBlurProfileSampler(resourceProvider, std::move(blurProfile)) + , fBlurProfileSampler(std::move(blurProfile)) , fPrecision(precision) { this->initClassID<GrRectBlurEffect>(); this->addTextureSampler(&fBlurProfileSampler); @@ -1084,7 +1082,7 @@ public: private: GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - GrRRectBlurEffect(GrResourceProvider*, float sigma, const SkRRect&, + GrRRectBlurEffect(float sigma, const SkRRect&, sk_sp<GrTextureProxy> profileProxy); virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps, @@ -1198,19 +1196,17 @@ sk_sp<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, return nullptr; } - return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(context->resourceProvider(), - xformedSigma, + return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(xformedSigma, devRRect, std::move(mask))); } -GrRRectBlurEffect::GrRRectBlurEffect(GrResourceProvider* resourceProvider, - float sigma, const SkRRect& rrect, +GrRRectBlurEffect::GrRRectBlurEffect(float sigma, const SkRRect& rrect, sk_sp<GrTextureProxy> ninePatchProxy) : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag) , fRRect(rrect) , fSigma(sigma) - , fNinePatchSampler(resourceProvider, std::move(ninePatchProxy)) { + , fNinePatchSampler(std::move(ninePatchProxy)) { this->initClassID<GrRRectBlurEffect>(); this->addTextureSampler(&fNinePatchSampler); } @@ -1513,8 +1509,7 @@ sk_sp<GrTextureProxy> SkBlurMaskFilterImpl::filterMaskGPU(GrContext* context, if (!isNormalBlur) { GrPaint paint; // Blend pathTexture over blurTexture. - paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(context->resourceProvider(), - std::move(srcProxy), + paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(std::move(srcProxy), nullptr, SkMatrix::I())); if (kInner_SkBlurStyle == fBlurStyle) { // inner: dst = dst * src diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 7b5c6e0199..82c2b59aca 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -215,14 +215,13 @@ void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const { class GrDisplacementMapEffect : public GrFragmentProcessor { public: static sk_sp<GrFragmentProcessor> Make( - GrResourceProvider* resourceProvider, SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale, sk_sp<GrTextureProxy> displacement, const SkMatrix& offsetMatrix, sk_sp<GrTextureProxy> color, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkISize& colorDimensions) { return sk_sp<GrFragmentProcessor>( - new GrDisplacementMapEffect(resourceProvider, xChannelSelector, yChannelSelector, scale, + new GrDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, std::move(displacement), offsetMatrix, std::move(color), std::move(colorSpaceXform), colorDimensions)); @@ -249,8 +248,7 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - GrDisplacementMapEffect(GrResourceProvider*, - SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, + GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, const SkVector& scale, sk_sp<GrTextureProxy> displacement, const SkMatrix& offsetMatrix, @@ -341,8 +339,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou colorSpace); GrPaint paint; paint.addColorFragmentProcessor( - GrDisplacementMapEffect::Make(context->resourceProvider(), - fXChannelSelector, + GrDisplacementMapEffect::Make(fXChannelSelector, fYChannelSelector, scale, std::move(displProxy), @@ -500,7 +497,6 @@ void GrDisplacementMapEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps, } GrDisplacementMapEffect::GrDisplacementMapEffect( - GrResourceProvider* resourceProvider, SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, const SkVector& scale, @@ -511,12 +507,12 @@ GrDisplacementMapEffect::GrDisplacementMapEffect( const SkISize& colorDimensions) : INHERITED(GrPixelConfigIsOpaque(color->config()) ? kPreservesOpaqueInput_OptimizationFlag : kNone_OptimizationFlags) - , fDisplacementTransform(resourceProvider, offsetMatrix, displacement.get()) - , fDisplacementSampler(resourceProvider, displacement) - , fColorTransform(resourceProvider, color.get()) + , fDisplacementTransform(offsetMatrix, displacement.get()) + , fDisplacementSampler(displacement) + , fColorTransform(color.get()) , fDomain(color.get(), GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(colorDimensions)), GrTextureDomain::kDecal_Mode) - , fColorSampler(resourceProvider, color) + , fColorSampler(color) , fColorSpaceXform(std::move(colorSpaceXform)) , fXChannelSelector(xChannelSelector) , fYChannelSelector(yChannelSelector) @@ -563,8 +559,7 @@ sk_sp<GrFragmentProcessor> GrDisplacementMapEffect::TestCreate(GrProcessorTestDa colorDimensions.fWidth = d->fRandom->nextRangeU(0, colorProxy->width()); colorDimensions.fHeight = d->fRandom->nextRangeU(0, colorProxy->height()); auto colorSpaceXform = GrTest::TestColorXform(d->fRandom); - return GrDisplacementMapEffect::Make(d->resourceProvider(), - xChannelSelector, yChannelSelector, scale, + return GrDisplacementMapEffect::Make(xChannelSelector, yChannelSelector, scale, std::move(dispProxy), SkMatrix::I(), std::move(colorProxy), colorSpaceXform, colorDimensions); diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 6254430f38..fe6a39a2c4 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -360,8 +360,7 @@ protected: const SkIRect& bounds, const SkMatrix& matrix, const OutputProperties& outputProperties) const; - virtual sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*, - sk_sp<GrTextureProxy>, + virtual sk_sp<GrFragmentProcessor> makeFragmentProcessor(sk_sp<GrTextureProxy>, const SkMatrix&, const SkIRect* srcBounds, BoundaryMode boundaryMode) const = 0; @@ -389,12 +388,10 @@ void SkLightingImageFilterInternal::drawRect(GrRenderTargetContext* renderTarget BoundaryMode boundaryMode, const SkIRect* srcBounds, const SkIRect& bounds) const { - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y())); GrPaint paint; paint.setGammaCorrect(renderTargetContext->isGammaCorrect()); - sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(resourceProvider, std::move(srcProxy), + sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(std::move(srcProxy), matrix, srcBounds, boundaryMode)); paint.addColorFragmentProcessor(std::move(fp)); @@ -493,7 +490,7 @@ protected: sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; #if SK_SUPPORT_GPU - sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + sk_sp<GrFragmentProcessor> makeFragmentProcessor(sk_sp<GrTextureProxy>, const SkMatrix&, const SkIRect* bounds, BoundaryMode) const override; #endif @@ -530,7 +527,7 @@ protected: sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const override; #if SK_SUPPORT_GPU - sk_sp<GrFragmentProcessor> makeFragmentProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + sk_sp<GrFragmentProcessor> makeFragmentProcessor(sk_sp<GrTextureProxy>, const SkMatrix&, const SkIRect* bounds, BoundaryMode) const override; #endif @@ -546,7 +543,7 @@ private: class GrLightingEffect : public GrSingleTextureEffect { public: - GrLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrLightingEffect(sk_sp<GrTextureProxy>, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, BoundaryMode boundaryMode, const SkIRect* srcBounds); ~GrLightingEffect() override; @@ -573,8 +570,7 @@ private: class GrDiffuseLightingEffect : public GrLightingEffect { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, @@ -582,7 +578,7 @@ public: BoundaryMode boundaryMode, const SkIRect* srcBounds) { return sk_sp<GrFragmentProcessor>( - new GrDiffuseLightingEffect(resourceProvider, std::move(proxy), light, + new GrDiffuseLightingEffect(std::move(proxy), light, surfaceScale, matrix, kd, boundaryMode, srcBounds)); } @@ -597,7 +593,7 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - GrDiffuseLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrDiffuseLightingEffect(sk_sp<GrTextureProxy>, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, @@ -613,8 +609,7 @@ private: class GrSpecularLightingEffect : public GrLightingEffect { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, @@ -623,7 +618,7 @@ public: BoundaryMode boundaryMode, const SkIRect* srcBounds) { return sk_sp<GrFragmentProcessor>( - new GrSpecularLightingEffect(resourceProvider, std::move(proxy), + new GrSpecularLightingEffect(std::move(proxy), light, surfaceScale, matrix, ks, shininess, boundaryMode, srcBounds)); } @@ -640,7 +635,7 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - GrSpecularLightingEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrSpecularLightingEffect(sk_sp<GrTextureProxy>, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, @@ -1372,13 +1367,12 @@ void SkDiffuseLightingImageFilter::toString(SkString* str) const { #if SK_SUPPORT_GPU sk_sp<GrFragmentProcessor> SkDiffuseLightingImageFilter::makeFragmentProcessor( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, const SkMatrix& matrix, const SkIRect* srcBounds, BoundaryMode boundaryMode) const { SkScalar scale = this->surfaceScale() * 255; - return GrDiffuseLightingEffect::Make(resourceProvider, std::move(proxy), + return GrDiffuseLightingEffect::Make(std::move(proxy), this->light(), scale, matrix, this->kd(), boundaryMode, srcBounds); } @@ -1547,13 +1541,12 @@ void SkSpecularLightingImageFilter::toString(SkString* str) const { #if SK_SUPPORT_GPU sk_sp<GrFragmentProcessor> SkSpecularLightingImageFilter::makeFragmentProcessor( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, const SkMatrix& matrix, const SkIRect* srcBounds, BoundaryMode boundaryMode) const { SkScalar scale = this->surfaceScale() * 255; - return GrSpecularLightingEffect::Make(resourceProvider, std::move(proxy), this->light(), + return GrSpecularLightingEffect::Make(std::move(proxy), this->light(), scale, matrix, this->ks(), this->shininess(), boundaryMode, srcBounds); } @@ -1734,15 +1727,14 @@ static GrTextureDomain create_domain(GrTextureProxy* proxy, const SkIRect* srcBo } } -GrLightingEffect::GrLightingEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrLightingEffect::GrLightingEffect(sk_sp<GrTextureProxy> proxy, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, BoundaryMode boundaryMode, const SkIRect* srcBounds) // Perhaps this could advertise the opaque or coverage-as-alpha optimizations? - : INHERITED(resourceProvider, kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I()) + : INHERITED(kNone_OptimizationFlags, proxy, nullptr, SkMatrix::I()) , fLight(light) , fSurfaceScale(surfaceScale) , fFilterMatrix(matrix) @@ -1764,16 +1756,14 @@ bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const { /////////////////////////////////////////////////////////////////////////////// -GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrDiffuseLightingEffect::GrDiffuseLightingEffect(sk_sp<GrTextureProxy> proxy, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, SkScalar kd, BoundaryMode boundaryMode, const SkIRect* srcBounds) - : INHERITED(resourceProvider, std::move(proxy), light, surfaceScale, matrix, - boundaryMode, srcBounds), fKD(kd) { + : INHERITED(std::move(proxy), light, surfaceScale, matrix, boundaryMode, srcBounds), fKD(kd) { this->initClassID<GrDiffuseLightingEffect>(); } @@ -1810,8 +1800,7 @@ sk_sp<GrFragmentProcessor> GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa d->fRandom->nextRangeU(0, proxy->width()), d->fRandom->nextRangeU(0, proxy->height())); BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount); - return GrDiffuseLightingEffect::Make(d->resourceProvider(), - std::move(proxy), light.get(), surfaceScale, + return GrDiffuseLightingEffect::Make(std::move(proxy), light.get(), surfaceScale, matrix, kd, mode, &srcBounds); } #endif @@ -1981,8 +1970,7 @@ void GrGLDiffuseLightingEffect::onSetData(const GrGLSLProgramDataManager& pdman, /////////////////////////////////////////////////////////////////////////////// -GrSpecularLightingEffect::GrSpecularLightingEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrSpecularLightingEffect::GrSpecularLightingEffect(sk_sp<GrTextureProxy> proxy, const SkImageFilterLight* light, SkScalar surfaceScale, const SkMatrix& matrix, @@ -1990,7 +1978,7 @@ GrSpecularLightingEffect::GrSpecularLightingEffect(GrResourceProvider* resourceP SkScalar shininess, BoundaryMode boundaryMode, const SkIRect* srcBounds) - : INHERITED(resourceProvider, std::move(proxy), light, surfaceScale, + : INHERITED(std::move(proxy), light, surfaceScale, matrix, boundaryMode, srcBounds) , fKS(ks) , fShininess(shininess) { @@ -2033,7 +2021,7 @@ sk_sp<GrFragmentProcessor> GrSpecularLightingEffect::TestCreate(GrProcessorTestD d->fRandom->nextRangeU(0, proxy->height()), d->fRandom->nextRangeU(0, proxy->width()), d->fRandom->nextRangeU(0, proxy->height())); - return GrSpecularLightingEffect::Make(d->resourceProvider(), std::move(proxy), + return GrSpecularLightingEffect::Make(std::move(proxy), light.get(), surfaceScale, matrix, ks, shininess, mode, &srcBounds); } diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp index 1927715539..5e4b466d96 100644 --- a/src/effects/SkMagnifierImageFilter.cpp +++ b/src/effects/SkMagnifierImageFilter.cpp @@ -49,8 +49,7 @@ sk_sp<SkImageFilter> SkMagnifierImageFilter::Make(const SkRect& srcRect, SkScala #if SK_SUPPORT_GPU class GrMagnifierEffect : public GrSingleTextureEffect { public: - 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 SkIRect& bounds, const SkRect& srcRect, @@ -58,8 +57,7 @@ public: float yInvZoom, float xInvInset, float yInvInset) { - return sk_sp<GrFragmentProcessor>(new GrMagnifierEffect(resourceProvider, - std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrMagnifierEffect(std::move(proxy), std::move(colorSpaceXform), bounds, srcRect, xInvZoom, yInvZoom, @@ -82,8 +80,7 @@ public: float yInvInset() const { return fYInvInset; } private: - GrMagnifierEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + GrMagnifierEffect(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkIRect& bounds, const SkRect& srcRect, @@ -91,8 +88,7 @@ private: float yInvZoom, float xInvInset, float yInvInset) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), std::move(colorSpaceXform), SkMatrix::I()} // TODO: no GrSamplerParams::kBilerp_FilterMode? @@ -268,7 +264,6 @@ sk_sp<GrFragmentProcessor> GrMagnifierEffect::TestCreate(GrProcessorTestData* d) SkRect srcRect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); sk_sp<GrFragmentProcessor> effect(GrMagnifierEffect::Make( - d->resourceProvider(), std::move(proxy), std::move(colorSpaceXform), bounds, @@ -359,7 +354,6 @@ sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(SkSpecialImage* sour sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(input->getColorSpace(), dstColorSpace); sk_sp<GrFragmentProcessor> fp(GrMagnifierEffect::Make( - context->resourceProvider(), std::move(inputProxy), std::move(colorSpaceXform), bounds, diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp index 6644ef8045..e92f07247b 100644 --- a/src/effects/SkMatrixConvolutionImageFilter.cpp +++ b/src/effects/SkMatrixConvolutionImageFilter.cpp @@ -315,8 +315,7 @@ sk_sp<SkSpecialImage> SkMatrixConvolutionImageFilter::onFilterImage(SkSpecialIma offset->fY = bounds.top(); bounds.offset(-inputOffset); - sk_sp<GrFragmentProcessor> fp(GrMatrixConvolutionEffect::Make(context->resourceProvider(), - std::move(inputProxy), + sk_sp<GrFragmentProcessor> fp(GrMatrixConvolutionEffect::Make(std::move(inputProxy), bounds, fKernelSize, fKernel, diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 57abec9ebf..0de1735651 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -145,17 +145,15 @@ public: kDilate_MorphologyType, }; - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, Direction dir, int radius, MorphologyType type) { - return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(resourceProvider, std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(std::move(proxy), dir, radius, type)); } - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, Direction dir, int radius, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, Direction dir, int radius, MorphologyType type, const float bounds[2]) { - return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(resourceProvider, std::move(proxy), + return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(std::move(proxy), dir, radius, type, bounds)); } @@ -180,9 +178,9 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - GrMorphologyEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrMorphologyEffect(sk_sp<GrTextureProxy>, Direction, int radius, MorphologyType); - GrMorphologyEffect(GrResourceProvider*, sk_sp<GrTextureProxy>, + GrMorphologyEffect(sk_sp<GrTextureProxy>, Direction, int radius, MorphologyType, const float bounds[2]); GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -322,30 +320,22 @@ void GrGLMorphologyEffect::onSetData(const GrGLSLProgramDataManager& pdman, /////////////////////////////////////////////////////////////////////////////// -GrMorphologyEffect::GrMorphologyEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy, Direction direction, int radius, MorphologyType type) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), - GR_PROXY_MOVE(proxy), - direction, radius} + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), direction, radius} , fType(type) , fUseRange(false) { this->initClassID<GrMorphologyEffect>(); } -GrMorphologyEffect::GrMorphologyEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy, Direction direction, int radius, MorphologyType type, const float range[2]) - : INHERITED{resourceProvider, - ModulationFlags(proxy->config()), - GR_PROXY_MOVE(proxy), - direction, radius} + : INHERITED{ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), direction, radius} , fType(type) , fUseRange(true) { this->initClassID<GrMorphologyEffect>(); @@ -388,8 +378,7 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d MorphologyType type = d->fRandom->nextBool() ? GrMorphologyEffect::kErode_MorphologyType : GrMorphologyEffect::kDilate_MorphologyType; - return GrMorphologyEffect::Make(d->resourceProvider(), - std::move(proxy), dir, radius, type); + return GrMorphologyEffect::Make(std::move(proxy), dir, radius, type); } #endif @@ -406,9 +395,7 @@ static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext, GrPaint paint; paint.setGammaCorrect(renderTargetContext->isGammaCorrect()); - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - - paint.addColorFragmentProcessor(GrMorphologyEffect::Make(resourceProvider, std::move(proxy), + paint.addColorFragmentProcessor(GrMorphologyEffect::Make(std::move(proxy), direction, radius, morphType, bounds)); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -427,9 +414,7 @@ static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetC GrPaint paint; paint.setGammaCorrect(renderTargetContext->isGammaCorrect()); - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - - paint.addColorFragmentProcessor(GrMorphologyEffect::Make(resourceProvider, std::move(proxy), + paint.addColorFragmentProcessor(GrMorphologyEffect::Make(std::move(proxy), direction, radius, morphType)); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); renderTargetContext->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 93d784fe60..589b672622 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -386,7 +386,7 @@ private: bool onIsEqual(const GrFragmentProcessor&) const override; - ColorTableEffect(GrResourceProvider* , sk_sp<GrTextureProxy> proxy, + ColorTableEffect(sk_sp<GrTextureProxy> proxy, GrTextureStripAtlas* atlas, int row, unsigned flags); GR_DECLARE_FRAGMENT_PROCESSOR_TEST; @@ -508,16 +508,13 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi return nullptr; } - return sk_sp<GrFragmentProcessor>(new ColorTableEffect(context->resourceProvider(), - std::move(proxy), - atlas, row, flags)); + return sk_sp<GrFragmentProcessor>(new ColorTableEffect(std::move(proxy), atlas, row, flags)); } -ColorTableEffect::ColorTableEffect(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +ColorTableEffect::ColorTableEffect(sk_sp<GrTextureProxy> proxy, GrTextureStripAtlas* atlas, int row, unsigned flags) : INHERITED(kNone_OptimizationFlags) // Not bothering with table-specific optimizations. - , fTextureSampler(resourceProvider, std::move(proxy)) + , fTextureSampler(std::move(proxy)) , fAtlas(atlas) , fRow(row) { this->initClassID<ColorTableEffect>(); diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 533df33a28..976d2d1e4d 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -254,7 +254,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU( sk_sp<GrColorSpaceXform> bgXform = GrColorSpaceXform::Make(background->getColorSpace(), outputProperties.colorSpace()); bgFP = GrTextureDomainEffect::Make( - context->resourceProvider(), std::move(backgroundProxy), + std::move(backgroundProxy), std::move(bgXform), bgMatrix, GrTextureDomain::MakeTexelDomain(background->subset()), GrTextureDomain::kDecal_Mode, @@ -272,7 +272,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU( sk_sp<GrFragmentProcessor> foregroundFP; foregroundFP = GrTextureDomainEffect::Make( - context->resourceProvider(), std::move(foregroundProxy), + std::move(foregroundProxy), std::move(fgXform), fgMatrix, GrTextureDomain::MakeTexelDomain(foreground->subset()), GrTextureDomain::kDecal_Mode, diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp index 06fa584bda..54125745b4 100644 --- a/src/gpu/GrAHardwareBufferImageGenerator.cpp +++ b/src/gpu/GrAHardwareBufferImageGenerator.cpp @@ -16,7 +16,6 @@ #include "GrBackendSurface.h" #include "GrContext.h" #include "GrContextPriv.h" -#include "GrResourceProvider.h" #include "GrTexture.h" #include <EGL/egl.h> diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 76443ff938..3a8c8ece7e 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -12,7 +12,6 @@ #include "GrContextPriv.h" #include "GrFixedClip.h" #include "GrRenderTargetContextPriv.h" -#include "GrResourceProvider.h" #include "effects/GrSimpleTextureEffect.h" #include "GrStyle.h" #include "GrTextureProxy.h" @@ -40,13 +39,10 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext, return false; } - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - SkMatrix matrix = SkMatrix::MakeTrans(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop)); matrix.preConcat(viewMatrix); - paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, - std::move(mask), + paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(std::move(mask), nullptr, matrix)); renderTargetContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index af5a7ba03b..2ab3c464f8 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -14,6 +14,7 @@ #include "GrFixedClip.h" #include "GrGpuResourcePriv.h" #include "GrRenderTargetPriv.h" +#include "GrResourceProvider.h" #include "GrStencilAttachment.h" #include "GrSWMaskHelper.h" #include "GrTextureProxy.h" @@ -72,12 +73,10 @@ void GrClipStackClip::getConservativeBounds(int width, int height, SkIRect* devR //////////////////////////////////////////////////////////////////////////////// // set up the draw state to enable the aa clipping mask. -static sk_sp<GrFragmentProcessor> create_fp_for_mask(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> mask, +static sk_sp<GrFragmentProcessor> create_fp_for_mask(sk_sp<GrTextureProxy> mask, const SkIRect &devBound) { SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height()); - return GrDeviceSpaceTextureDecalFragmentProcessor::Make(resourceProvider, - std::move(mask), domainTexels, + return GrDeviceSpaceTextureDecalFragmentProcessor::Make(std::move(mask), domainTexels, {devBound.fLeft, devBound.fTop}); } @@ -327,8 +326,7 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar if (result) { // The mask's top left coord should be pinned to the rounded-out top left corner of // the clip's device space bounds. - out->addCoverageFP(create_fp_for_mask(context->resourceProvider(), std::move(result), - reducedClip.ibounds())); + out->addCoverageFP(create_fp_for_mask(std::move(result), reducedClip.ibounds())); return true; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index a96fbce0cd..b0d40f6668 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -382,7 +382,7 @@ bool GrContextPriv::writeSurfacePixels(GrSurfaceContext* dst, if (tempProxy) { sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make( - fContext->resourceProvider(), tempProxy, nullptr, SkMatrix::I()); + tempProxy, nullptr, SkMatrix::I()); if (premulOnGpu) { fp = fContext->createUPMToPMEffect(std::move(fp), useConfigConversionEffect); } @@ -507,7 +507,7 @@ bool GrContextPriv::readSurfacePixels(GrSurfaceContext* src, SkMatrix textureMatrix = SkMatrix::MakeTrans(SkIntToScalar(left), SkIntToScalar(top)); sk_sp<GrTextureProxy> proxy = src->asTextureProxyRef(); sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make( - fContext->resourceProvider(), std::move(proxy), nullptr, textureMatrix); + std::move(proxy), nullptr, textureMatrix); if (unpremulOnGpu) { fp = fContext->createPMToUPMEffect(std::move(fp), useConfigConversionEffect); // We no longer need to do this on CPU after the read back. diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp deleted file mode 100644 index de8b8cc168..0000000000 --- a/src/gpu/GrCoordTransform.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "GrCoordTransform.h" -#include "GrResourceProvider.h" -#include "GrTextureProxy.h" - -void GrCoordTransform::reset(GrResourceProvider* resourceProvider, const SkMatrix& m, - GrTextureProxy* proxy, bool normalize) { - SkASSERT(proxy); - SkASSERT(!fInProcessor); - - fMatrix = m; - // MDB TODO: just GrCaps is needed for this method - fProxy = proxy; - fNormalize = normalize; - fReverseY = kBottomLeft_GrSurfaceOrigin == proxy->origin(); -} diff --git a/src/gpu/GrCoordTransform.h b/src/gpu/GrCoordTransform.h index a791213c04..3ba4fd8ab6 100644 --- a/src/gpu/GrCoordTransform.h +++ b/src/gpu/GrCoordTransform.h @@ -12,7 +12,6 @@ #include "GrSurfaceProxyPriv.h" #include "GrTextureProxy.h" -class GrResourceProvider; class GrTexture; /** @@ -32,21 +31,20 @@ public: * Create a transformation that maps [0, 1] to a proxy's boundaries. The proxy origin also * implies whether a y-reversal should be performed. */ - GrCoordTransform(GrResourceProvider* resourceProvider, GrTextureProxy* proxy) { + GrCoordTransform(GrTextureProxy* proxy) { SkASSERT(proxy); SkDEBUGCODE(fInProcessor = false); - this->reset(resourceProvider, SkMatrix::I(), proxy, true); + this->reset(SkMatrix::I(), proxy, true); } /** * Create a transformation from a matrix. The proxy origin also implies whether a y-reversal * should be performed. */ - GrCoordTransform(GrResourceProvider* resourceProvider, const SkMatrix& m, - GrTextureProxy* proxy) { + GrCoordTransform(const SkMatrix& m, GrTextureProxy* proxy) { SkASSERT(proxy); SkDEBUGCODE(fInProcessor = false); - this->reset(resourceProvider, m, proxy, true); + this->reset(m, proxy, true); } /** @@ -57,7 +55,15 @@ public: this->reset(m); } - void reset(GrResourceProvider*, const SkMatrix&, GrTextureProxy*, bool normalize); + void reset(const SkMatrix& m, GrTextureProxy* proxy, bool normalize) { + SkASSERT(proxy); + SkASSERT(!fInProcessor); + + fMatrix = m; + fProxy = proxy; + fNormalize = normalize; + fReverseY = kBottomLeft_GrSurfaceOrigin == proxy->origin(); + } void reset(const SkMatrix& m) { SkASSERT(!fInProcessor); diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 99a097ac3c..4d90e9a11a 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -9,6 +9,7 @@ #include "GrContext.h" #include "GrGpu.h" +#include "GrOnFlushResourceProvider.h" #include "GrRenderTargetContext.h" #include "GrPathRenderingRenderTargetContext.h" #include "GrRenderTargetProxy.h" diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h index 51c698ddfb..0cbba5a86b 100644 --- a/src/gpu/GrDrawingManager.h +++ b/src/gpu/GrDrawingManager.h @@ -11,7 +11,6 @@ #include "GrOpFlushState.h" #include "GrPathRenderer.h" #include "GrPathRendererChain.h" -#include "GrOnFlushResourceProvider.h" #include "GrRenderTargetOpList.h" #include "GrResourceCache.h" #include "SkTArray.h" @@ -19,6 +18,7 @@ #include "text/GrAtlasTextContext.h" class GrContext; +class GrOnFlushCallbackObject; class GrRenderTargetContext; class GrRenderTargetProxy; class GrSingleOWner; diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 54bb3a7d0a..262f155c24 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -16,9 +16,9 @@ #include "GrMesh.h" #include "GrPathRendering.h" #include "GrPipeline.h" +#include "GrRenderTargetPriv.h" #include "GrResourceCache.h" #include "GrResourceProvider.h" -#include "GrRenderTargetPriv.h" #include "GrStencilAttachment.h" #include "GrStencilSettings.h" #include "GrSurfacePriv.h" diff --git a/src/gpu/GrOnFlushResourceProvider.h b/src/gpu/GrOnFlushResourceProvider.h index b29dc9c73e..6b2570a3ac 100644 --- a/src/gpu/GrOnFlushResourceProvider.h +++ b/src/gpu/GrOnFlushResourceProvider.h @@ -9,6 +9,7 @@ #define GrOnFlushResourceProvider_DEFINED #include "GrTypes.h" +#include "GrResourceProvider.h" #include "SkRefCnt.h" #include "SkTArray.h" diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index 9bbeec5bfc..d9182d2704 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -19,40 +19,33 @@ void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera this->setXPFactory(GrCoverageSetOpXPFactory::Get(regionOp, invertCoverage)); } -void GrPaint::addColorTextureProcessor(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrPaint::addColorTextureProcessor(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix) { - this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy), + this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), matrix)); } -void GrPaint::addColorTextureProcessor(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrPaint::addColorTextureProcessor(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const GrSamplerParams& params) { - this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, - std::move(proxy), + this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), matrix, params)); } -void GrPaint::addCoverageTextureProcessor(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrPaint::addCoverageTextureProcessor(sk_sp<GrTextureProxy> proxy, const SkMatrix& matrix) { - this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, - std::move(proxy), + this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(std::move(proxy), nullptr, matrix)); } -void GrPaint::addCoverageTextureProcessor(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrPaint::addCoverageTextureProcessor(sk_sp<GrTextureProxy> proxy, const SkMatrix& matrix, const GrSamplerParams& params) { - this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(resourceProvider, - std::move(proxy), + this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(std::move(proxy), nullptr, matrix, params)); } diff --git a/src/gpu/GrPaint.h b/src/gpu/GrPaint.h index e2b494ff6f..0d8beb4bff 100644 --- a/src/gpu/GrPaint.h +++ b/src/gpu/GrPaint.h @@ -109,14 +109,14 @@ public: * Helpers for adding color or coverage effects that sample a texture. The matrix is applied * to the src space position to compute texture coordinates. */ - void addColorTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + void addColorTextureProcessor(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&); - void addColorTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + void addColorTextureProcessor(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>, const SkMatrix&, const GrSamplerParams&); - void addCoverageTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, const SkMatrix&); - void addCoverageTextureProcessor(GrResourceProvider*, sk_sp<GrTextureProxy>, + void addCoverageTextureProcessor(sk_sp<GrTextureProxy>, const SkMatrix&); + void addCoverageTextureProcessor(sk_sp<GrTextureProxy>, const SkMatrix&, const GrSamplerParams&); int numColorFragmentProcessors() const { return fColorFragmentProcessors.count(); } diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h index fb9c384269..c55ed57b45 100644 --- a/src/gpu/GrPathRenderer.h +++ b/src/gpu/GrPathRenderer.h @@ -11,7 +11,6 @@ #include "GrCaps.h" #include "GrRenderTargetContext.h" #include "GrPaint.h" -#include "GrResourceProvider.h" #include "GrShape.h" #include "GrUserStencilSettings.h" diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp index 51cfdfb73c..bff33489fa 100644 --- a/src/gpu/GrProcessor.cpp +++ b/src/gpu/GrProcessor.cpp @@ -136,8 +136,7 @@ void GrResourceIOProcessor::addBufferAccess(const BufferAccess* access) { fBufferAccesses.push_back(access); } -void GrResourceIOProcessor::addImageStorageAccess(GrResourceProvider* resourceProvider, - const ImageStorageAccess* access) { +void GrResourceIOProcessor::addImageStorageAccess(const ImageStorageAccess* access) { fImageStorageAccesses.push_back(access); } @@ -223,22 +222,19 @@ bool GrResourceIOProcessor::hasSameSamplersAndAccesses(const GrResourceIOProcess GrResourceIOProcessor::TextureSampler::TextureSampler() {} -GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrResourceIOProcessor::TextureSampler::TextureSampler(sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params) { - this->reset(resourceProvider, std::move(proxy), params); + this->reset(std::move(proxy), params); } -GrResourceIOProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +GrResourceIOProcessor::TextureSampler::TextureSampler(sk_sp<GrTextureProxy> proxy, GrSamplerParams::FilterMode filterMode, SkShader::TileMode tileXAndY, GrShaderFlags visibility) { - this->reset(resourceProvider, std::move(proxy), filterMode, tileXAndY, visibility); + this->reset(std::move(proxy), filterMode, tileXAndY, visibility); } -void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrResourceIOProcessor::TextureSampler::reset(sk_sp<GrTextureProxy> proxy, const GrSamplerParams& params, GrShaderFlags visibility) { fParams = params; @@ -247,8 +243,7 @@ void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourcePr fVisibility = visibility; } -void GrResourceIOProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, +void GrResourceIOProcessor::TextureSampler::reset(sk_sp<GrTextureProxy> proxy, GrSamplerParams::FilterMode filterMode, SkShader::TileMode tileXAndY, GrShaderFlags visibility) { diff --git a/src/gpu/GrProcessor.h b/src/gpu/GrProcessor.h index f186af5591..b7abf2fbe2 100644 --- a/src/gpu/GrProcessor.h +++ b/src/gpu/GrProcessor.h @@ -190,7 +190,7 @@ protected: */ void addTextureSampler(const TextureSampler*); void addBufferAccess(const BufferAccess*); - void addImageStorageAccess(GrResourceProvider* resourceProvider, const ImageStorageAccess*); + void addImageStorageAccess(const ImageStorageAccess*); bool hasSameSamplersAndAccesses(const GrResourceIOProcessor&) const; @@ -219,15 +219,14 @@ public: */ TextureSampler(); - // MDB TODO: ultimately we shouldn't need the resource provider parameter - TextureSampler(GrResourceProvider*, sk_sp<GrTextureProxy>, const GrSamplerParams&); - explicit TextureSampler(GrResourceProvider*, sk_sp<GrTextureProxy>, + TextureSampler(sk_sp<GrTextureProxy>, const GrSamplerParams&); + explicit TextureSampler(sk_sp<GrTextureProxy>, GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode, SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, GrShaderFlags visibility = kFragment_GrShaderFlag); - void reset(GrResourceProvider*, sk_sp<GrTextureProxy>, const GrSamplerParams&, + void reset(sk_sp<GrTextureProxy>, const GrSamplerParams&, GrShaderFlags visibility = kFragment_GrShaderFlag); - void reset(GrResourceProvider*, sk_sp<GrTextureProxy>, + void reset(sk_sp<GrTextureProxy>, GrSamplerParams::FilterMode = GrSamplerParams::kNone_FilterMode, SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, GrShaderFlags visibility = kFragment_GrShaderFlag); diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index bc36247152..c5a115faeb 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -1815,7 +1815,7 @@ uint32_t GrRenderTargetContext::addLegacyMeshDrawOp(GrPipelineBuilder&& pipeline args.fAppliedClip = &appliedClip; args.fRenderTarget = rt; args.fCaps = this->caps(); - args.fResourceProvider = this->resourceProvider(); + args.fResourceProvider = resourceProvider; if (analysis.requiresDstTexture()) { if (!this->setupDstProxy(this->asRenderTargetProxy(), clip, bounds, &args.fDstProxy)) { diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h index c471eacdde..bc226044dd 100644 --- a/src/gpu/GrRenderTargetContext.h +++ b/src/gpu/GrRenderTargetContext.h @@ -54,10 +54,6 @@ class SK_API GrRenderTargetContext : public GrSurfaceContext { public: ~GrRenderTargetContext() override; - // MDB TODO: This access is mainly provided for the image filters. Remove it when they - // no longer need to pass it to the FragmentProcessor ctors. - GrResourceProvider* resourceProvider() { return fContext->resourceProvider(); } - // We use SkPaint rather than GrPaint here for two reasons: // * The SkPaint carries extra text settings. If these were extracted to a lighter object // we could use GrPaint except that diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 19720326ca..10922ac228 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -12,7 +12,6 @@ #include "GrGpuCommandBuffer.h" #include "GrRect.h" #include "GrRenderTargetContext.h" -#include "GrResourceProvider.h" #include "instanced/InstancedRendering.h" #include "ops/GrClearOp.h" #include "ops/GrCopySurfaceOp.h" diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index fb66886098..880991327f 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -160,8 +160,6 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(sk_sp<GrTextureProxy> proxy, return; } - GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider(); - SkRect dstRect = SkRect::Make(deviceSpaceRectToDraw); // We use device coords to compute the texture coordinates. We take the device coords and apply @@ -171,7 +169,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(sk_sp<GrTextureProxy> proxy, SkIntToScalar(-textureOriginInDeviceSpace.fY)); maskMatrix.preConcat(viewMatrix); paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make( - resourceProvider, std::move(proxy), nullptr, maskMatrix, + std::move(proxy), nullptr, maskMatrix, GrSamplerParams::kNone_FilterMode)); renderTargetContext->addDrawOp(clip, GrRectOpFactory::MakeNonAAFillWithLocalMatrix( diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp index 183ec70fcf..86027dd933 100644 --- a/src/gpu/GrTextureAdjuster.cpp +++ b/src/gpu/GrTextureAdjuster.cpp @@ -163,7 +163,7 @@ sk_sp<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor( (domain.fLeft <= domain.fRight && domain.fTop <= domain.fBottom)); sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(fColorSpace, dstColorSpace); - return CreateFragmentProcessorForDomainAndFilter(fContext->resourceProvider(), std::move(proxy), + return CreateFragmentProcessorForDomainAndFilter(std::move(proxy), std::move(colorSpaceXform), textureMatrix, domainMode, domain, filterOrNullForBicubic); diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp index b4e76cbca1..dca8984d60 100644 --- a/src/gpu/GrTextureContext.cpp +++ b/src/gpu/GrTextureContext.cpp @@ -9,7 +9,6 @@ #include "GrContextPriv.h" #include "GrDrawingManager.h" -#include "GrResourceProvider.h" #include "GrTextureOpList.h" #include "../private/GrAuditTrail.h" diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp index 69e3a6e060..44212fe433 100644 --- a/src/gpu/GrTextureMaker.cpp +++ b/src/gpu/GrTextureMaker.cpp @@ -113,7 +113,7 @@ sk_sp<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor( SkASSERT(kTightCopy_DomainMode != domainMode); sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(texColorSpace.get(), dstColorSpace); - return CreateFragmentProcessorForDomainAndFilter(fContext->resourceProvider(), std::move(proxy), + return CreateFragmentProcessorForDomainAndFilter(std::move(proxy), std::move(colorSpaceXform), adjustedMatrix, domainMode, domain, filterOrNullForBicubic); diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp index c8ab782276..276dc10f02 100644 --- a/src/gpu/GrTextureProducer.cpp +++ b/src/gpu/GrTextureProducer.cpp @@ -57,13 +57,11 @@ sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrContext* context, // better! SkASSERT(copyParams.fFilter != GrSamplerParams::kMipMap_FilterMode); paint.addColorFragmentProcessor( - GrTextureDomainEffect::Make(context->resourceProvider(), std::move(inputProxy), - nullptr, SkMatrix::I(), + GrTextureDomainEffect::Make(std::move(inputProxy), nullptr, SkMatrix::I(), domain, GrTextureDomain::kClamp_Mode, copyParams.fFilter)); } else { GrSamplerParams params(SkShader::kClamp_TileMode, copyParams.fFilter); - paint.addColorTextureProcessor(context->resourceProvider(), std::move(inputProxy), - nullptr, SkMatrix::I(), params); + paint.addColorTextureProcessor(std::move(inputProxy), nullptr, SkMatrix::I(), params); } paint.setPorterDuffXPFactory(SkBlendMode::kSrc); @@ -220,7 +218,6 @@ GrTextureProducer::DomainMode GrTextureProducer::DetermineDomainMode( } sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAndFilter( - GrResourceProvider* resourceProvider, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& textureMatrix, @@ -230,26 +227,24 @@ sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAn SkASSERT(kTightCopy_DomainMode != domainMode); if (filterOrNullForBicubic) { if (kDomain_DomainMode == domainMode) { - return GrTextureDomainEffect::Make(resourceProvider, std::move(proxy), + return GrTextureDomainEffect::Make(std::move(proxy), std::move(colorSpaceXform), textureMatrix, domain, GrTextureDomain::kClamp_Mode, *filterOrNullForBicubic); } else { GrSamplerParams params(SkShader::kClamp_TileMode, *filterOrNullForBicubic); - return GrSimpleTextureEffect::Make(resourceProvider, std::move(proxy), + return GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), textureMatrix, params); } } else { if (kDomain_DomainMode == domainMode) { - return GrBicubicEffect::Make(resourceProvider, std::move(proxy), - std::move(colorSpaceXform), + return GrBicubicEffect::Make(std::move(proxy), std::move(colorSpaceXform), textureMatrix, domain); } else { static const SkShader::TileMode kClampClamp[] = { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode }; - return GrBicubicEffect::Make(resourceProvider, std::move(proxy), - std::move(colorSpaceXform), + return GrBicubicEffect::Make(std::move(proxy), std::move(colorSpaceXform), textureMatrix, kClampClamp); } } diff --git a/src/gpu/GrTextureProducer.h b/src/gpu/GrTextureProducer.h index 35e60f0552..6a32e2f76e 100644 --- a/src/gpu/GrTextureProducer.h +++ b/src/gpu/GrTextureProducer.h @@ -12,7 +12,6 @@ #include "GrResourceKey.h" class GrColorSpaceXform; -class GrResourceProvider; class GrTexture; class GrTextureProxy; @@ -132,7 +131,6 @@ protected: SkRect* domainRect); static sk_sp<GrFragmentProcessor> CreateFragmentProcessorForDomainAndFilter( - GrResourceProvider*, sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform>, const SkMatrix& textureMatrix, diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp index 98cc75bf56..cf1010c6c7 100644 --- a/src/gpu/GrTextureProxy.cpp +++ b/src/gpu/GrTextureProxy.cpp @@ -7,7 +7,6 @@ #include "GrTextureProxy.h" -#include "GrResourceProvider.h" #include "GrTexturePriv.h" GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted, diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index 6b51303488..5ab926be35 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -132,8 +132,7 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx, GrPaint paint; sk_sp<GrFragmentProcessor> yuvToRgbProcessor( - GrYUVEffect::MakeYUVToRGB(ctx->resourceProvider(), - yuvTextureContexts[0]->asTextureProxyRef(), + GrYUVEffect::MakeYUVToRGB(yuvTextureContexts[0]->asTextureProxyRef(), yuvTextureContexts[1]->asTextureProxyRef(), yuvTextureContexts[2]->asTextureProxyRef(), yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false)); diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 09467a1809..be842baf67 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1046,10 +1046,10 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, domain.fTop = domain.fBottom = srcRect.centerY(); } if (bicubic) { - fp = GrBicubicEffect::Make(this->context()->resourceProvider(), std::move(proxy), + fp = GrBicubicEffect::Make(std::move(proxy), std::move(colorSpaceXform), texMatrix, domain); } else { - fp = GrTextureDomainEffect::Make(this->context()->resourceProvider(), std::move(proxy), + fp = GrTextureDomainEffect::Make(std::move(proxy), std::move(colorSpaceXform), texMatrix, domain, GrTextureDomain::kClamp_Mode, params.filterMode()); @@ -1057,10 +1057,10 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, } else if (bicubic) { SkASSERT(GrSamplerParams::kNone_FilterMode == params.filterMode()); SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() }; - fp = GrBicubicEffect::Make(this->context()->resourceProvider(), std::move(proxy), + fp = GrBicubicEffect::Make(std::move(proxy), std::move(colorSpaceXform), texMatrix, tileModes); } else { - fp = GrSimpleTextureEffect::Make(this->context()->resourceProvider(), std::move(proxy), + fp = GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), texMatrix, params); } @@ -1132,8 +1132,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, int left, int top, const sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(result->getColorSpace(), fRenderTargetContext->getColorSpace()); - sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(this->context()->resourceProvider(), - std::move(proxy), + sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), SkMatrix::I())); if (GrPixelConfigIsAlphaOnly(config)) { 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); diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index c93ff41ec6..b8497bd840 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -7,7 +7,6 @@ #include "GrGLTexture.h" #include "GrGLGpu.h" -#include "GrResourceProvider.h" #include "GrSemaphore.h" #include "GrShaderCaps.h" #include "SkTraceMemoryDump.h" diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp index dd36705449..500986ea88 100644 --- a/src/gpu/instanced/InstanceProcessor.cpp +++ b/src/gpu/instanced/InstanceProcessor.cpp @@ -10,7 +10,6 @@ #include "GrContext.h" #include "GrRenderTargetPriv.h" #include "GrResourceCache.h" -#include "GrResourceProvider.h" #include "GrShaderCaps.h" #include "glsl/GrGLSLGeometryProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" diff --git a/src/gpu/instanced/InstancedRendering.cpp b/src/gpu/instanced/InstancedRendering.cpp index 6a8fc64222..cb4a1de63d 100644 --- a/src/gpu/instanced/InstancedRendering.cpp +++ b/src/gpu/instanced/InstancedRendering.cpp @@ -24,6 +24,9 @@ InstancedRendering::InstancedRendering(GrGpu* gpu) SkDEBUGCODE(, fState(State::kRecordingDraws)) { } +InstancedRendering::~InstancedRendering() { + SkASSERT(State::kRecordingDraws == fState); +} void InstancedRendering::beginFlush(GrResourceProvider* rp) { #ifdef SK_DEBUG diff --git a/src/gpu/instanced/InstancedRendering.h b/src/gpu/instanced/InstancedRendering.h index d0df132526..e349f6337b 100644 --- a/src/gpu/instanced/InstancedRendering.h +++ b/src/gpu/instanced/InstancedRendering.h @@ -46,7 +46,7 @@ class InstanceProcessor; */ class InstancedRendering : public SkNoncopyable { public: - virtual ~InstancedRendering() { SkASSERT(State::kRecordingDraws == fState); } + virtual ~InstancedRendering(); GrGpu* gpu() const { return fGpu.get(); } diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp index f62f0c628e..90726c668c 100644 --- a/src/gpu/ops/GrAnalyticRectOp.cpp +++ b/src/gpu/ops/GrAnalyticRectOp.cpp @@ -11,7 +11,6 @@ #include "GrGeometryProcessor.h" #include "GrOpFlushState.h" #include "GrProcessor.h" -#include "GrResourceProvider.h" #include "SkRRect.h" #include "SkStrokeRec.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp index c854a8b54d..20a5b4f5d8 100644 --- a/src/gpu/ops/GrAtlasTextOp.cpp +++ b/src/gpu/ops/GrAtlasTextOp.cpp @@ -88,13 +88,11 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) const { FlushInfo flushInfo; if (this->usesDistanceFields()) { flushInfo.fGeometryProcessor = - this->setupDfProcessor(fFontCache->context()->resourceProvider(), - this->viewMatrix(), + this->setupDfProcessor(this->viewMatrix(), fLuminanceColor, this->color(), std::move(proxy)); } else { GrSamplerParams params(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode); flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make( - fFontCache->context()->resourceProvider(), this->color(), std::move(proxy), params, maskFormat, localMatrix, this->usesLocalCoords()); } @@ -213,8 +211,7 @@ bool GrAtlasTextOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) { // TODO just use class params // TODO trying to figure out why lcd is so whack -sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrResourceProvider* resourceProvider, - const SkMatrix& viewMatrix, +sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(const SkMatrix& viewMatrix, SkColor luminanceColor, GrColor color, sk_sp<GrTextureProxy> proxy) const { @@ -243,8 +240,7 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrResourceProvider* r GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make( redCorrection, greenCorrection, blueCorrection); - return GrDistanceFieldLCDTextGeoProc::Make(resourceProvider, - color, viewMatrix, std::move(proxy), + return GrDistanceFieldLCDTextGeoProc::Make(color, viewMatrix, std::move(proxy), params, widthAdjust, flags, this->usesLocalCoords()); } else { @@ -252,12 +248,12 @@ sk_sp<GrGeometryProcessor> GrAtlasTextOp::setupDfProcessor(GrResourceProvider* r U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, luminanceColor); float correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift, fUseGammaCorrectDistanceTable); - return GrDistanceFieldA8TextGeoProc::Make(resourceProvider, color, + return GrDistanceFieldA8TextGeoProc::Make(color, viewMatrix, std::move(proxy), params, correction, flags, this->usesLocalCoords()); #else - return GrDistanceFieldA8TextGeoProc::Make(resourceProvider, color, + return GrDistanceFieldA8TextGeoProc::Make(color, viewMatrix, std::move(proxy), params, flags, this->usesLocalCoords()); #endif diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h index e0a4ed0135..fcb3db1fca 100644 --- a/src/gpu/ops/GrAtlasTextOp.h +++ b/src/gpu/ops/GrAtlasTextOp.h @@ -148,8 +148,7 @@ private: bool onCombineIfPossible(GrOp* t, const GrCaps& caps) override; // TODO just use class params - sk_sp<GrGeometryProcessor> setupDfProcessor(GrResourceProvider*, - const SkMatrix& viewMatrix, SkColor luminanceColor, + sk_sp<GrGeometryProcessor> setupDfProcessor(const SkMatrix& viewMatrix, SkColor luminanceColor, GrColor color, sk_sp<GrTextureProxy> proxy) const; GrColor fColor; diff --git a/src/gpu/ops/GrClearOp.cpp b/src/gpu/ops/GrClearOp.cpp new file mode 100644 index 0000000000..e40862b79f --- /dev/null +++ b/src/gpu/ops/GrClearOp.cpp @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */
+
+#include "GrClearOp.h"
+
+#include "GrGpuCommandBuffer.h"
+#include "GrOpFlushState.h"
+#include "GrResourceProvider.h" +
+GrClearOp::GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* proxy) + : INHERITED(ClassID()) + , fClip(clip) + , fColor(color) { + const SkIRect rtRect = SkIRect::MakeWH(proxy->width(), proxy->height()); + if (fClip.scissorEnabled()) { + // Don't let scissors extend outside the RT. This may improve op combining. + if (!fClip.intersect(rtRect)) { + SkASSERT(0); // should be caught upstream + fClip = GrFixedClip(SkIRect::MakeEmpty()); + } + + if (GrResourceProvider::IsFunctionallyExact(proxy) && fClip.scissorRect() == rtRect) { + fClip.disableScissor(); + } + } + this->setBounds(SkRect::Make(fClip.scissorEnabled() ? fClip.scissorRect() : rtRect), + HasAABloat::kNo, IsZeroArea::kNo); +} + +void GrClearOp::onExecute(GrOpFlushState* state) { + SkASSERT(state->drawOpArgs().fRenderTarget); + + state->commandBuffer()->clear(state->drawOpArgs().fRenderTarget, fClip, fColor); +} diff --git a/src/gpu/ops/GrClearOp.h b/src/gpu/ops/GrClearOp.h index 6d0cf28775..56ecb13a79 100644 --- a/src/gpu/ops/GrClearOp.h +++ b/src/gpu/ops/GrClearOp.h @@ -9,10 +9,9 @@ #define GrClearOp_DEFINED #include "GrFixedClip.h" -#include "GrGpuCommandBuffer.h" #include "GrOp.h" -#include "GrOpFlushState.h" -#include "GrResourceProvider.h" + +class GrOpFlushState; class GrClearOp final : public GrOp { public: @@ -55,26 +54,7 @@ public: void setColor(GrColor color) { fColor = color; } private: - GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* proxy) - : INHERITED(ClassID()) - , fClip(clip) - , fColor(color) { - - const SkIRect rtRect = SkIRect::MakeWH(proxy->width(), proxy->height()); - if (fClip.scissorEnabled()) { - // Don't let scissors extend outside the RT. This may improve op combining. - if (!fClip.intersect(rtRect)) { - SkASSERT(0); // should be caught upstream - fClip = GrFixedClip(SkIRect::MakeEmpty()); - } - - if (GrResourceProvider::IsFunctionallyExact(proxy) && fClip.scissorRect() == rtRect) { - fClip.disableScissor(); - } - } - this->setBounds(SkRect::Make(fClip.scissorEnabled() ? fClip.scissorRect() : rtRect), - HasAABloat::kNo, IsZeroArea::kNo); - } + GrClearOp(const GrFixedClip& clip, GrColor color, GrSurfaceProxy* proxy); GrClearOp(const SkIRect& rect, GrColor color, bool fullScreen) : INHERITED(ClassID()) @@ -115,11 +95,7 @@ private: void onPrepare(GrOpFlushState*) override {} - void onExecute(GrOpFlushState* state) override { - SkASSERT(state->drawOpArgs().fRenderTarget); - - state->commandBuffer()->clear(state->drawOpArgs().fRenderTarget, fClip, fColor); - } + void onExecute(GrOpFlushState* state) override; GrFixedClip fClip; GrColor fColor; diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp index 13cfc4dd8b..a8e459a484 100644 --- a/src/gpu/ops/GrShadowRRectOp.cpp +++ b/src/gpu/ops/GrShadowRRectOp.cpp @@ -9,7 +9,6 @@ #include "GrDrawOpTest.h" #include "GrOpFlushState.h" -#include "GrResourceProvider.h" #include "GrStyle.h" #include "effects/GrShadowGeoProc.h" diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp index f3c43f2071..57d8ef6451 100644 --- a/src/gpu/ops/GrSmallPathRenderer.cpp +++ b/src/gpu/ops/GrSmallPathRenderer.cpp @@ -233,7 +233,6 @@ private: flags |= fGammaCorrect ? kGammaCorrect_DistanceFieldEffectFlag : 0; flushInfo.fGeometryProcessor = GrDistanceFieldPathGeoProc::Make( - atlas->context()->resourceProvider(), this->color(), this->viewMatrix(), atlas->getProxy(), params, flags, this->usesLocalCoords()); } else { @@ -251,7 +250,6 @@ private: } flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make( - atlas->context()->resourceProvider(), this->color(), atlas->getProxy(), params, kA8_GrMaskFormat, invert, this->usesLocalCoords()); } diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index 39c3e10ca5..1487d28460 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -9,7 +9,6 @@ #include "GrContext.h" #include "GrGpu.h" #include "GrRectanizer.h" -#include "GrResourceProvider.h" #include "GrSurfacePriv.h" #include "SkAutoMalloc.h" #include "SkString.h" diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp index eb4a516343..e4f6faf624 100644 --- a/src/gpu/vk/GrVkPipelineState.cpp +++ b/src/gpu/vk/GrVkPipelineState.cpp @@ -267,7 +267,7 @@ void GrVkPipelineState::setData(GrVkGpu* gpu, GrResourceIOProcessor::TextureSampler dstTextureSampler; if (GrTextureProxy* dstTextureProxy = pipeline.dstTextureProxy()) { - dstTextureSampler.reset(gpu->getContext()->resourceProvider(), sk_ref_sp(dstTextureProxy)); + dstTextureSampler.reset(sk_ref_sp(dstTextureProxy)); SkAssertResult(dstTextureSampler.instantiate(gpu->getContext()->resourceProvider())); textureBindings.push_back(&dstTextureSampler); } diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index f9441e0f5b..41990e842b 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -401,10 +401,8 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); - paint.addColorFragmentProcessor( - GrYUVEffect::MakeYUVToRGB(ctx->resourceProvider(), - yProxy, uProxy, vProxy, - yuvSizes, colorSpace, nv12)); + paint.addColorFragmentProcessor(GrYUVEffect::MakeYUVToRGB(yProxy, uProxy, vProxy, + yuvSizes, colorSpace, nv12)); const SkRect rect = SkRect::MakeIWH(width, height); @@ -975,7 +973,7 @@ sk_sp<SkImage> SkImage_Gpu::onMakeColorSpace(sk_sp<SkColorSpace> target, SkColor GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); - paint.addColorTextureProcessor(fContext->resourceProvider(), fProxy, nullptr, SkMatrix::I()); + paint.addColorTextureProcessor(fProxy, nullptr, SkMatrix::I()); paint.addColorFragmentProcessor(std::move(xform)); const SkRect rect = SkRect::MakeIWH(this->width(), this->height()); diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 4cac4744a0..d55888767a 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -10,7 +10,6 @@ #include "GrBackendSurface.h" #include "GrContextPriv.h" #include "GrRenderTargetContextPriv.h" -#include "GrResourceProvider.h" #include "GrTexture.h" #include "SkCanvas.h" diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp index bdbd382638..808b856d8a 100644 --- a/src/shaders/SkImageShader.cpp +++ b/src/shaders/SkImageShader.cpp @@ -171,10 +171,10 @@ sk_sp<GrFragmentProcessor> SkImageShader::asFragmentProcessor(const AsFPArgs& ar args.fDstColorSpace); sk_sp<GrFragmentProcessor> inner; if (doBicubic) { - inner = GrBicubicEffect::Make(args.fContext->resourceProvider(), std::move(proxy), + inner = GrBicubicEffect::Make(std::move(proxy), std::move(colorSpaceXform), lmInverse, tm); } else { - inner = GrSimpleTextureEffect::Make(args.fContext->resourceProvider(), std::move(proxy), + inner = GrSimpleTextureEffect::Make(std::move(proxy), std::move(colorSpaceXform), lmInverse, params); } diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp index ddcd2957d6..54d8483a1b 100644 --- a/src/shaders/SkPerlinNoiseShader.cpp +++ b/src/shaders/SkPerlinNoiseShader.cpp @@ -677,15 +677,14 @@ private: class GrPerlinNoise2Effect : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - SkPerlinNoiseShaderImpl::Type type, + static sk_sp<GrFragmentProcessor> Make(SkPerlinNoiseShaderImpl::Type type, int numOctaves, bool stitchTiles, std::unique_ptr<SkPerlinNoiseShaderImpl::PaintingData> paintingData, sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> noiseProxy, const SkMatrix& matrix) { return sk_sp<GrFragmentProcessor>( - new GrPerlinNoise2Effect(resourceProvider, type, numOctaves, stitchTiles, + new GrPerlinNoise2Effect(type, numOctaves, stitchTiles, std::move(paintingData), std::move(permutationsProxy), std::move(noiseProxy), matrix)); } @@ -719,8 +718,7 @@ private: fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit; } - GrPerlinNoise2Effect(GrResourceProvider* resourceProvider, - SkPerlinNoiseShaderImpl::Type type, int numOctaves, bool stitchTiles, + GrPerlinNoise2Effect(SkPerlinNoiseShaderImpl::Type type, int numOctaves, bool stitchTiles, std::unique_ptr<SkPerlinNoiseShaderImpl::PaintingData> paintingData, sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> noiseProxy, @@ -729,8 +727,8 @@ private: , fType(type) , fNumOctaves(numOctaves) , fStitchTiles(stitchTiles) - , fPermutationsSampler(resourceProvider, std::move(permutationsProxy)) - , fNoiseSampler(resourceProvider, std::move(noiseProxy)) + , fPermutationsSampler(std::move(permutationsProxy)) + , fNoiseSampler(std::move(noiseProxy)) , fPaintingData(std::move(paintingData)) { this->initClassID<GrPerlinNoise2Effect>(); this->addTextureSampler(&fPermutationsSampler); @@ -741,7 +739,7 @@ private: GR_DECLARE_FRAGMENT_PROCESSOR_TEST; - SkPerlinNoiseShaderImpl::Type fType; + SkPerlinNoiseShaderImpl::Type fType; GrCoordTransform fCoordTransform; int fNumOctaves; bool fStitchTiles; @@ -1096,14 +1094,13 @@ private: class GrImprovedPerlinNoiseEffect : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - int octaves, SkScalar z, + static sk_sp<GrFragmentProcessor> Make(int octaves, SkScalar z, std::unique_ptr<SkPerlinNoiseShaderImpl::PaintingData> paintingData, sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> gradientProxy, const SkMatrix& matrix) { return sk_sp<GrFragmentProcessor>( - new GrImprovedPerlinNoiseEffect(resourceProvider, octaves, z, std::move(paintingData), + new GrImprovedPerlinNoiseEffect(octaves, z, std::move(paintingData), std::move(permutationsProxy), std::move(gradientProxy), matrix)); } @@ -1130,8 +1127,7 @@ private: fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency; } - GrImprovedPerlinNoiseEffect(GrResourceProvider* resourceProvider, - int octaves, SkScalar z, + GrImprovedPerlinNoiseEffect(int octaves, SkScalar z, std::unique_ptr<SkPerlinNoiseShaderImpl::PaintingData> paintingData, sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> gradientProxy, @@ -1139,8 +1135,8 @@ private: : INHERITED(kNone_OptimizationFlags) , fOctaves(octaves) , fZ(z) - , fPermutationsSampler(resourceProvider, std::move(permutationsProxy)) - , fGradientSampler(resourceProvider, std::move(gradientProxy)) + , fPermutationsSampler(std::move(permutationsProxy)) + , fGradientSampler(std::move(gradientProxy)) , fPaintingData(std::move(paintingData)) { this->initClassID<GrImprovedPerlinNoiseEffect>(); this->addTextureSampler(&fPermutationsSampler); @@ -1380,8 +1376,7 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShaderImpl::asFragmentProcessor(const As GrRefCachedBitmapTextureProxy(args.fContext, paintingData->getGradientBitmap(), textureParams, nullptr)); - return GrImprovedPerlinNoiseEffect::Make(args.fContext->resourceProvider(), - fNumOctaves, fSeed, std::move(paintingData), + return GrImprovedPerlinNoiseEffect::Make(fNumOctaves, fSeed, std::move(paintingData), std::move(permutationsTexture), std::move(gradientTexture), m); } @@ -1410,8 +1405,7 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShaderImpl::asFragmentProcessor(const As if (permutationsProxy && noiseProxy) { sk_sp<GrFragmentProcessor> inner( - GrPerlinNoise2Effect::Make(args.fContext->resourceProvider(), - fType, + GrPerlinNoise2Effect::Make(fType, fNumOctaves, fStitchTiles, std::move(paintingData), diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp index 07860e4a61..9d4a250b46 100644 --- a/src/shaders/gradients/SkGradientShader.cpp +++ b/src/shaders/gradients/SkGradientShader.cpp @@ -1846,10 +1846,8 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque) if (-1 != fRow) { fYCoord = fAtlas->getYOffset(fRow)+SK_ScalarHalf*fAtlas->getNormalizedTexelHeight(); // This is 1/2 places where auto-normalization is disabled - fCoordTransform.reset(args.fContext->resourceProvider(), *args.fMatrix, - fAtlas->asTextureProxyRef().get(), false); - fTextureSampler.reset(args.fContext->resourceProvider(), - fAtlas->asTextureProxyRef(), params); + fCoordTransform.reset(*args.fMatrix, fAtlas->asTextureProxyRef().get(), false); + fTextureSampler.reset(fAtlas->asTextureProxyRef(), params); } else { // In this instance we know the params are: // clampY, bilerp @@ -1866,10 +1864,8 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque) return; } // This is 2/2 places where auto-normalization is disabled - fCoordTransform.reset(args.fContext->resourceProvider(), *args.fMatrix, - proxy.get(), false); - fTextureSampler.reset(args.fContext->resourceProvider(), - std::move(proxy), params); + fCoordTransform.reset(*args.fMatrix, proxy.get(), false); + fTextureSampler.reset(std::move(proxy), params); fYCoord = SK_ScalarHalf; } diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 51259781f2..cc61891dd4 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -18,7 +18,6 @@ #include "GrDrawingManager.h" #include "GrPipeline.h" #include "GrRenderTargetContextPriv.h" -#include "GrResourceProvider.h" #include "GrTest.h" #include "GrXferProcessor.h" #include "SkChecksum.h" diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 8a6e58e5dd..37972d9379 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -13,7 +13,6 @@ #include "GrContextOptions.h" #include "GrContextPriv.h" #include "GrGpu.h" -#include "GrResourceProvider.h" #include "GrTest.h" #include "GrXferProcessor.h" #include "effects/GrPorterDuffXferProcessor.h" diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp index d818b39dc4..f55553c518 100644 --- a/tests/ImageStorageTest.cpp +++ b/tests/ImageStorageTest.cpp @@ -12,7 +12,6 @@ #include "GrClip.h" #include "GrFragmentProcessor.h" #include "GrRenderTargetContext.h" -#include "GrResourceProvider.h" #include "GrTexture.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" @@ -20,23 +19,20 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) { class TestFP : public GrFragmentProcessor { public: - static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, GrSLMemoryModel mm, GrSLRestrict restrict) { - return sk_sp<GrFragmentProcessor>(new TestFP(resourceProvider, - std::move(proxy), mm, restrict)); + return sk_sp<GrFragmentProcessor>(new TestFP(std::move(proxy), mm, restrict)); } const char* name() const override { return "Image Load Test FP"; } private: - TestFP(GrResourceProvider* resourceProvider, - sk_sp<GrTextureProxy> proxy, GrSLMemoryModel mm, GrSLRestrict restrict) + TestFP(sk_sp<GrTextureProxy> proxy, GrSLMemoryModel mm, GrSLRestrict restrict) : INHERITED(kNone_OptimizationFlags) , fImageStorageAccess(std::move(proxy), kRead_GrIOType, mm, restrict) { this->initClassID<TestFP>(); - this->addImageStorageAccess(resourceProvider, &fImageStorageAccess); + this->addImageStorageAccess(&fImageStorageAccess); } void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} @@ -140,8 +136,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) { kRGBA_8888_GrPixelConfig, nullptr); GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); - paint.addColorFragmentProcessor(TestFP::Make(context->resourceProvider(), - imageStorageTexture, mm, restrict)); + paint.addColorFragmentProcessor(TestFP::Make(imageStorageTexture, mm, restrict)); rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I()); std::unique_ptr<uint32_t[]> readData(new uint32_t[kS * kS]); SkImageInfo info = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType, diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp index bfd54ad4f0..415e7ca0c1 100644 --- a/tests/IntTextureTest.cpp +++ b/tests/IntTextureTest.cpp @@ -258,8 +258,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) { }; for (auto filter : kNamedFilters) { - sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(context->resourceProvider(), - sContext->asTextureProxyRef(), + sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(sContext->asTextureProxyRef(), nullptr, SkMatrix::I(), filter.fMode)); diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp index f8198687cb..f4dd25f3fe 100644 --- a/tests/OnFlushCallbackTest.cpp +++ b/tests/OnFlushCallbackTest.cpp @@ -416,7 +416,6 @@ private: // This creates an off-screen rendertarget whose ops which eventually pull from the atlas. static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject* object, int start, sk_sp<GrTextureProxy> fakeAtlas) { - sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContext( SkBackingFit::kApprox, 3*kDrawnTileSize, @@ -433,8 +432,7 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject // TODO: here is the blocker for deferring creation of the atlas. The TextureSamplers // created here currently require a hard GrTexture. - sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(context->resourceProvider(), - fakeAtlas, + sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(fakeAtlas, nullptr, SkMatrix::I()); GrPaint paint; @@ -569,8 +567,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) { SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0); GrPaint paint; - sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(context->resourceProvider(), - std::move(proxies[i]), + sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(std::move(proxies[i]), nullptr, t)); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); paint.addColorFragmentProcessor(std::move(fp)); diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 66b96f7b93..53ad44816b 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -17,7 +17,6 @@ #include "GrOpFlushState.h" #include "GrRenderTargetContext.h" #include "GrRenderTargetContextPriv.h" -#include "GrResourceProvider.h" #include "SkString.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" #include "glsl/GrGLSLGeometryProcessor.h" diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 7f9dff738b..63543647c2 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -54,11 +54,10 @@ public: static sk_sp<GrFragmentProcessor> Make(sk_sp<GrFragmentProcessor> child) { return sk_sp<GrFragmentProcessor>(new TestFP(std::move(child))); } - static sk_sp<GrFragmentProcessor> Make(GrContext* context, - const SkTArray<sk_sp<GrTextureProxy>>& proxies, + static sk_sp<GrFragmentProcessor> Make(const SkTArray<sk_sp<GrTextureProxy>>& proxies, const SkTArray<sk_sp<GrBuffer>>& buffers, const SkTArray<Image>& images) { - return sk_sp<GrFragmentProcessor>(new TestFP(context, proxies, buffers, images)); + return sk_sp<GrFragmentProcessor>(new TestFP(proxies, buffers, images)); } const char* name() const override { return "test"; } @@ -70,13 +69,12 @@ public: } private: - TestFP(GrContext* context, - const SkTArray<sk_sp<GrTextureProxy>>& proxies, + TestFP(const SkTArray<sk_sp<GrTextureProxy>>& proxies, const SkTArray<sk_sp<GrBuffer>>& buffers, const SkTArray<Image>& images) : INHERITED(kNone_OptimizationFlags), fSamplers(4), fBuffers(4), fImages(4) { for (const auto& proxy : proxies) { - this->addTextureSampler(&fSamplers.emplace_back(context->resourceProvider(), proxy)); + this->addTextureSampler(&fSamplers.emplace_back(proxy)); } for (const auto& buffer : buffers) { this->addBufferAccess(&fBuffers.emplace_back(kRGBA_8888_GrPixelConfig, buffer.get())); @@ -84,7 +82,7 @@ private: for (const Image& image : images) { fImages.emplace_back(image.fProxy, image.fIOType, GrSLMemoryModel::kNone, GrSLRestrict::kNo); - this->addImageStorageAccess(context->resourceProvider(), &fImages.back()); + this->addImageStorageAccess(&fImages.back()); } } @@ -175,8 +173,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { } std::unique_ptr<GrLegacyMeshDrawOp> op(TestOp::Make()); GrPaint paint; - auto fp = TestFP::Make(context, - std::move(proxies), std::move(buffers), std::move(images)); + auto fp = TestFP::Make(std::move(proxies), std::move(buffers), std::move(images)); for (int i = 0; i < parentCnt; ++i) { fp = TestFP::Make(std::move(fp)); } @@ -262,11 +259,8 @@ static GrColor4f texel_color4f(int i, int j) { return GrColor4f::FromGrColor(tex void test_draw_op(GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp, sk_sp<GrTextureProxy> inputDataProxy) { - GrResourceProvider* resourceProvider = rtc->resourceProvider(); - GrPaint paint; - paint.addColorTextureProcessor(resourceProvider, std::move(inputDataProxy), - nullptr, SkMatrix::I()); + paint.addColorTextureProcessor(std::move(inputDataProxy), nullptr, SkMatrix::I()); paint.addColorFragmentProcessor(std::move(fp)); paint.setPorterDuffXPFactory(SkBlendMode::kSrc); diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp index 18a2525922..7b8dc8c6fd 100644 --- a/tests/ReadPixelsTest.cpp +++ b/tests/ReadPixelsTest.cpp @@ -18,7 +18,6 @@ #include "GrContext.h" #include "GrContextFactory.h" #include "GrContextPriv.h" -#include "GrResourceProvider.h" #include "SkGr.h" #endif diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 9c85ad4522..705f585b7b 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -30,7 +30,6 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont GrSamplerParams::kMipMap_FilterMode}) { rtContext->clear(nullptr, 0xDDCCBBAA, true); sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make( - context->resourceProvider(), rectProxy, nullptr, SkMatrix::I(), filter)); diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp index 33d99f2208..8d035e1589 100644 --- a/tests/SRGBMipMapTest.cpp +++ b/tests/SRGBMipMapTest.cpp @@ -11,7 +11,6 @@ #include "GrClip.h" #include "GrContext.h" #include "GrRenderTargetContext.h" -#include "GrResourceProvider.h" #include "SkCanvas.h" #include "SkGr.h" #include "SkSurface.h" @@ -146,7 +145,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) { GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode); - paint.addColorTextureProcessor(context->resourceProvider(), std::move(proxy), + paint.addColorTextureProcessor(std::move(proxy), nullptr, SkMatrix::MakeScale(rtS), mipMapParams); // 1) Draw texture to S32 surface (should generate/use sRGB mips) diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp index 9038b29770..a52e96104f 100644 --- a/tests/SRGBReadWritePixelsTest.cpp +++ b/tests/SRGBReadWritePixelsTest.cpp @@ -10,7 +10,6 @@ #include "GrCaps.h" #include "GrContext.h" #include "GrContextPriv.h" -#include "GrResourceProvider.h" #include "GrSurfaceContext.h" #include "SkCanvas.h" #include "SkGr.h" diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index c41e9cf3c5..f9db895002 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -14,6 +14,7 @@ #include "GrContext.h" #include "SkGradientShader.h" #include "SkShaderBase.h" +#include "effects/GrPorterDuffXferProcessor.h" #include "ops/GrTessellatingPathRenderer.h" /* diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 1eb9860066..cb2f975422 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -12,6 +12,7 @@ #include "GrContextPriv.h" #include "GrDrawOpAtlas.h" #include "GrDrawingManager.h" +#include "GrGpu.h" #include "GrGpuResourceCacheAccess.h" #include "GrPipelineBuilder.h" #include "GrRenderTargetContext.h" |