Remove texColorSpace output param from various producer APIs

Just expose colorSpace on the GrTextureProducer, and if a client needs
it, they can get it from there.

Bug: skia:
Change-Id: I5134b1c9b2780274f3d6571d9fe8cd2a6b6ce7e9
Reviewed-on: https://skia-review.googlesource.com/c/163888
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2018-10-19 14:27:54 -04:00 committed by Skia Commit-Bot
parent 41ba826ad7
commit 6064e1c5d6
23 changed files with 43 additions and 91 deletions

View File

@ -264,9 +264,8 @@ protected:
}
static void draw_as_tex(SkCanvas* canvas, SkImage* image, SkScalar x, SkScalar y) {
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy(as_IB(image)->asTextureProxyRef(
canvas->getGrContext(), GrSamplerState::ClampBilerp(), &texColorSpace, nullptr));
canvas->getGrContext(), GrSamplerState::ClampBilerp(), nullptr));
if (!proxy) {
// show placeholder if we have no texture
SkPaint paint;
@ -282,7 +281,7 @@ protected:
// No API to draw a GrTexture directly, so we cheat and create a private image subclass
sk_sp<SkImage> texImage(new SkImage_Gpu(
sk_ref_sp(canvas->getGrContext()), image->uniqueID(), kPremul_SkAlphaType,
std::move(proxy), std::move(texColorSpace), SkBudgeted::kNo));
std::move(proxy), image->refColorSpace(), SkBudgeted::kNo));
canvas->drawImage(texImage.get(), x, y);
}

View File

