Clean up GrResourceProvider usage
The only substantive changes are the removal of GrProxy instantiation in:
SkGpuBlurUtils::GaussianBlur
GrSimpleTextureEffect::Make*
Change-Id: I10970609693bd6ff5b3a3c21b41d82642bb277bc
Reviewed-on: https://skia-review.googlesource.com/19965
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrAHardwareBufferImageGenerator.cpp b/src/gpu/GrAHardwareBufferImageGenerator.cpp
index 06fa584..5412574 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 76443ff..3a8c8ec 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 @@
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 af5a7ba..2ab3c46 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 @@
////////////////////////////////////////////////////////////////////////////////
// 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 @@
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 a96fbce..b0d40f6 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -382,7 +382,7 @@
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 @@
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 de8b8cc..0000000
--- 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 a791213..3ba4fd8 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 @@
* 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 @@
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 99a097a..4d90e9a 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 51c698d..0cbba5a 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 54bb3a7..262f155 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 b29dc9c..6b2570a 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 9bbeec5..d9182d2 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -19,40 +19,33 @@
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 e2b494f..0d8beb4 100644
--- a/src/gpu/GrPaint.h
+++ b/src/gpu/GrPaint.h
@@ -109,14 +109,14 @@
* 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 fb9c384..c55ed57 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 51cfdfb..bff3348 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -136,8 +136,7 @@
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 @@
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 @@
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 f186af5..b7abf2f 100644
--- a/src/gpu/GrProcessor.h
+++ b/src/gpu/GrProcessor.h
@@ -190,7 +190,7 @@
*/
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 @@
*/
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 bc36247..c5a115f 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1815,7 +1815,7 @@
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 c471eac..bc22604 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -54,10 +54,6 @@
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 1972032..10922ac 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 fb66886..8809913 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -160,8 +160,6 @@
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 @@
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 183ec70..86027dd 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -163,7 +163,7 @@
(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 b4e76cb..dca8984 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 69e3a6e..44212fe 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -113,7 +113,7 @@
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 c8ab782..276dc10 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -57,13 +57,11 @@
// 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 @@
}
sk_sp<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorForDomainAndFilter(
- GrResourceProvider* resourceProvider,
sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& textureMatrix,
@@ -230,26 +227,24 @@
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 35e60f0..6a32e2f 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 @@
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 98cc75b..cf1010c 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 6b51303..5ab926b 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -132,8 +132,7 @@
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 09467a1..be842ba 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1046,10 +1046,10 @@
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 @@
} 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 @@
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 c8d6a55..bc05e45 100644
--- a/src/gpu/effects/Gr1DKernelEffect.h
+++ b/src/gpu/effects/Gr1DKernelEffect.h
@@ -28,9 +28,9 @@
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 d54f4df..6d8072f 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -132,28 +132,27 @@
}
}
-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<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 7cc8c1e..de9468b 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -29,12 +29,11 @@
/**
* 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 @@
/**
* 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 @@
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 eb9b7b8..9de3b46 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -114,14 +114,14 @@
///////////////////////////////////////////////////////////////////////////////
-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 @@
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 aa9afc2..c3ddadc 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.h
+++ b/src/gpu/effects/GrBitmapTextGeoProc.h
@@ -21,12 +21,12 @@
*/
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 @@
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 41c7e6f..e4989de 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -137,8 +137,8 @@
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 @@
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 @@
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 51c4b55..f0f4ec4 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -222,8 +222,7 @@
///////////////////////////////////////////////////////////////////////////////
-GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrResourceProvider* resourceProvider,
- GrColor color,
+GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color,
const SkMatrix& viewMatrix,
sk_sp<GrTextureProxy> proxy,
const GrSamplerParams& params,
@@ -234,7 +233,7 @@
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 @@
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 @@
};
///////////////////////////////////////////////////////////////////////////////
-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 @@
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 @@
///////////////////////////////////////////////////////////////////////////////
GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc(
- GrResourceProvider* resourceProvider,
GrColor color, const SkMatrix& viewMatrix,
sk_sp<GrTextureProxy> proxy,
const GrSamplerParams& params,
@@ -784,7 +778,7 @@
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 @@
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 1384d2f..c0cc2e9 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.h
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.h
@@ -49,23 +49,21 @@
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 @@
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 @@
*/
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 @@
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 @@
}
};
- 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 @@
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 ae4de1b..b089409 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -168,15 +168,13 @@
}
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 @@
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 dfe4234..d639872 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 @@
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 d1726a0..bc1537c 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -148,8 +148,7 @@
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 @@
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 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 @@
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 @@
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 6104f11..ffd05fa 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 @@
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 @@
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 307188b..938fb04 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 @@
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 @@
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 0b01ac7..0bf2dcc 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -21,56 +21,31 @@
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 @@
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 f5d7000..9dbf32d 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 5c7c0bd..eab29c6 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 @@
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 @@
}
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 3269f41..dce16a8 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -243,8 +243,7 @@
}
}
-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 @@
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 @@
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> 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 @@
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 d8cd695..afd4d5f 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -153,8 +153,7 @@
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 @@
private:
GrTextureDomain fTextureDomain;
- GrTextureDomainEffect(GrResourceProvider*,
- sk_sp<GrTextureProxy>,
+ GrTextureDomainEffect(sk_sp<GrTextureProxy>,
sk_sp<GrColorSpaceXform>,
const SkMatrix&,
const SkRect& domain,
@@ -198,7 +196,7 @@
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 @@
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 be4d6c2..feb2670 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -62,8 +62,7 @@
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 @@
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 @@
};
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 @@
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 @@
//////////////////////////////////////////////////////////////////////////////
-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 7b05f90..ae62a16 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 @@
* 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 c93ff41..b8497bd 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 dd36705..500986e 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 6a8fc64..cb4a1de 100644
--- a/src/gpu/instanced/InstancedRendering.cpp
+++ b/src/gpu/instanced/InstancedRendering.cpp
@@ -24,6 +24,9 @@
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 d0df132..e349f63 100644
--- a/src/gpu/instanced/InstancedRendering.h
+++ b/src/gpu/instanced/InstancedRendering.h
@@ -46,7 +46,7 @@
*/
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 f62f0c6..90726c6 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 c854a8b..20a5b4f 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -88,13 +88,11 @@
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 @@
// 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 @@
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 @@
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 e0a4ed0..fcb3db1 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -148,8 +148,7 @@
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 0000000..e40862b
--- /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 6d0cf28..56ecb13 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 @@
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 @@
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 13cfc4d..a8e459a 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 f3c43f2..57d8ef6 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -233,7 +233,6 @@
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 @@
}
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 39c3e10..1487d28 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 eb4a516..e4f6faf 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -267,7 +267,7 @@
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);
}