aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp4
-rw-r--r--gm/etc1.cpp3
-rw-r--r--gm/texdata.cpp3
-rw-r--r--gm/texturedomaineffect.cpp3
-rw-r--r--gm/yuvtorgbeffect.cpp6
-rw-r--r--include/private/GrSurfaceProxy.h4
-rw-r--r--src/core/SkSpecialImage.cpp4
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.cpp16
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.h2
-rw-r--r--src/effects/SkBlurMaskFilter.cpp33
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp4
-rw-r--r--src/effects/SkTableColorFilter.cpp14
-rw-r--r--src/effects/gradients/SkGradientShader.cpp4
-rw-r--r--src/gpu/GrContext.cpp6
-rw-r--r--src/gpu/GrRenderTargetContext.h2
-rw-r--r--src/gpu/GrResourceProvider.cpp3
-rw-r--r--src/gpu/GrResourceProvider.h13
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp6
-rw-r--r--src/gpu/GrSurfaceProxy.cpp24
-rw-r--r--src/gpu/SkGpuDevice.cpp22
-rw-r--r--src/gpu/SkGr.cpp21
-rw-r--r--src/gpu/SkGr.h8
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp3
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp2
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp26
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.h2
-rw-r--r--src/gpu/text/GrTextUtils.cpp1
-rw-r--r--tests/CopySurfaceTest.cpp2
-rw-r--r--tests/EGLImageTest.cpp6
-rw-r--r--tests/ImageFilterCacheTest.cpp7
-rw-r--r--tests/IntTextureTest.cpp3
-rw-r--r--tests/ProcessorTest.cpp5
-rw-r--r--tests/ProxyConversionTest.cpp9
-rw-r--r--tests/ProxyRefTest.cpp16
-rw-r--r--tests/ProxyTest.cpp10
-rw-r--r--tests/ReadWriteAlphaTest.cpp3
-rw-r--r--tests/RectangleTextureTest.cpp16
-rw-r--r--tests/SRGBMipMapTest.cpp2
-rw-r--r--tests/SpecialImageTest.cpp9
-rw-r--r--tests/TestUtils.cpp15
-rw-r--r--tests/TestUtils.h8
41 files changed, 175 insertions, 175 deletions
diff --git a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
index be8b1b1878..22dc0829e4 100644
--- a/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
+++ b/experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp
@@ -1339,9 +1339,9 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader2::asFragmentProcessor(const AsFPA
}
sk_sp<GrTextureProxy> permutationsProxy = GrMakeCachedBitmapProxy(
- args.fContext,
+ args.fContext->resourceProvider(),
paintingData->getPermutationsBitmap());
- sk_sp<GrTextureProxy> noiseProxy = GrMakeCachedBitmapProxy(args.fContext,
+ sk_sp<GrTextureProxy> noiseProxy = GrMakeCachedBitmapProxy(args.fContext->resourceProvider(),
paintingData->getNoiseBitmap());
if (permutationsProxy && noiseProxy) {
diff --git a/gm/etc1.cpp b/gm/etc1.cpp
index d35f144b72..a005c8fce3 100644
--- a/gm/etc1.cpp
+++ b/gm/etc1.cpp
@@ -79,8 +79,7 @@ protected:
desc.fWidth = kTexWidth;
desc.fHeight = kTexHeight;
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
fETC1Data.get(), 0);
if (!proxy) {
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 0ba20e0403..24153f8cf6 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -91,8 +91,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
desc.fHeight = 2 * S;
desc.fConfig = SkImageInfo2GrPixelConfig(ii, *context->caps());
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
gTextureData.get(), 0);
if (!proxy) {
diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp
index 3d68eadbec..7cb3bce61a 100644
--- a/gm/texturedomaineffect.cpp
+++ b/gm/texturedomaineffect.cpp
@@ -90,8 +90,7 @@ protected:
desc.fHeight = fBmp.height();
desc.fConfig = SkImageInfo2GrPixelConfig(fBmp.info(), *context->caps());
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
fBmp.getPixels(),
fBmp.rowBytes()));
diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp
index 5bfcc69800..376621d92a 100644
--- a/gm/yuvtorgbeffect.cpp
+++ b/gm/yuvtorgbeffect.cpp
@@ -92,8 +92,7 @@ protected:
desc.fHeight = fBmp[i].height();
desc.fConfig = SkImageInfo2GrPixelConfig(fBmp[i].info(), *context->caps());
- proxy[i] = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ proxy[i] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
fBmp[i].getPixels(), fBmp[i].rowBytes());
if (!proxy[i]) {
@@ -225,8 +224,7 @@ protected:
desc.fHeight = fBmp[index].height();
desc.fConfig = SkImageInfo2GrPixelConfig(fBmp[index].info(), *context->caps());
- proxy[i] = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ proxy[i] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
fBmp[index].getPixels(),
fBmp[index].rowBytes());
diff --git a/include/private/GrSurfaceProxy.h b/include/private/GrSurfaceProxy.h
index 2c7f022140..25430cefcb 100644
--- a/include/private/GrSurfaceProxy.h
+++ b/include/private/GrSurfaceProxy.h
@@ -170,13 +170,13 @@ public:
static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>);
static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>);
- static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*, const GrCaps&,
+ static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
const GrSurfaceDesc&, SkBackingFit,
SkBudgeted, uint32_t flags = 0);
// TODO: need to refine ownership semantics of 'srcData' if we're in completely
// deferred mode
- static sk_sp<GrTextureProxy> MakeDeferred(const GrCaps&, GrResourceProvider*,
+ static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
const GrSurfaceDesc&, SkBudgeted,
const void* srcData, size_t rowBytes);
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 331ee66fb6..411b0ea289 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -105,7 +105,7 @@ sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(GrContext* context) {
// TODO: this is a tight copy of 'bmp' but it doesn't have to be (given SkSpecialImage's
// semantics). Since this is cached though we would have to bake the fit into the cache key.
- sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(context, bmp);
+ sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(context->resourceProvider(), bmp);
if (!proxy) {
return nullptr;
}
@@ -249,7 +249,7 @@ public:
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> onAsTextureProxyRef(GrContext* context) const override {
if (context) {
- return GrMakeCachedBitmapProxy(context, fBitmap);
+ return GrMakeCachedBitmapProxy(context->resourceProvider(), fBitmap);
}
return nullptr;
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index 301eb27148..4b9ab26644 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -260,7 +260,7 @@ static uint8_t* create_half_plane_profile(int profileWidth) {
return profile;
}
-static sk_sp<GrTextureProxy> create_profile_texture(GrContext* context,
+static sk_sp<GrTextureProxy> create_profile_texture(GrResourceProvider* resourceProvider,
const SkRect& circle,
float sigma,
float* solidRadius, float* textureRadius) {
@@ -299,7 +299,7 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrContext* context,
builder[0] = sigmaToCircleRRatioFixed;
builder.finish();
- sk_sp<GrTextureProxy> blurProfile = context->resourceProvider()->findProxyByUniqueKey(key);
+ sk_sp<GrTextureProxy> blurProfile = resourceProvider->findProxyByUniqueKey(key);
if (!blurProfile) {
static constexpr int kProfileTextureWidth = 512;
GrSurfaceDesc texDesc;
@@ -317,13 +317,13 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrContext* context,
kProfileTextureWidth));
}
- blurProfile = GrSurfaceProxy::MakeDeferred(*context->caps(), context->resourceProvider(),
+ blurProfile = GrSurfaceProxy::MakeDeferred(resourceProvider,
texDesc, SkBudgeted::kYes, profile.get(), 0);
if (!blurProfile) {
return nullptr;
}
- context->resourceProvider()->assignUniqueKeyToProxy(key, blurProfile.get());
+ resourceProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
return blurProfile;
@@ -331,16 +331,16 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrContext* context,
//////////////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrContext* context,
+sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrResourceProvider* resourceProvider,
const SkRect& circle, float sigma) {
float solidRadius;
float textureRadius;
- sk_sp<GrTextureProxy> profile(create_profile_texture(context, circle, sigma,
+ sk_sp<GrTextureProxy> profile(create_profile_texture(resourceProvider, circle, sigma,
&solidRadius, &textureRadius));
if (!profile) {
return nullptr;
}
- return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(context->resourceProvider(),
+ return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(resourceProvider,
circle,
textureRadius, solidRadius,
std::move(profile)));
@@ -355,7 +355,7 @@ sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f);
SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
SkRect circle = SkRect::MakeWH(wh, wh);
- return GrCircleBlurFragmentProcessor::Make(d->context(), circle, sigma);
+ return GrCircleBlurFragmentProcessor::Make(d->context()->resourceProvider(), circle, sigma);
}
#endif
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 68d88cf2e0..c6cf3ba923 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -34,7 +34,7 @@ public:
return str;
}
- static sk_sp<GrFragmentProcessor> Make(GrContext*, const SkRect& circle, float sigma);
+ static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, const SkRect& circle, float sigma);
private:
// This nested GLSL processor implementation is defined in the cpp file.
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 24e56f37ff..2bf6b90b8a 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -772,7 +772,8 @@ public:
const char* name() const override { return "RectBlur"; }
- static sk_sp<GrFragmentProcessor> Make(GrContext* context, const SkRect& rect, float sigma) {
+ static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
+ const SkRect& rect, float sigma) {
int doubleProfileSize = SkScalarCeilToInt(12*sigma);
if (doubleProfileSize >= rect.width() || doubleProfileSize >= rect.height()) {
@@ -781,7 +782,7 @@ public:
return nullptr;
}
- sk_sp<GrTextureProxy> blurProfile(CreateBlurProfileTexture(context, sigma));
+ sk_sp<GrTextureProxy> blurProfile(CreateBlurProfileTexture(resourceProvider, sigma));
if (!blurProfile) {
return nullptr;
}
@@ -805,7 +806,7 @@ public:
precision = kDefault_GrSLPrecision;
}
- return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(context->resourceProvider(),
+ return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(resourceProvider,
rect, sigma,
std::move(blurProfile), precision));
}
@@ -824,7 +825,7 @@ private:
bool onIsEqual(const GrFragmentProcessor&) const override;
- static sk_sp<GrTextureProxy> CreateBlurProfileTexture(GrContext*, float sigma);
+ static sk_sp<GrTextureProxy> CreateBlurProfileTexture(GrResourceProvider*, float sigma);
SkRect fRect;
float fSigma;
@@ -942,7 +943,9 @@ void GrGLRectBlurEffect::onSetData(const GrGLSLProgramDataManager& pdman,
pdman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma()));
}
-sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(GrContext* context, float sigma) {
+sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(
+ GrResourceProvider* resourceProvider,
+ float sigma) {
GrSurfaceDesc texDesc;
unsigned int profileSize = SkScalarCeilToInt(6*sigma);
@@ -958,17 +961,17 @@ sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(GrContext* cont
builder[0] = profileSize;
builder.finish();
- sk_sp<GrTextureProxy> blurProfile(context->resourceProvider()->findProxyByUniqueKey(key));
+ sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(key));
if (!blurProfile) {
std::unique_ptr<uint8_t[]> profile(SkBlurMask::ComputeBlurProfile(sigma));
- blurProfile = GrSurfaceProxy::MakeDeferred(*context->caps(), context->resourceProvider(),
+ blurProfile = GrSurfaceProxy::MakeDeferred(resourceProvider,
texDesc, SkBudgeted::kYes, profile.get(), 0);
if (!blurProfile) {
return nullptr;
}
- context->resourceProvider()->assignUniqueKeyToProxy(key, blurProfile.get());
+ resourceProvider->assignUniqueKeyToProxy(key, blurProfile.get());
}
return blurProfile;
@@ -1008,7 +1011,8 @@ sk_sp<GrFragmentProcessor> GrRectBlurEffect::TestCreate(GrProcessorTestData* d)
float sigma = d->fRandom->nextRangeF(3,8);
float width = d->fRandom->nextRangeF(200,300);
float height = d->fRandom->nextRangeF(200,300);
- return GrRectBlurEffect::Make(d->context(), SkRect::MakeWH(width, height), sigma);
+ return GrRectBlurEffect::Make(d->context()->resourceProvider(),
+ SkRect::MakeWH(width, height), sigma);
}
#endif
@@ -1032,6 +1036,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context,
SkScalar xformedSigma = this->computeXformedSigma(viewMatrix);
+ GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
sk_sp<GrFragmentProcessor> fp;
SkRect rect;
@@ -1039,9 +1044,9 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context,
SkScalar pad = 3.0f * xformedSigma;
rect.outset(pad, pad);
- fp = GrRectBlurEffect::Make(context, rect, xformedSigma);
+ fp = GrRectBlurEffect::Make(resourceProvider, rect, xformedSigma);
} else if (path.isOval(&rect) && SkScalarNearlyEqual(rect.width(), rect.height())) {
- fp = GrCircleBlurFragmentProcessor::Make(context, rect, xformedSigma);
+ fp = GrCircleBlurFragmentProcessor::Make(resourceProvider, rect, xformedSigma);
// expand the rect for the coverage geometry
int pad = SkScalarCeilToInt(6*xformedSigma)/2;
@@ -1354,6 +1359,7 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
return false;
}
+ GrResourceProvider* resourceProvider = renderTargetContext->resourceProvider();
SkScalar xformedSigma = this->computeXformedSigma(viewMatrix);
if (devRRect.isRect() || devRRect.isCircle()) {
@@ -1366,9 +1372,10 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context,
SkScalar pad = 3.0f * xformedSigma;
const SkRect dstCoverageRect = devRRect.rect().makeOutset(pad, pad);
- fp = GrRectBlurEffect::Make(context, dstCoverageRect, xformedSigma);
+ fp = GrRectBlurEffect::Make(resourceProvider, dstCoverageRect, xformedSigma);
} else {
- fp = GrCircleBlurFragmentProcessor::Make(context, devRRect.rect(), xformedSigma);
+ fp = GrCircleBlurFragmentProcessor::Make(resourceProvider,
+ devRRect.rect(), xformedSigma);
}
if (!fp) {
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 73e10184e3..aa85d1bf6b 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -915,9 +915,9 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPAr
SkPerlinNoiseShader::PaintingData* paintingData =
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
sk_sp<GrTextureProxy> permutationsProxy(GrMakeCachedBitmapProxy(
- args.fContext,
+ args.fContext->resourceProvider(),
paintingData->getPermutationsBitmap()));
- sk_sp<GrTextureProxy> noiseProxy(GrMakeCachedBitmapProxy(args.fContext,
+ sk_sp<GrTextureProxy> noiseProxy(GrMakeCachedBitmapProxy(args.fContext->resourceProvider(),
paintingData->getNoiseBitmap()));
SkMatrix m = *args.fViewMatrix;
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 099846d2b3..393543b4bb 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -388,7 +388,7 @@ private:
bool onIsEqual(const GrFragmentProcessor&) const override;
- ColorTableEffect(GrContext* context, sk_sp<GrTextureProxy> proxy,
+ ColorTableEffect(GrResourceProvider* , sk_sp<GrTextureProxy> proxy,
GrTextureStripAtlas* atlas, int row, unsigned flags);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -490,6 +490,8 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi
desc.fWidth = bitmap.width();
desc.fHeight = 128;
desc.fRowHeight = bitmap.height();
+
+ // TODO: this seems a bit heavy handed (passing a GrContext as part of the desc)
desc.fContext = context;
desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *context->caps());
GrTextureStripAtlas* atlas = GrTextureStripAtlas::GetAtlas(desc);
@@ -498,7 +500,7 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi
if (-1 == row) {
atlas = nullptr;
- proxy = GrMakeCachedBitmapProxy(context, bitmap);
+ proxy = GrMakeCachedBitmapProxy(context->resourceProvider(), bitmap);
} else {
proxy = atlas->asTextureProxyRef();
}
@@ -507,14 +509,16 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi
return nullptr;
}
- return sk_sp<GrFragmentProcessor>(new ColorTableEffect(context, std::move(proxy),
+ return sk_sp<GrFragmentProcessor>(new ColorTableEffect(context->resourceProvider(),
+ std::move(proxy),
atlas, row, flags));
}
-ColorTableEffect::ColorTableEffect(GrContext* context, sk_sp<GrTextureProxy> proxy,
+ColorTableEffect::ColorTableEffect(GrResourceProvider* resourceProvider,
+ sk_sp<GrTextureProxy> proxy,
GrTextureStripAtlas* atlas, int row, unsigned flags)
: INHERITED(kNone_OptimizationFlags) // Not bothering with table-specific optimizations.
- , fTextureSampler(context->resourceProvider(), std::move(proxy))
+ , fTextureSampler(resourceProvider, std::move(proxy))
, fAtlas(atlas)
, fRow(row) {
this->initClassID<ColorTableEffect>();
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index afb4f8b95a..9d7108f6d0 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1710,7 +1710,9 @@ GrGradientEffect::GrGradientEffect(const CreateArgs& args, bool isOpaque)
// Only the x-tileMode is unknown. However, given all the other knowns we know
// that GrMakeCachedBitmapProxy is sufficient (i.e., it won't need to be
// extracted to a subset or mipmapped).
- sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(args.fContext, bitmap);
+ sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(
+ args.fContext->resourceProvider(),
+ bitmap);
if (!proxy) {
return;
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 01f131020d..f260130d69 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -296,7 +296,6 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpa
sk_sp<GrTextureProxy> tempProxy;
if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
tempProxy = GrSurfaceProxy::MakeDeferred(this->resourceProvider(),
- *this->caps(),
tempDrawInfo.fTempSurfaceDesc,
SkBackingFit::kApprox,
SkBudgeted::kYes);
@@ -622,8 +621,7 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac
SkBudgeted isDstBudgeted) {
sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->resourceProvider(),
- *fContext->caps(), dstDesc,
- fit, isDstBudgeted);
+ dstDesc, fit, isDstBudgeted);
if (!proxy) {
return nullptr;
}
@@ -820,7 +818,7 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
desc.fSampleCnt = sampleCnt;
sk_sp<GrTextureProxy> rtp = GrSurfaceProxy::MakeDeferred(this->resourceProvider(),
- *this->caps(), desc, fit, budgeted);
+ desc, fit, budgeted);
if (!rtp) {
return nullptr;
}
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index dc4944abf9..72ce259be9 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -53,6 +53,8 @@ class SK_API GrRenderTargetContext : public GrSurfaceContext {
public:
~GrRenderTargetContext() override;
+ 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/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 43e82975c7..1a04951283 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -9,6 +9,7 @@
#include "GrBuffer.h"
#include "GrCaps.h"
+#include "GrContext.h"
#include "GrGpu.h"
#include "GrPathRendering.h"
#include "GrRenderTarget.h"
@@ -36,6 +37,8 @@ GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSin
, fSingleOwner(owner)
#endif
{
+ fCaps = sk_ref_sp(fGpu->caps());
+
GR_DEFINE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey);
fQuadIndexBufferKey = gQuadIndexBufferKey;
}
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 2d5b0981fb..948979805c 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -243,14 +243,16 @@ public:
void releaseOwnershipOfSemaphore(sk_sp<GrSemaphore>);
void abandon() {
- fCache = NULL;
- fGpu = NULL;
+ fCache = nullptr;
+ fGpu = nullptr;
}
// 'Proxy' is about to be used as a texture src. This query can be used to determine if
// it is going to need a texture domain.
static bool IsFunctionallyExact(GrTextureProxy* proxy);
+ const GrCaps* caps() const { return fCaps.get(); }
+
private:
GrTexture* internalCreateApproxTexture(const GrSurfaceDesc& desc, uint32_t scratchTextureFlags);
@@ -275,9 +277,10 @@ private:
const GrBuffer* createQuadIndexBuffer();
- GrResourceCache* fCache;
- GrGpu* fGpu;
- GrUniqueKey fQuadIndexBufferKey;
+ GrResourceCache* fCache;
+ GrGpu* fGpu;
+ sk_sp<const GrCaps> fCaps;
+ GrUniqueKey fQuadIndexBufferKey;
// In debug builds we guard against improper thread handling
SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index 88314eacf2..22b2f3c506 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -12,7 +12,6 @@
#include "GrPipelineBuilder.h"
#include "GrResourceProvider.h"
#include "GrSWMaskHelper.h"
-#include "GrSurfaceContextPriv.h"
#include "ops/GrRectOpFactory.h"
////////////////////////////////////////////////////////////////////////////////
@@ -208,11 +207,10 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
if (useCache) {
proxy = fResourceProvider->findProxyByUniqueKey(maskKey);
}
- GrContext* context = args.fRenderTargetContext->surfPriv().getContext();
if (!proxy) {
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
GrAA aa = GrAAType::kCoverage == args.fAAType ? GrAA::kYes : GrAA::kNo;
- proxy = GrSWMaskHelper::DrawShapeMaskToTexture(context, *args.fShape,
+ proxy = GrSWMaskHelper::DrawShapeMaskToTexture(args.fContext, *args.fShape,
*boundsForMask, aa,
fit, args.fViewMatrix);
if (!proxy) {
@@ -228,7 +226,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
unclippedDevShapeBounds);
}
GrSWMaskHelper::DrawToTargetWithShapeMask(
- context, std::move(proxy), args.fRenderTargetContext, std::move(args.fPaint),
+ args.fContext, std::move(proxy), args.fRenderTargetContext, std::move(args.fPaint),
*args.fUserStencilSettings, *args.fClip, *args.fViewMatrix,
SkIPoint{boundsForMask->fLeft, boundsForMask->fTop}, *boundsForMask);
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 279eec2161..a5cb057be4 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -148,13 +148,15 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex) {
#include "GrResourceProvider.h"
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceProvider,
- const GrCaps& caps,
const GrSurfaceDesc& desc,
SkBackingFit fit,
SkBudgeted budgeted,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
+ const GrCaps* caps = resourceProvider->caps();
+
+ // TODO: move this logic into GrResourceProvider!
// TODO: share this testing code with check_texture_creation_params
if (GrPixelConfigIsCompressed(desc.fConfig)) {
if (SkBackingFit::kApprox == fit || kBottomLeft_GrSurfaceOrigin == desc.fOrigin) {
@@ -163,17 +165,17 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
return nullptr;
}
- if (!caps.npotTextureTileSupport() && (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) {
+ if (!caps->npotTextureTileSupport() && (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight))) {
return nullptr;
}
}
- if (!caps.isConfigTexturable(desc.fConfig)) {
+ if (!caps->isConfigTexturable(desc.fConfig)) {
return nullptr;
}
bool willBeRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
- if (willBeRT && !caps.isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
+ if (willBeRT && !caps->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
return nullptr;
}
@@ -184,9 +186,9 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
int maxSize;
if (willBeRT) {
- maxSize = caps.maxRenderTargetSize();
+ maxSize = caps->maxRenderTargetSize();
} else {
- maxSize = caps.maxTextureSize();
+ maxSize = caps->maxTextureSize();
}
if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
@@ -194,20 +196,19 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceP
}
GrSurfaceDesc copyDesc = desc;
- copyDesc.fSampleCnt = SkTMin(desc.fSampleCnt, caps.maxSampleCount());
+ copyDesc.fSampleCnt = SkTMin(desc.fSampleCnt, caps->maxSampleCount());
if (willBeRT) {
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(caps, copyDesc, fit,
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(*caps, copyDesc, fit,
budgeted, flags));
}
return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
}
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
- GrResourceProvider* resourceProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceProvider,
const GrSurfaceDesc& desc,
SkBudgeted budgeted,
const void* srcData,
@@ -218,8 +219,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
- return GrSurfaceProxy::MakeDeferred(resourceProvider, caps, desc, SkBackingFit::kExact,
- budgeted);
+ return GrSurfaceProxy::MakeDeferred(resourceProvider, desc, SkBackingFit::kExact, budgeted);
}
sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 55be407de4..5a98b08220 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -14,7 +14,6 @@
#include "GrImageTextureMaker.h"
#include "GrRenderTargetContextPriv.h"
#include "GrStyle.h"
-#include "GrSurfaceContextPriv.h"
#include "GrTextureAdjuster.h"
#include "GrTextureProxy.h"
#include "GrTracing.h"
@@ -459,7 +458,7 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
// we used to test finalIRect for quickReject, but that seems unlikely
// given that the original shape was not rejected...
- if (mf->directFilterRRectMaskGPU(fContext.get(), fRenderTargetContext.get(),
+ if (mf->directFilterRRectMaskGPU(this->context(), fRenderTargetContext.get(),
std::move(grPaint), this->clip(), this->ctm(),
style.strokeRec(), rrect, devRRect)) {
return;
@@ -1272,7 +1271,7 @@ void SkGpuDevice::drawBitmapRect(const SkBitmap& bitmap,
sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) {
// TODO: this makes a tight copy of 'bitmap' but it doesn't have to be (given SkSpecialImage's
// semantics). Since this is cached we would have to bake the fit into the cache key though.
- sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(fContext.get(), bitmap);
+ sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(fContext->resourceProvider(), bitmap);
if (!proxy) {
return nullptr;
}
@@ -1547,10 +1546,10 @@ void SkGpuDevice::drawBitmapLattice(const SkBitmap& bitmap,
this->drawProducerLattice(&maker, lattice, dst, paint);
}
-bool init_vertices_paint(const SkPaint& skPaint, const SkMatrix& matrix, SkBlendMode bmode,
- bool hasTexs, bool hasColors, GrRenderTargetContext* rtc,
- GrPaint* grPaint) {
- GrContext* context = rtc->surfPriv().getContext();
+static bool init_vertices_paint(GrContext* context, GrRenderTargetContext* rtc,
+ const SkPaint& skPaint,
+ const SkMatrix& matrix, SkBlendMode bmode,
+ bool hasTexs, bool hasColors, GrPaint* grPaint) {
if (hasTexs && skPaint.getShader()) {
if (hasColors) {
// When there are texs and colors the shader and colors are combined using bmode.
@@ -1643,8 +1642,9 @@ void SkGpuDevice::drawVertices(SkCanvas::VertexMode vmode,
GrPrimitiveType primType = SkVertexModeToGrPrimitiveType(vmode);
GrPaint grPaint;
- if (!init_vertices_paint(paint, this->ctm(), bmode, SkToBool(texs), SkToBool(colors),
- fRenderTargetContext.get(), &grPaint)) {
+ if (!init_vertices_paint(fContext.get(), fRenderTargetContext.get(),
+ paint, this->ctm(), bmode, SkToBool(texs),
+ SkToBool(colors), &grPaint)) {
return;
}
fRenderTargetContext->drawVertices(this->clip(),
@@ -1676,8 +1676,8 @@ void SkGpuDevice::drawVerticesObject(sk_sp<SkVertices> vertices,
nullptr, nullptr, mode, vertices->indices(), vertices->indexCount(),
paint);
}
- if (!init_vertices_paint(paint, this->ctm(), mode, hasTexs, hasColors,
- fRenderTargetContext.get(), &grPaint)) {
+ if (!init_vertices_paint(fContext.get(), fRenderTargetContext.get(), paint, this->ctm(),
+ mode, hasTexs, hasColors, &grPaint)) {
return;
}
fRenderTargetContext->drawVertices(this->clip(), std::move(grPaint), this->ctm(),
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index c9c9b0e662..b030469967 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -106,7 +106,8 @@ GrTexture* GrUploadBitmapToTexture(GrContext* ctx, const SkBitmap& bitmap) {
}
-sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrContext* ctx, const SkBitmap& bitmap) {
+sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrResourceProvider* resourceProvider,
+ const SkBitmap& bitmap) {
SkAutoLockPixels alp(bitmap);
if (!bitmap.readyToDraw()) {
return nullptr;
@@ -115,7 +116,7 @@ sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrContext* ctx, const SkBitma
if (!bitmap.peekPixels(&pixmap)) {
return nullptr;
}
- return GrUploadPixmapToTextureProxy(ctx, pixmap, SkBudgeted::kYes);
+ return GrUploadPixmapToTextureProxy(resourceProvider, pixmap, SkBudgeted::kYes);
}
static const SkPixmap* compute_desc(const GrCaps& caps, const SkPixmap& pixmap,
@@ -190,7 +191,7 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
return nullptr;
}
-sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrContext* ctx,
+sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrResourceProvider* resourceProvider,
const SkPixmap& pixmap,
SkBudgeted budgeted) {
if (!SkImageInfoIsValid(pixmap.info())) {
@@ -201,8 +202,9 @@ sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrContext* ctx,
SkPixmap tmpPixmap;
GrSurfaceDesc desc;
- if (const SkPixmap* pmap = compute_desc(*ctx->caps(), pixmap, &desc, &tmpBitmap, &tmpPixmap)) {
- return GrSurfaceProxy::MakeDeferred(*ctx->caps(), ctx->resourceProvider(), desc,
+ if (const SkPixmap* pmap = compute_desc(*resourceProvider->caps(), pixmap, &desc,
+ &tmpBitmap, &tmpPixmap)) {
+ return GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
budgeted, pmap->addr(), pmap->rowBytes());
}
@@ -312,7 +314,8 @@ GrTexture* GrRefCachedBitmapTexture(GrContext* ctx, const SkBitmap& bitmap,
nullptr, scaleAdjust);
}
-sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrContext* context, const SkBitmap& bitmap) {
+sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvider,
+ const SkBitmap& bitmap) {
GrUniqueKey originalKey;
if (!bitmap.isVolatile()) {
@@ -324,12 +327,12 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrContext* context, const SkBitmap
sk_sp<GrTextureProxy> proxy;
if (originalKey.isValid()) {
- proxy = context->resourceProvider()->findProxyByUniqueKey(originalKey);
+ proxy = resourceProvider->findProxyByUniqueKey(originalKey);
}
if (!proxy) {
- proxy = GrUploadBitmapToTextureProxy(context, bitmap);
+ proxy = GrUploadBitmapToTextureProxy(resourceProvider, bitmap);
if (proxy && originalKey.isValid()) {
- context->resourceProvider()->assignUniqueKeyToProxy(originalKey, proxy.get());
+ resourceProvider->assignUniqueKeyToProxy(originalKey, proxy.get());
// MDB TODO (caching): this has to play nice with the GrSurfaceProxy's caching
GrInstallBitmapUniqueKeyInvalidator(originalKey, bitmap.pixelRef());
}
diff --git a/src/gpu/SkGr.h b/src/gpu/SkGr.h
index f0bc390b0c..e1874a6799 100644
--- a/src/gpu/SkGr.h
+++ b/src/gpu/SkGr.h
@@ -27,6 +27,7 @@ class GrContext;
class GrRenderTargetContext;
class GrFragmentProcessor;
class GrPaint;
+class GrResourceProvider;
class GrTexture;
class GrTextureProxy;
class GrUniqueKey;
@@ -213,7 +214,7 @@ GrTexture* GrRefCachedBitmapTexture(GrContext*, const SkBitmap&,
*/
GrTexture* GrUploadBitmapToTexture(GrContext*, const SkBitmap&);
-sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrContext*, const SkBitmap&);
+sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrResourceProvider*, const SkBitmap&);
GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext*, const SkBitmap&,
SkColorSpace* dstColorSpace);
@@ -223,7 +224,8 @@ GrTexture* GrGenerateMipMapsAndUploadToTexture(GrContext*, const SkBitmap&,
*/
GrTexture* GrUploadPixmapToTexture(GrContext*, const SkPixmap&, SkBudgeted);
-sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrContext*, const SkPixmap&, SkBudgeted);
+sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrResourceProvider*,
+ const SkPixmap&, SkBudgeted);
/**
* Creates a new texture populated with the mipmap levels.
@@ -245,7 +247,7 @@ sk_sp<GrTexture> GrMakeCachedBitmapTexture(GrContext*, const SkBitmap&,
// if (!texture) {
// return nullptr;
// }
-sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrContext* context, const SkBitmap& bitmap);
+sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider*, const SkBitmap& bitmap);
/**
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 7bdcaf5ca0..6275adb3c1 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -219,8 +219,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
desc.fHeight = kSize;
desc.fConfig = kConfig;
- sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes, data, 0);
if (!dataProxy) {
return;
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 2bf5a721e6..0f6ca58204 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -210,7 +210,7 @@ void GrTextureStripAtlas::lockTexture() {
sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(key);
if (!proxy) {
proxy = GrSurfaceProxy::MakeDeferred(fDesc.fContext->resourceProvider(),
- *fDesc.fContext->caps(), texDesc, SkBackingFit::kExact,
+ texDesc, SkBackingFit::kExact,
SkBudgeted::kYes,
GrResourceProvider::kNoPendingIO_Flag);
if (!proxy) {
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index afa54d5c43..acd426787b 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -13,7 +13,6 @@
#include "GrPipelineBuilder.h"
#include "GrRenderTargetContext.h"
#include "GrResourceProvider.h"
-#include "GrSurfaceContextPriv.h"
#include "GrTextUtils.h"
#include "SkAutoKern.h"
#include "SkDraw.h"
@@ -528,22 +527,23 @@ void GrStencilAndCoverTextContext::TextRun::setPosText(const char text[], size_t
fFallbackTextBlob = fallback.makeIfNeeded(&fFallbackGlyphCount);
}
-GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(GrContext* ctx) const {
+GrPathRange* GrStencilAndCoverTextContext::TextRun::createGlyphs(
+ GrResourceProvider* resourceProvider) const {
GrPathRange* glyphs = static_cast<GrPathRange*>(
- ctx->resourceProvider()->findAndRefResourceByUniqueKey(fGlyphPathsKey));
+ resourceProvider->findAndRefResourceByUniqueKey(fGlyphPathsKey));
if (nullptr == glyphs) {
if (fUsingRawGlyphPaths) {
SkScalerContextEffects noeffects;
- glyphs = ctx->resourceProvider()->createGlyphs(fFont.getTypeface(), noeffects,
- nullptr, fStyle);
+ glyphs = resourceProvider->createGlyphs(fFont.getTypeface(), noeffects,
+ nullptr, fStyle);
} else {
SkGlyphCache* cache = this->getGlyphCache();
- glyphs = ctx->resourceProvider()->createGlyphs(cache->getScalerContext()->getTypeface(),
- cache->getScalerContext()->getEffects(),
- &cache->getDescriptor(),
- fStyle);
+ glyphs = resourceProvider->createGlyphs(cache->getScalerContext()->getTypeface(),
+ cache->getScalerContext()->getEffects(),
+ &cache->getDescriptor(),
+ fStyle);
}
- ctx->resourceProvider()->assignUniqueKeyToResource(fGlyphPathsKey, glyphs);
+ resourceProvider->assignUniqueKeyToResource(fGlyphPathsKey, glyphs);
}
return glyphs;
}
@@ -585,7 +585,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
0xffff>()
);
- sk_sp<GrPathRange> glyphs(this->createGlyphs(ctx));
+ sk_sp<GrPathRange> glyphs(this->createGlyphs(ctx->resourceProvider()));
if (fLastDrawnGlyphsID != glyphs->uniqueID()) {
// Either this is the first draw or the glyphs object was purged since last draw.
glyphs->loadPathsIfNeeded(fInstanceData->indices(), fInstanceData->count());
@@ -593,9 +593,7 @@ void GrStencilAndCoverTextContext::TextRun::draw(GrContext* ctx,
}
GrPaint grPaint;
- GrContext* context = renderTargetContext->surfPriv().getContext();
- if (!SkPaintToGrPaint(context, renderTargetContext, originalSkPaint, viewMatrix,
- &grPaint)) {
+ if (!SkPaintToGrPaint(ctx, renderTargetContext, originalSkPaint, viewMatrix, &grPaint)) {
return;
}
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h
index a99c264fb7..f06442b1be 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.h
+++ b/src/gpu/text/GrStencilAndCoverTextContext.h
@@ -89,7 +89,7 @@ private:
typedef GrDrawPathRangeOp::InstanceData InstanceData;
SkGlyphCache* getGlyphCache() const;
- GrPathRange* createGlyphs(GrContext*) const;
+ GrPathRange* createGlyphs(GrResourceProvider*) const;
void appendGlyph(const SkGlyph&, const SkPoint&, FallbackBlobBuilder*);
GrStyle fStyle;
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index 4c74dbe76a..31d0291b67 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -41,6 +41,7 @@ static const int kLargeDFFontLimit = 2 * kLargeDFFontSize;
bool GrTextUtils::Paint::toGrPaint(GrMaskFormat maskFormat, GrRenderTargetContext* rtc,
const SkMatrix& viewMatrix, GrPaint* grPaint) const {
+ // TODO: this is the last use of GrSurfaceContextPriv
GrContext* context = rtc->surfPriv().getContext();
if (kARGB_GrMaskFormat == maskFormat) {
return SkPaintToGrPaintWithPrimitiveColor(context, rtc, this->skPaint(), grPaint);
diff --git a/tests/CopySurfaceTest.cpp b/tests/CopySurfaceTest.cpp
index 828eff073e..6acb23967b 100644
--- a/tests/CopySurfaceTest.cpp
+++ b/tests/CopySurfaceTest.cpp
@@ -74,14 +74,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
dstDesc.fFlags = dFlags;
sk_sp<GrTextureProxy> src(GrSurfaceProxy::MakeDeferred(
- *context->caps(),
context->resourceProvider(),
srcDesc, SkBudgeted::kNo,
srcPixels.get(),
kRowBytes));
sk_sp<GrTextureProxy> dst(GrSurfaceProxy::MakeDeferred(
- *context->caps(),
context->resourceProvider(),
dstDesc, SkBudgeted::kNo,
dstPixels.get(),
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 5ea5b3d22d..998e339abe 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -167,12 +167,10 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) {
externalDesc.fSampleCnt = 0;
}
- test_read_pixels(reporter, context0, surfaceContext.get(), pixels.get(),
- "EGLImageTest-read");
+ test_read_pixels(reporter, surfaceContext.get(), pixels.get(), "EGLImageTest-read");
// We should not be able to write to a EXTERNAL texture
- test_write_pixels(reporter, context0, surfaceContext.get(), false,
- "EGLImageTest-write");
+ test_write_pixels(reporter, surfaceContext.get(), false, "EGLImageTest-write");
// Only test RT-config
// TODO: why do we always need to draw to copy from an external texture?
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 3979581266..fe67925fda 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -193,7 +193,7 @@ static GrTexture* create_texture(GrContext* context) {
return context->resourceProvider()->createTexture(desc, SkBudgeted::kNo, srcBM.getPixels(), 0);
}
-static sk_sp<GrTextureProxy> create_proxy(GrContext* context) {
+static sk_sp<GrTextureProxy> create_proxy(GrResourceProvider* resourceProvider) {
SkBitmap srcBM = create_bm();
GrSurfaceDesc desc;
@@ -202,8 +202,7 @@ static sk_sp<GrTextureProxy> create_proxy(GrContext* context) {
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- return GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ return GrSurfaceProxy::MakeDeferred(resourceProvider,
desc, SkBudgeted::kYes,
srcBM.getPixels(),
srcBM.rowBytes());
@@ -254,7 +253,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_GPUBacked, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- sk_sp<GrTextureProxy> srcProxy(create_proxy(context));
+ sk_sp<GrTextureProxy> srcProxy(create_proxy(context->resourceProvider()));
if (!srcProxy) {
return;
}
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index 93a9ced577..346f56bc68 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -71,8 +71,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
}
// Test that we can create an integer texture.
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
testData.get(),
kRowBytes);
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 7d9349ba6d..a99e5324ec 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -142,7 +142,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
bool imageLoadStoreSupport = context->caps()->shaderCaps()->imageLoadStoreSupport();
sk_sp<GrTextureProxy> proxy1(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
- *context->caps(), desc,
+ desc,
SkBackingFit::kExact,
SkBudgeted::kYes));
sk_sp<GrTexture> texture2(
@@ -315,8 +315,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
}
desc.fConfig = kRGBA_8888_GrPixelConfig;
- sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kYes,
rgbaData.get(),
256 * sizeof(GrColor));
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 9514a52c06..a041d68c2b 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -118,7 +118,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyConversionTest, reporter, ctxInfo
// Test converting between RenderTargetProxies and TextureProxies for deferred
// Proxies
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxInfo) {
- const GrCaps& caps = *ctxInfo.grContext()->caps();
GrResourceProvider* resourceProvider = ctxInfo.grContext()->resourceProvider();
GrSurfaceDesc desc;
@@ -128,7 +127,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
desc.fConfig = kRGBA_8888_GrPixelConfig;
{
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, caps, desc,
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));
@@ -140,9 +139,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
REPORTER_ASSERT(reporter, tProxy->asRenderTargetProxy() == rtProxy);
REPORTER_ASSERT(reporter, rtProxy->asRenderTargetProxy() == rtProxy);
}
-
+
{
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, caps, desc,
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));
@@ -158,7 +157,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
{
desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, caps, desc,
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
SkBackingFit::kApprox,
SkBudgeted::kYes));
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 612633c58c..ec47597b97 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -65,18 +65,18 @@ static void check_refs(skiatest::Reporter* reporter,
SkASSERT(proxy->getPendingWriteCnt_TestOnly() == expectedNumWrites);
}
-static sk_sp<GrSurfaceProxy> make_deferred(const GrCaps& caps, GrResourceProvider* provider) {
+static sk_sp<GrSurfaceProxy> make_deferred(GrResourceProvider* provider) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
- return GrSurfaceProxy::MakeDeferred(provider, caps, desc,
+ return GrSurfaceProxy::MakeDeferred(provider, desc,
SkBackingFit::kApprox, SkBudgeted::kYes);
}
-static sk_sp<GrSurfaceProxy> make_wrapped(const GrCaps& caps, GrResourceProvider* provider) {
+static sk_sp<GrSurfaceProxy> make_wrapped(GrResourceProvider* provider) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = kWidthHeight;
@@ -100,7 +100,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
for (auto make : { make_deferred, make_wrapped }) {
// A single write
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(caps, provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());
@@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(caps, provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
GrPendingIOResource<GrSurfaceProxy, kRead_GrIOType> fRead(sProxy.get());
@@ -140,7 +140,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// A single read/write pair
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(caps, provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
GrPendingIOResource<GrSurfaceProxy, kRW_GrIOType> fRW(sProxy.get());
@@ -160,7 +160,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Multiple normal refs
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(caps, provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sProxy->ref();
sProxy->ref();
@@ -181,7 +181,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
// Continue using (reffing) proxy after instantiation
{
- sk_sp<GrSurfaceProxy> sProxy((*make)(caps, provider));
+ sk_sp<GrSurfaceProxy> sProxy((*make)(provider));
sProxy->ref();
GrPendingIOResource<GrSurfaceProxy, kWrite_GrIOType> fWrite(sProxy.get());
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 50af7f70ec..648ae1d6c8 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -141,8 +141,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
}
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(
- provider,
- caps, desc,
+ provider, desc,
fit, budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
@@ -175,10 +174,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
}
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(provider,
- caps,
- desc,
- fit,
- budgeted));
+ desc,
+ fit,
+ budgeted));
REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
if (proxy) {
// This forces the proxy to compute and cache its pre-instantiation
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 4fff156b98..ac34b9dc32 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -56,8 +56,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
// We are initializing the texture with zeros here
memset(alphaData, 0, X_SIZE * Y_SIZE);
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc,
SkBudgeted::kNo,
alphaData, 0));
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 0f164ebc79..efc11bab26 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -37,13 +37,12 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
- test_read_pixels(reporter, context, rtContext.get(), expectedPixelValues,
+ test_read_pixels(reporter, rtContext.get(), expectedPixelValues,
"RectangleTexture-basic-draw");
}
}
-static void test_clear(skiatest::Reporter* reporter, GrContext* context,
- GrSurfaceContext* rectContext) {
+static void test_clear(skiatest::Reporter* reporter, GrSurfaceContext* rectContext) {
if (GrRenderTargetContext* rtc = rectContext->asRenderTargetContext()) {
// Clear the whole thing.
GrColor color0 = GrColorPackRGBA(0xA, 0xB, 0xC, 0xD);
@@ -83,7 +82,7 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context,
}
}
- test_read_pixels(reporter, context, rtc, expectedPixels.get(), "RectangleTexture-clear");
+ test_read_pixels(reporter, rtc, expectedPixels.get(), "RectangleTexture-clear");
}
}
@@ -152,13 +151,14 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) {
std::move(rectProxy), nullptr);
SkASSERT(rectContext);
- test_read_pixels(reporter, context, rectContext.get(), refPixels, "RectangleTexture-read");
+ test_read_pixels(reporter, rectContext.get(), refPixels, "RectangleTexture-read");
- test_copy_to_surface(reporter, context, rectContext.get(), "RectangleTexture-copy-to");
+ test_copy_to_surface(reporter, context->resourceProvider(),
+ rectContext.get(), "RectangleTexture-copy-to");
- test_write_pixels(reporter, context, rectContext.get(), true, "RectangleTexture-write");
+ test_write_pixels(reporter, rectContext.get(), true, "RectangleTexture-write");
- test_clear(reporter, context, rectContext.get());
+ test_clear(reporter, rectContext.get());
GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
}
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index bf983eef1b..124327a70e 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -120,7 +120,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
desc.fHeight = texS;
GrResourceProvider* resourceProvider = context->resourceProvider();
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(), resourceProvider,
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(resourceProvider,
desc, SkBudgeted::kNo,
texData, 0);
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index d6922c394c..6c1f1bc04a 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -234,8 +234,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
// gpu
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
bm.getPixels(), bm.rowBytes()));
if (!proxy) {
@@ -268,8 +267,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
bm.getPixels(), bm.rowBytes()));
if (!proxy) {
@@ -308,8 +306,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo)
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
- sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
bm.getPixels(), 0));
if (!proxy) {
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index 63a8d94871..d0349614f1 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -13,7 +13,7 @@
#include "GrSurfaceProxy.h"
#include "GrTextureProxy.h"
-void test_read_pixels(skiatest::Reporter* reporter, GrContext* context,
+void test_read_pixels(skiatest::Reporter* reporter,
GrSurfaceContext* srcContext, uint32_t expectedPixelValues[],
const char* testName) {
int pixelCnt = srcContext->width() * srcContext->height();
@@ -36,7 +36,7 @@ void test_read_pixels(skiatest::Reporter* reporter, GrContext* context,
}
}
-void test_write_pixels(skiatest::Reporter* reporter, GrContext* context,
+void test_write_pixels(skiatest::Reporter* reporter,
GrSurfaceContext* dstContext, bool expectedToWork,
const char* testName) {
int pixelCnt = dstContext->width() * dstContext->height();
@@ -63,7 +63,7 @@ void test_write_pixels(skiatest::Reporter* reporter, GrContext* context,
return;
}
- test_read_pixels(reporter, context, dstContext, pixels.get(), testName);
+ test_read_pixels(reporter, dstContext, pixels.get(), testName);
}
void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context,
@@ -83,11 +83,11 @@ void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context,
sk_sp<GrSurfaceContext> dstContext(GrSurfaceProxy::TestCopy(context, copyDstDesc, proxy));
- test_read_pixels(reporter, context, dstContext.get(), expectedPixelValues, testName);
+ test_read_pixels(reporter, dstContext.get(), expectedPixelValues, testName);
}
}
-void test_copy_to_surface(skiatest::Reporter* reporter, GrContext* context,
+void test_copy_to_surface(skiatest::Reporter* reporter, GrResourceProvider* resourceProvider,
GrSurfaceContext* dstContext, const char* testName) {
int pixelCnt = dstContext->width() * dstContext->height();
@@ -107,13 +107,12 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrContext* context,
for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) {
copySrcDesc.fFlags = flags;
- sk_sp<GrTextureProxy> src(GrSurfaceProxy::MakeDeferred(*context->caps(),
- context->resourceProvider(),
+ sk_sp<GrTextureProxy> src(GrSurfaceProxy::MakeDeferred(resourceProvider,
copySrcDesc,
SkBudgeted::kYes, pixels.get(), 0));
dstContext->copy(src.get());
- test_read_pixels(reporter, context, dstContext, pixels.get(), testName);
+ test_read_pixels(reporter, dstContext, pixels.get(), testName);
}
}
diff --git a/tests/TestUtils.h b/tests/TestUtils.h
index 7c3370ed7e..6f878bfa29 100644
--- a/tests/TestUtils.h
+++ b/tests/TestUtils.h
@@ -13,22 +13,22 @@ class GrSurfaceContext;
class GrSurfaceProxy;
// Ensure that reading back from 'srcContext' as RGBA 8888 matches 'expectedPixelValues
-void test_read_pixels(skiatest::Reporter* reporter, GrContext* context,
+void test_read_pixels(skiatest::Reporter*,
GrSurfaceContext* srcContext, uint32_t expectedPixelValues[],
const char* testName);
// See if trying to write RGBA 8888 pixels to 'dstContext' matches matches the
// expectation ('expectedToWork')
-void test_write_pixels(skiatest::Reporter* reporter, GrContext* context,
+void test_write_pixels(skiatest::Reporter*,
GrSurfaceContext* srcContext, bool expectedToWork, const char* testName);
// Ensure that the pixels can be copied from 'proxy' to an RGBA 8888 destination (both
// texture-backed and rendertarget-backed).
-void test_copy_from_surface(skiatest::Reporter* reporter, GrContext* context,
+void test_copy_from_surface(skiatest::Reporter*, GrContext*,
GrSurfaceProxy* proxy, uint32_t expectedPixelValues[],
bool onlyTestRTConfig, const char* testName);
// Ensure that RGBA 8888 pixels can be copied into 'dstContext'
-void test_copy_to_surface(skiatest::Reporter* reporter, GrContext* context,
+void test_copy_to_surface(skiatest::Reporter*, GrResourceProvider*,
GrSurfaceContext* dstContext, const char* testName);
#endif