@ -113,6 +113,6 @@ SkAlphaType GrBitmapTextureMaker::alphaType() const {
return fBitmap.alphaType();
}
sk_sp<SkColorSpace> GrBitmapTextureMaker::getColorSpace() {
return fBitmap.refColorSpace();
SkColorSpace* GrBitmapTextureMaker::colorSpace() const {
return fBitmap.colorSpace();
}

View File

@ -26,7 +26,7 @@ protected:
void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace() override;
SkColorSpace* colorSpace() const override;
private:
const SkBitmap fBitmap;

View File

@ -36,6 +36,6 @@ void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa
SkAlphaType GrImageTextureMaker::alphaType() const {
return fImage->alphaType();
}
sk_sp<SkColorSpace> GrImageTextureMaker::getColorSpace() {
return fImage->refColorSpace();
SkColorSpace* GrImageTextureMaker::colorSpace() const {
return fImage->colorSpace();
}

View File

@ -30,7 +30,7 @@ protected:
void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override {}
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace() override;
SkColorSpace* colorSpace() const override;
private:
const SkImage_Lazy* fImage;

View File

@ -73,7 +73,6 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
sk_sp<GrTextureProxy> GrTextureAdjuster::onRefTextureProxyForParams(
const GrSamplerState& params,
sk_sp<SkColorSpace>* texColorSpace,
bool willBeMipped,
SkScalar scaleAdjust[2]) {
sk_sp<GrTextureProxy> proxy = this->originalProxyRef();
@ -84,9 +83,6 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::onRefTextureProxyForParams(
return nullptr;
}
if (texColorSpace) {
*texColorSpace = sk_ref_sp(fColorSpace);
}
SkASSERT(this->width() <= fContext->contextPriv().caps()->maxTextureSize() &&
this->height() <= fContext->contextPriv().caps()->maxTextureSize());
@ -129,7 +125,7 @@ std::unique_ptr<GrFragmentProcessor> GrTextureAdjuster::createFragmentProcessor(
}
SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
sk_sp<GrTextureProxy> proxy(
this->refTextureProxyForParams(samplerState, nullptr, scaleAdjust));
this->refTextureProxyForParams(samplerState, scaleAdjust));
if (!proxy) {
return nullptr;
}

View File

@ -35,6 +35,7 @@ public:
protected:
SkAlphaType alphaType() const override { return fAlphaType; }
SkColorSpace* colorSpace() const override { return fColorSpace; }
void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override;
void didCacheCopy(const GrUniqueKey& copyKey, uint32_t contextUniqueID) override;
@ -43,7 +44,6 @@ protected:
private:
sk_sp<GrTextureProxy> onRefTextureProxyForParams(const GrSamplerState&,
sk_sp<SkColorSpace>* proxyColorSpace,
bool willBeMipped,
SkScalar scaleAdjust[2]) override;

View File

@ -14,7 +14,6 @@
#include "GrProxyProvider.h"
sk_sp<GrTextureProxy> GrTextureMaker::onRefTextureProxyForParams(const GrSamplerState& params,
sk_sp<SkColorSpace>* texColorSpace,
bool willBeMipped,
SkScalar scaleAdjust[2]) {
if (this->width() > fContext->contextPriv().caps()->maxTextureSize() ||
@ -24,10 +23,6 @@ sk_sp<GrTextureProxy> GrTextureMaker::onRefTextureProxyForParams(const GrSampler
CopyParams copyParams;
if (texColorSpace) {
*texColorSpace = this->getColorSpace();
}
sk_sp<GrTextureProxy> original(this->refOriginalTextureProxy(willBeMipped,
AllowedTexGenType::kCheap));
bool needsCopyForMipsOnly = false;
@ -133,10 +128,8 @@ std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
// Bicubic doesn't use filtering for it's texture accesses.
samplerState = GrSamplerState::ClampNearest();
}
sk_sp<SkColorSpace> texColorSpace;
SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
sk_sp<GrTextureProxy> proxy(this->refTextureProxyForParams(samplerState, &texColorSpace,
scaleAdjust));
sk_sp<GrTextureProxy> proxy(this->refTextureProxyForParams(samplerState, scaleAdjust));
if (!proxy) {
return nullptr;
}
@ -149,6 +142,6 @@ std::unique_ptr<GrFragmentProcessor> GrTextureMaker::createFragmentProcessor(
SkASSERT(kTightCopy_DomainMode != domainMode);
auto fp = CreateFragmentProcessorForDomainAndFilter(std::move(proxy), adjustedMatrix,
domainMode, domain, filterOrNullForBicubic);
return GrColorSpaceXformEffect::Make(std::move(fp), texColorSpace.get(), this->alphaType(),
return GrColorSpaceXformEffect::Make(std::move(fp), this->colorSpace(), this->alphaType(),
dstColorSpace);
}

View File

@ -40,16 +40,10 @@ protected:
virtual sk_sp<GrTextureProxy> refOriginalTextureProxy(bool willBeMipped,
AllowedTexGenType genType) = 0;
/**
* Returns the color space of the maker's "original" texture.
*/
virtual sk_sp<SkColorSpace> getColorSpace() = 0;
GrContext* context() const { return fContext; }
private:
sk_sp<GrTextureProxy> onRefTextureProxyForParams(const GrSamplerState&,
sk_sp<SkColorSpace>* proxyColorSpace,
bool willBeMipped,
SkScalar scaleAdjust[2]) override;

View File

@ -217,7 +217,6 @@ std::unique_ptr<GrFragmentProcessor> GrTextureProducer::CreateFragmentProcessorF
sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxyForParams(
const GrSamplerState& sampler,
sk_sp<SkColorSpace>* proxyColorSpace,
SkScalar scaleAdjust[2]) {
// Check that the caller pre-initialized scaleAdjust
SkASSERT(!scaleAdjust || (scaleAdjust[0] == 1 && scaleAdjust[1] == 1));
@ -231,8 +230,7 @@ sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxyForParams(
bool willBeMipped = GrSamplerState::Filter::kMipMap == sampler.filter() && mipCount &&
fContext->contextPriv().caps()->mipMapSupport();
auto result = this->onRefTextureProxyForParams(sampler, proxyColorSpace, willBeMipped,
scaleAdjust);
auto result = this->onRefTextureProxyForParams(sampler, willBeMipped, scaleAdjust);
// Check to make sure that if we say the texture willBeMipped that the returned texture has mip
// maps, unless the config is not copyable.
@ -246,8 +244,7 @@ sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxyForParams(
return result;
}
sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxy(GrMipMapped willNeedMips,
sk_sp<SkColorSpace>* proxyColorSpace) {
sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxy(GrMipMapped willNeedMips) {
GrSamplerState::Filter filter =
GrMipMapped::kNo == willNeedMips ? GrSamplerState::Filter::kNearest
: GrSamplerState::Filter::kMipMap;
@ -257,7 +254,7 @@ sk_sp<GrTextureProxy> GrTextureProducer::refTextureProxy(GrMipMapped willNeedMip
bool willBeMipped = GrSamplerState::Filter::kMipMap == sampler.filter() && mipCount &&
fContext->contextPriv().caps()->mipMapSupport();
auto result = this->onRefTextureProxyForParams(sampler, proxyColorSpace, willBeMipped, nullptr);
auto result = this->onRefTextureProxyForParams(sampler, willBeMipped, nullptr);
// Check to make sure that if we say the texture willBeMipped that the returned texture has mip
// maps, unless the config is not copyable.

View File

@ -82,34 +82,26 @@ public:
* proxy will always be unscaled and nullptr can be passed for scaleAdjust. There is a weird
* contract that if scaleAdjust is not null it must be initialized to {1, 1} before calling
* this method. (TODO: Fix this and make this function always initialize scaleAdjust).
*
* Places the color space of the texture in (*proxyColorSpace).
*/
sk_sp<GrTextureProxy> refTextureProxyForParams(const GrSamplerState&,
sk_sp<SkColorSpace>* proxyColorSpace,
SkScalar scaleAdjust[2]);
sk_sp<GrTextureProxy> refTextureProxyForParams(GrSamplerState::Filter filter,
sk_sp<SkColorSpace>* proxyColorSpace,
SkScalar scaleAdjust[2]) {
return this->refTextureProxyForParams(
GrSamplerState(GrSamplerState::WrapMode::kClamp, filter),
proxyColorSpace, scaleAdjust);
GrSamplerState(GrSamplerState::WrapMode::kClamp, filter), scaleAdjust);
}
/**
* Returns a texture. If willNeedMips is true then the returned texture is guaranteed to have
* allocated mip map levels. This can be a performance win if future draws with the texture
* require mip maps.
*
* Places the color space of the texture in (*proxyColorSpace).
*/
// TODO: Once we remove support for npot textures, we should add a flag for must support repeat
// wrap mode. To support that flag now would require us to support scaleAdjust array like in
// refTextureProxyForParams, however the current public API that uses this call does not expose
// that array.
sk_sp<GrTextureProxy> refTextureProxy(GrMipMapped willNeedMips,
sk_sp<SkColorSpace>* proxyColorSpace);
sk_sp<GrTextureProxy> refTextureProxy(GrMipMapped willNeedMips);
virtual ~GrTextureProducer() {}
@ -117,6 +109,7 @@ public:
int height() const { return fHeight; }
bool isAlphaOnly() const { return fIsAlphaOnly; }
virtual SkAlphaType alphaType() const = 0;
virtual SkColorSpace* colorSpace() const = 0;
protected:
friend class GrTextureProducer_TestAccess;
@ -186,7 +179,6 @@ protected:
private:
virtual sk_sp<GrTextureProxy> onRefTextureProxyForParams(const GrSamplerState&,
sk_sp<SkColorSpace>* proxyColorSpace,
bool willBeMipped,
SkScalar scaleAdjust[2]) = 0;

View File

@ -1398,14 +1398,12 @@ void SkGpuDevice::drawProducerLattice(GrTextureProducer* producer,
auto dstColorSpace = fRenderTargetContext->colorSpaceInfo().colorSpace();
const GrSamplerState::Filter filter = compute_lattice_filter_mode(*paint);
sk_sp<SkColorSpace> proxyColorSpace;
auto proxy =
producer->refTextureProxyForParams(filter, &proxyColorSpace, nullptr);
auto proxy = producer->refTextureProxyForParams(filter, nullptr);
if (!proxy) {
return;
}
auto csxf = GrColorSpaceXform::Make(proxyColorSpace.get(), producer->alphaType(),
dstColorSpace, kPremul_SkAlphaType);
auto csxf = GrColorSpaceXform::Make(producer->colorSpace(), producer->alphaType(),
dstColorSpace, kPremul_SkAlphaType);
fRenderTargetContext->drawImageLattice(this->clip(), std::move(grPaint), this->ctm(),
std::move(proxy), std::move(csxf), filter,
@ -1481,8 +1479,7 @@ void SkGpuDevice::drawImageSet(const SkCanvas::ImageSetEntry set[], int count, f
}
textures[i].fProxy =
as_IB(set[i].fImage.get())
->asTextureProxyRef(fContext.get(), GrSamplerState::ClampBilerp(), nullptr,
nullptr);
->asTextureProxyRef(fContext.get(), GrSamplerState::ClampBilerp(), nullptr);
textures[i].fSrcRect = set[i].fSrcRect;
textures[i].fDstRect = set[i].fDstRect;
textures[i].fAAFlags = SkToGrQuadAAFlags(set[i].fAAFlags);

View File

@ -165,15 +165,15 @@ void SkGpuDevice::drawTextureMaker(GrTextureMaker* maker, int imageW, int imageH
const SkMatrix& viewMatrix, const SkPaint& paint) {
GrAA aa = GrAA(paint.isAntiAlias());
if (can_use_draw_texture(paint)) {
sk_sp<SkColorSpace> cs;
// We've done enough checks above to allow us to pass ClampNearest() and not check for
// scaling adjustments.
auto proxy = maker->refTextureProxyForParams(GrSamplerState::ClampNearest(), &cs, nullptr);
auto proxy = maker->refTextureProxyForParams(GrSamplerState::ClampNearest(), nullptr);
if (!proxy) {
return;
}
draw_texture(paint, viewMatrix, srcRect, dstRect, aa, constraint, std::move(proxy),
maker->alphaType(), cs.get(), this->clip(), fRenderTargetContext.get());
maker->alphaType(), maker->colorSpace(), this->clip(),
fRenderTargetContext.get());
return;
}
this->drawTextureProducer(maker, srcRect, dstRect, constraint, viewMatrix, paint);

View File

@ -179,8 +179,7 @@ sk_sp<GrTextureProxy> GrRefCachedBitmapTextureProxy(GrContext* ctx,
const SkBitmap& bitmap,
const GrSamplerState& params,
SkScalar scaleAdjust[2]) {
// Caller doesn't care about the texture's color space (they can always get it from the bitmap)
return GrBitmapTextureMaker(ctx, bitmap).refTextureProxyForParams(params, nullptr, scaleAdjust);
return GrBitmapTextureMaker(ctx, bitmap).refTextureProxyForParams(params, scaleAdjust);
}
sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrProxyProvider* proxyProvider,

View File

@ -54,7 +54,6 @@ public:
virtual GrTextureProxy* peekProxy() const { return nullptr; }
virtual sk_sp<GrTextureProxy> asTextureProxyRef() const { return nullptr; }
virtual sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
sk_sp<SkColorSpace>*,
SkScalar scaleAdjust[2]) const = 0;
virtual sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const {
return nullptr;

View File

@ -344,13 +344,12 @@ sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopyWithExternalBackend(
static sk_sp<SkImage> create_image_from_producer(GrContext* context, GrTextureProducer* producer,
SkAlphaType at, uint32_t id,
GrMipMapped mipMapped) {
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy(producer->refTextureProxy(mipMapped, &texColorSpace));
sk_sp<GrTextureProxy> proxy(producer->refTextureProxy(mipMapped));
if (!proxy) {
return nullptr;
}
return sk_make_sp<SkImage_Gpu>(sk_ref_sp(context), id, at, std::move(proxy),
std::move(texColorSpace), SkBudgeted::kNo);
sk_ref_sp(producer->colorSpace()), SkBudgeted::kNo);
}
sk_sp<SkImage> SkImage::makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace,
@ -657,12 +656,10 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
// Turn the codec image into a GrTextureProxy
GrImageTextureMaker maker(context, codecImage.get(), kDisallow_CachingHint);
sk_sp<SkColorSpace> texColorSpace;
GrSamplerState samplerState(
GrSamplerState::WrapMode::kClamp,
buildMips ? GrSamplerState::Filter::kMipMap : GrSamplerState::Filter::kBilerp);
sk_sp<GrTextureProxy> proxy(
maker.refTextureProxyForParams(samplerState, &texColorSpace, nullptr));
sk_sp<GrTextureProxy> proxy(maker.refTextureProxyForParams(samplerState, nullptr));
if (!proxy) {
return codecImage;
}
@ -682,7 +679,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
std::move(sema),
as_IB(codecImage)->onImageInfo().colorType(),
codecImage->alphaType(),
std::move(texColorSpace));
codecImage->refColorSpace());
return SkImage::MakeFromGenerator(std::move(gen));
}

View File

@ -187,7 +187,6 @@ bool SkImage_GpuBase::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels,
sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (context->uniqueID() != fContext->uniqueID()) {
SkASSERT(0);
@ -196,7 +195,7 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
GrTextureAdjuster adjuster(fContext.get(), this->asTextureProxyRef(), fAlphaType,
this->uniqueID(), fColorSpace.get());
return adjuster.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
return adjuster.refTextureProxyForParams(params, scaleAdjust);
}
GrBackendTexture SkImage_GpuBase::onGetBackendTexture(bool flushPendingGrContextIO,

View File

@ -34,7 +34,7 @@ public:
SkASSERT(false);
return this->INHERITED::asTextureProxyRef();
}
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&, sk_sp<SkColorSpace>*,
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const final;
sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const final {

View File

@ -287,14 +287,13 @@ bool SkImage_Lazy::onIsValid(GrContext* context) const {
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> SkImage_Lazy::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (!context) {
return nullptr;
}
GrImageTextureMaker textureMaker(context, this, kAllow_CachingHint);
return textureMaker.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
return textureMaker.refTextureProxyForParams(params, scaleAdjust);
}
#endif

View File

@ -47,7 +47,6 @@ public:
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*,
const GrSamplerState&,
sk_sp<SkColorSpace>*,
SkScalar scaleAdjust[2]) const override;
sk_sp<SkCachedData> getPlanes(SkYUVSizeInfo*, SkYUVAIndex[4],
SkYUVColorSpace*, const void* planes[4]) override;

View File

@ -82,7 +82,7 @@ public:
const SkBitmap* onPeekBitmap() const override { return &fBitmap; }
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&, sk_sp<SkColorSpace>*,
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const override;
#endif
@ -172,7 +172,6 @@ bool SkImage_Raster::getROPixels(SkBitmap* dst, CachingHint) const {
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> SkImage_Raster::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (!context) {
return nullptr;
@ -183,11 +182,7 @@ sk_sp<GrTextureProxy> SkImage_Raster::asTextureProxyRef(GrContext* context,
if (tex) {
GrTextureAdjuster adjuster(context, fPinnedProxy, fBitmap.alphaType(), fPinnedUniqueID,
fBitmap.colorSpace());
return adjuster.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
}
if (texColorSpace) {
*texColorSpace = fBitmap.refColorSpace();
return adjuster.refTextureProxyForParams(params, scaleAdjust);
}
return GrRefCachedBitmapTextureProxy(context, fBitmap, params, scaleAdjust);

View File

@ -200,10 +200,9 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
args.fFilterQuality, *args.fViewMatrix, *lm,
args.fContext->contextPriv().sharpenMipmappedTextures(), &doBicubic);
GrSamplerState samplerState(wrapModes, textureFilterMode);
sk_sp<SkColorSpace> texColorSpace;
SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
sk_sp<GrTextureProxy> proxy(as_IB(fImage)->asTextureProxyRef(args.fContext, samplerState,
&texColorSpace, scaleAdjust));
scaleAdjust));
if (!proxy) {
return nullptr;
}
@ -219,7 +218,7 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
} else {
inner = GrSimpleTextureEffect::Make(std::move(proxy), lmInverse, samplerState);
}
inner = GrColorSpaceXformEffect::Make(std::move(inner), texColorSpace.get(),
inner = GrColorSpaceXformEffect::Make(std::move(inner), fImage->colorSpace(),
fImage->alphaType(),
args.fDstColorSpaceInfo->colorSpace());
if (isAlphaOnly) {

View File

@ -984,21 +984,20 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte
sk_sp<SkImage> refImg(imageMaker(ctx));
// Any context should be able to borrow the texture at this point
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy = as_IB(refImg)->asTextureProxyRef(
ctx, GrSamplerState::ClampNearest(), &texColorSpace, nullptr);
ctx, GrSamplerState::ClampNearest(), nullptr);
REPORTER_ASSERT(reporter, proxy);
// But once it's borrowed, no other context should be able to borrow
otherTestContext->makeCurrent();
sk_sp<GrTextureProxy> otherProxy = as_IB(refImg)->asTextureProxyRef(
otherCtx, GrSamplerState::ClampNearest(), &texColorSpace, nullptr);
otherCtx, GrSamplerState::ClampNearest(), nullptr);
REPORTER_ASSERT(reporter, !otherProxy);
// Original context (that's already borrowing) should be okay
testContext->makeCurrent();
sk_sp<GrTextureProxy> proxySecondRef = as_IB(refImg)->asTextureProxyRef(
ctx, GrSamplerState::ClampNearest(), &texColorSpace, nullptr);
ctx, GrSamplerState::ClampNearest(), nullptr);
REPORTER_ASSERT(reporter, proxySecondRef);
// Release first ref from the original context
@ -1008,7 +1007,7 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte
// a new context is still not able to borrow the texture.
otherTestContext->makeCurrent();
otherProxy = as_IB(refImg)->asTextureProxyRef(otherCtx, GrSamplerState::ClampNearest(),
&texColorSpace, nullptr);
nullptr);
REPORTER_ASSERT(reporter, !otherProxy);
// Release second ref from the original context
@ -1018,7 +1017,7 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte
// Now we should be able to borrow the texture from the other context
otherTestContext->makeCurrent();
otherProxy = as_IB(refImg)->asTextureProxyRef(otherCtx, GrSamplerState::ClampNearest(),
&texColorSpace, nullptr);
nullptr);
REPORTER_ASSERT(reporter, otherProxy);
// Release everything
@ -1067,9 +1066,8 @@ DEF_GPUTEST(SkImage_CrossContextGrayAlphaConfigs, reporter, options) {
sk_sp<SkImage> image = SkImage::MakeCrossContextFromPixmap(ctx, pixmap, false, nullptr);
REPORTER_ASSERT(reporter, image);
sk_sp<SkColorSpace> texColorSpace;
sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef(
ctx, GrSamplerState::ClampNearest(), &texColorSpace, nullptr);
ctx, GrSamplerState::ClampNearest(), nullptr);
REPORTER_ASSERT(reporter, proxy);
bool expectAlpha = kAlpha_8_SkColorType == ct;