Remove GrRenderable param from GrProxyProvider::createTextureProxy()

Every caller passes kNo.

Change-Id: I9c21c77f57f6215246794b39fc8ec485d4ae23d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234331
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2019-08-13 16:55:41 -04:00 committed by Skia Commit-Bot
parent f75996469d
commit 96b383a78c
18 changed files with 42 additions and 54 deletions

View File

@ -100,8 +100,8 @@ protected:
sk_sp<GrTextureProxy> proxies[3];
for (int i = 0; i < 3; ++i) {
proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
return DrawResult::kFail;
@ -219,8 +219,8 @@ protected:
sk_sp<GrTextureProxy> proxies[2];
for (int i = 0; i < 2; ++i) {
proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
return DrawResult::kFail;
@ -316,8 +316,8 @@ protected:
sk_sp<GrTextureProxy> proxies[3];
for (int i = 0; i < 3; ++i) {
proxies[i] = proxyProvider->createTextureProxy(fImage[i], GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
proxies[i] = proxyProvider->createTextureProxy(fImage[i], 1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!proxies[i]) {
*errorMsg = "Failed to create proxy";
return DrawResult::kFail;

View File

@ -149,8 +149,8 @@ static bool sw_draw_with_mask_filter(GrRecordingContext* context,
return false;
}
filteredMask = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kApprox);
filteredMask = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes,
SkBackingFit::kApprox);
if (!filteredMask) {
return false;
}

View File

@ -246,7 +246,6 @@ sk_sp<GrTextureProxy> GrProxyProvider::findOrCreateProxyByUniqueKey(const GrUniq
}
sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImage,
GrRenderable renderable,
int sampleCnt,
SkBudgeted budgeted,
SkBackingFit fit,
@ -261,7 +260,7 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag
const SkImageInfo& info = srcImage->imageInfo();
GrColorType ct = SkColorTypeToGrColorType(info.colorType());
GrBackendFormat format = this->caps()->getDefaultBackendFormat(ct, renderable);
GrBackendFormat format = this->caps()->getDefaultBackendFormat(ct, GrRenderable::kNo);
if (!format.isValid()) {
SkBitmap copy8888;
@ -272,19 +271,12 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag
copy8888.setImmutable();
srcImage = SkMakeImageFromRasterBitmap(copy8888, kNever_SkCopyPixelsMode);
ct = GrColorType::kRGBA_8888;
format = this->caps()->getDefaultBackendFormat(ct, renderable);
format = this->caps()->getDefaultBackendFormat(ct, GrRenderable::kNo);
if (!format.isValid()) {
return nullptr;
}
}
if (renderable == GrRenderable::kYes) {
sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, format);
if (!sampleCnt) {
return nullptr;
}
}
GrPixelConfig config = GrColorTypeToPixelConfig(ct);
if (kUnknown_GrPixelConfig == config) {
return nullptr;
@ -296,17 +288,17 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag
desc.fConfig = config;
sk_sp<GrTextureProxy> proxy = this->createLazyProxy(
[desc, format, renderable, sampleCnt, budgeted, srcImage, fit,
[desc, format, sampleCnt, budgeted, srcImage, fit,
ct](GrResourceProvider* resourceProvider) {
SkPixmap pixMap;
SkAssertResult(srcImage->peekPixels(&pixMap));
GrMipLevel mipLevel = { pixMap.addr(), pixMap.rowBytes() };
return LazyInstantiationResult(resourceProvider->createTexture(
desc, format, renderable, sampleCnt, budgeted, fit, GrProtected::kNo, ct,
mipLevel, GrResourceProvider::Flags::kNoPendingIO));
desc, format, GrRenderable::kNo, sampleCnt, budgeted, fit, GrProtected::kNo,
ct, mipLevel, GrResourceProvider::Flags::kNoPendingIO));
},
format, desc, renderable, sampleCnt, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
format, desc, GrRenderable::kNo, sampleCnt, kTopLeft_GrSurfaceOrigin, GrMipMapped::kNo,
GrMipMapsStatus::kNotAllocated, surfaceFlags, fit, budgeted, GrProtected::kNo);
if (!proxy) {
@ -377,8 +369,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxyFromBitmap(const SkBitmap& bit
// If mips weren't requested (or this was too small to have any), then take the fast path
if (GrMipMapped::kNo == mipMapped ||
0 == SkMipMap::ComputeLevelCount(baseLevel->width(), baseLevel->height())) {
return this->createTextureProxy(std::move(baseLevel), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
return this->createTextureProxy(std::move(baseLevel), 1, SkBudgeted::kYes,
SkBackingFit::kExact);
}
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bitmap.info());

View File

@ -65,7 +65,7 @@ public:
* actually upload the data to the gpu.
*/
sk_sp<GrTextureProxy> createTextureProxy(
sk_sp<SkImage> srcImage, GrRenderable, int sampleCnt, SkBudgeted, SkBackingFit,
sk_sp<SkImage> srcImage, int sampleCnt, SkBudgeted, SkBackingFit,
GrInternalSurfaceFlags = GrInternalSurfaceFlags::kNone);
/*

View File

@ -107,6 +107,6 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::toTextureProxy(GrRecordingContext* context
return nullptr;
}
return context->priv().proxyProvider()->createTextureProxy(std::move(img), GrRenderable::kNo, 1,
SkBudgeted::kYes, fit);
return context->priv().proxyProvider()->createTextureProxy(std::move(img), 1, SkBudgeted::kYes,
fit);
}

View File

@ -150,8 +150,8 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrRecordingContext* ctx,
dataStoragePtr);
auto proxyProvider = ctx->priv().proxyProvider();
yuvTextureProxies[i] = proxyProvider->createTextureProxy(yuvImage, GrRenderable::kNo, 1,
SkBudgeted::kYes, fit);
yuvTextureProxies[i] =
proxyProvider->createTextureProxy(yuvImage, 1, SkBudgeted::kYes, fit);
SkASSERT(yuvTextureProxies[i]->width() == yuvSizeInfo.fSizes[i].fWidth);
SkASSERT(yuvTextureProxies[i]->height() == yuvSizeInfo.fSizes[i].fHeight);

View File

@ -194,8 +194,7 @@ sk_sp<GrTextureProxy> GrMakeCachedImageProxy(GrProxyProvider* proxyProvider,
kTopLeft_GrSurfaceOrigin);
}
if (!proxy) {
proxy = proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes,
fit);
proxy = proxyProvider->createTextureProxy(srcImage, 1, SkBudgeted::kYes, fit);
if (proxy && originalKey.isValid()) {
proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get());
const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap();

View File

@ -248,7 +248,7 @@ uniform half4 circleData;
bm.setImmutable();
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
blurProfile = proxyProvider->createTextureProxy(std::move(image), 1,
SkBudgeted::kYes, SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;

View File

@ -65,7 +65,6 @@
sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(std::move(image),
GrRenderable::kNo,
1,
SkBudgeted::kYes,
SkBackingFit::kExact);

View File

@ -69,7 +69,7 @@ uniform half profileSize;
return nullptr;
}
blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo,
blurProfile = proxyProvider->createTextureProxy(std::move(image),
1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!blurProfile) {

View File

@ -225,8 +225,8 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrProxyProvider* proxyProvid
bm.setImmutable();
sk_sp<SkImage> image = SkImage::MakeFromBitmap(bm);
blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
}

View File

@ -69,7 +69,7 @@ public:
sk_sp<SkImage> image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
sk_sp<GrTextureProxy> dataProxy = proxyProvider->createTextureProxy(
std::move(image), GrRenderable::kNo, 1, SkBudgeted::kYes, SkBackingFit::kExact);
std::move(image), 1, SkBudgeted::kYes, SkBackingFit::kExact);
if (!dataProxy) {
return false;
}

View File

@ -49,8 +49,8 @@ public:
return nullptr;
}
blurProfile = proxyProvider->createTextureProxy(std::move(image), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
blurProfile = proxyProvider->createTextureProxy(std::move(image), 1, SkBudgeted::kYes,
SkBackingFit::kExact);
if (!blurProfile) {
return nullptr;
}

View File

@ -411,9 +411,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadOnlyTexture, reporter, context_info) {
REPORTER_ASSERT(reporter, gpuWriteResult == (ioType == kRW_GrIOType));
// Copies should not work with a read-only texture
auto copySrc = proxyProvider->createTextureProxy(
SkImage::MakeFromRaster(write, nullptr, nullptr), GrRenderable::kNo, 1,
SkBudgeted::kYes, SkBackingFit::kExact);
auto copySrc =
proxyProvider->createTextureProxy(SkImage::MakeFromRaster(write, nullptr, nullptr),
1, SkBudgeted::kYes, SkBackingFit::kExact);
REPORTER_ASSERT(reporter, copySrc);
auto copyResult = surfContext->testCopy(copySrc.get());
REPORTER_ASSERT(reporter, copyResult == (ioType == kRW_GrIOType));

View File

@ -202,8 +202,7 @@ DEF_TEST(ImageFilterCache_ImageBackedRaster, reporter) {
static sk_sp<GrTextureProxy> create_proxy(GrProxyProvider* proxyProvider) {
SkBitmap srcBM = create_bm();
sk_sp<SkImage> srcImage(SkImage::MakeFromBitmap(srcBM));
return proxyProvider->createTextureProxy(srcImage, GrRenderable::kNo, 1, SkBudgeted::kYes,
SkBackingFit::kExact);
return proxyProvider->createTextureProxy(srcImage, 1, SkBudgeted::kYes, SkBackingFit::kExact);
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ctxInfo) {

View File

@ -288,8 +288,8 @@ bool init_test_textures(GrResourceProvider* resourceProvider,
kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, rgbaData.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
proxies[0] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
SkBackingFit::kExact);
proxies[0] =
proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact);
proxies[0]->instantiate(resourceProvider);
}
@ -306,8 +306,8 @@ bool init_test_textures(GrResourceProvider* resourceProvider,
kAlpha_8_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, alphaData.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
proxies[1] = proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
SkBackingFit::kExact);
proxies[1] =
proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact);
proxies[1]->instantiate(resourceProvider);
}
@ -328,8 +328,7 @@ sk_sp<GrTextureProxy> make_input_texture(GrProxyProvider* proxyProvider, int wid
SkImageInfo ii = SkImageInfo::Make(width, height, kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkPixmap pixmap(ii, data.get(), ii.minRowBytes());
sk_sp<SkImage> img = SkImage::MakeRasterCopy(pixmap);
return proxyProvider->createTextureProxy(img, GrRenderable::kNo, 1, SkBudgeted::kYes,
SkBackingFit::kExact);
return proxyProvider->createTextureProxy(img, 1, SkBudgeted::kYes, SkBackingFit::kExact);
}
// We tag logged data as unpremul to avoid conversion when encoding as PNG. The input texture

View File

@ -70,7 +70,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
SkPixmap pixmap(ii, alphaData, ii.minRowBytes());
sk_sp<SkImage> alphaImg = SkImage::MakeRasterCopy(pixmap);
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
alphaImg, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
alphaImg, 1, SkBudgeted::kNo, SkBackingFit::kExact);
if (!proxy) {
ERRORF(reporter, "Could not create alpha texture.");
return;

View File

@ -221,7 +221,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
// gpu
sk_sp<SkImage> rasterImage = SkImage::MakeFromBitmap(bm);
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
rasterImage, 1, SkBudgeted::kNo, SkBackingFit::kExact);
if (!proxy) {
return;
}
@ -252,8 +252,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
SkBitmap bm = create_bm();
sk_sp<SkImage> rasterImage = SkImage::MakeFromBitmap(bm);
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
rasterImage, GrRenderable::kNo, 1, SkBudgeted::kNo, SkBackingFit::kExact);
sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(rasterImage, 1, SkBudgeted::kNo,
SkBackingFit::kExact);
if (!proxy) {
return;
}