Remove unused code resulted from deleting DeferredTextureImage
Bug: skia: Change-Id: Iaedc09880bd6a2d8fda4ce52f1644a944dd72605 Reviewed-on: https://skia-review.googlesource.com/106266 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
dfb3a16960
commit
3081508215
@ -572,10 +572,6 @@ private:
|
||||
SkImage(int width, int height, uint32_t uniqueID);
|
||||
friend class SkImage_Base;
|
||||
|
||||
static sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&,
|
||||
const GrMipLevel texels[], int mipLevelCount,
|
||||
SkBudgeted, SkDestinationSurfaceColorMode);
|
||||
|
||||
const int fWidth;
|
||||
const int fHeight;
|
||||
const uint32_t fUniqueID;
|
||||
|
@ -244,62 +244,19 @@ sk_sp<GrTextureProxy> GrProxyProvider::createTextureProxy(sk_sp<SkImage> srcImag
|
||||
return proxy;
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(
|
||||
const GrSurfaceDesc& desc, SkBudgeted budgeted,
|
||||
const GrMipLevel texels[], int mipLevelCount,
|
||||
SkDestinationSurfaceColorMode mipColorMode) {
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(const GrSurfaceDesc& desc,
|
||||
SkBudgeted budgeted) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
|
||||
if (this->isAbandoned()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mipLevelCount) {
|
||||
if (texels) {
|
||||
return nullptr;
|
||||
}
|
||||
return this->createProxy(desc, SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
if (!texels) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (1 == mipLevelCount) {
|
||||
return this->createTextureProxy(desc, budgeted, texels[0].fPixels, texels[0].fRowBytes);
|
||||
}
|
||||
|
||||
#ifdef SK_DEBUG
|
||||
// There are only three states we want to be in when uploading data to a mipped surface.
|
||||
// 1) We have data to upload to all layers
|
||||
// 2) We are not uploading data to any layers
|
||||
// 3) We are only uploading data to the base layer
|
||||
// We check here to make sure we do not have any other state.
|
||||
bool firstLevelHasData = SkToBool(texels[0].fPixels);
|
||||
bool allOtherLevelsHaveData = true, allOtherLevelsLackData = true;
|
||||
for (int i = 1; i < mipLevelCount; ++i) {
|
||||
if (texels[i].fPixels) {
|
||||
allOtherLevelsLackData = false;
|
||||
} else {
|
||||
allOtherLevelsHaveData = false;
|
||||
}
|
||||
}
|
||||
SkASSERT((firstLevelHasData && allOtherLevelsHaveData) || allOtherLevelsLackData);
|
||||
#endif
|
||||
|
||||
sk_sp<GrTexture> tex(fResourceProvider->createTexture(desc, budgeted,
|
||||
texels, mipLevelCount,
|
||||
mipColorMode));
|
||||
if (!tex) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->createWrapped(std::move(tex), desc.fOrigin);
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(const GrSurfaceDesc& desc,
|
||||
SkBudgeted budgeted) {
|
||||
// SkMipMap doesn't include the base level in the level count so we have to add 1
|
||||
int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
|
||||
if (1 == mipCount) {
|
||||
return this->createProxy(desc, SkBackingFit::kExact, budgeted);
|
||||
}
|
||||
|
||||
std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[mipCount]);
|
||||
|
||||
@ -309,8 +266,14 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(const GrSurfaceDesc& de
|
||||
texels[i].fRowBytes = 0;
|
||||
}
|
||||
|
||||
return this->createMipMapProxy(desc, budgeted, texels.get(), mipCount,
|
||||
SkDestinationSurfaceColorMode::kLegacy);
|
||||
sk_sp<GrTexture> tex(fResourceProvider->createTexture(desc, budgeted,
|
||||
texels.get(), mipCount,
|
||||
SkDestinationSurfaceColorMode::kLegacy));
|
||||
if (!tex) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->createWrapped(std::move(tex), desc.fOrigin);
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitmap& bitmap,
|
||||
|
@ -88,19 +88,6 @@ public:
|
||||
SkBudgeted budgeted,
|
||||
SkBackingFit fit);
|
||||
|
||||
/*
|
||||
* Create a mipmapped texture proxy with data.
|
||||
*
|
||||
* @param desc Description of the texture properties.
|
||||
* @param budgeted Does the texture count against the resource cache budget?
|
||||
* @param texels A contiguous array of mipmap levels
|
||||
* @param mipLevelCount The amount of elements in the texels array
|
||||
*/
|
||||
sk_sp<GrTextureProxy> createMipMapProxy(const GrSurfaceDesc&, SkBudgeted,
|
||||
const GrMipLevel texels[], int mipLevelCount,
|
||||
SkDestinationSurfaceColorMode mipColorMode =
|
||||
SkDestinationSurfaceColorMode::kLegacy);
|
||||
|
||||
/*
|
||||
* Create a mipmapped texture proxy without any data.
|
||||
*
|
||||
|
@ -156,22 +156,6 @@ sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext* ctx, GrTexturePr
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
||||
sk_sp<GrTextureProxy> GrUploadMipMapToTextureProxy(GrProxyProvider* proxyProvider,
|
||||
const SkImageInfo& info,
|
||||
const GrMipLevel texels[],
|
||||
int mipLevelCount,
|
||||
SkDestinationSurfaceColorMode colorMode) {
|
||||
if (!SkImageInfoIsValid(info, colorMode)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrSurfaceDesc desc(GrImageInfoToSurfaceDesc(info, *proxyProvider->caps()));
|
||||
|
||||
return proxyProvider->createMipMapProxy(desc, SkBudgeted::kYes,
|
||||
texels, mipLevelCount, colorMode);
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> GrRefCachedBitmapTextureProxy(GrContext* ctx,
|
||||
const SkBitmap& bitmap,
|
||||
const GrSamplerState& params,
|
||||
|
@ -220,14 +220,6 @@ sk_sp<GrTextureProxy> GrUploadPixmapToTextureProxy(GrProxyProvider*,
|
||||
sk_sp<GrTextureProxy> GrCopyBaseMipMapToTextureProxy(GrContext*,
|
||||
GrTextureProxy* baseProxy);
|
||||
|
||||
/**
|
||||
* Creates a new texture populated with the mipmap levels.
|
||||
*/
|
||||
sk_sp<GrTextureProxy> GrUploadMipMapToTextureProxy(GrProxyProvider*, const SkImageInfo&,
|
||||
const GrMipLevel texels[],
|
||||
int mipLevelCount,
|
||||
SkDestinationSurfaceColorMode colorMode);
|
||||
|
||||
/*
|
||||
* Create a texture proxy from the provided bitmap by wrapping it in an image and calling
|
||||
* GrMakeCachedImageProxy.
|
||||
|
@ -343,11 +343,6 @@ sk_sp<SkImage> SkImage::makeRasterImage() const {
|
||||
|
||||
#if !SK_SUPPORT_GPU
|
||||
|
||||
sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, const GrMipLevel texels[],
|
||||
int mipLevelCount, SkBudgeted, SkDestinationSurfaceColorMode) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx,
|
||||
const GrBackendTexture& tex, GrSurfaceOrigin origin,
|
||||
SkAlphaType at, sk_sp<SkColorSpace> cs,
|
||||
@ -399,13 +394,6 @@ sk_sp<SkImage> SkImage::makeTextureImage(GrContext*, SkColorSpace* dstColorSpace
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, const GrMipLevel texels[],
|
||||
int mipLevelCount, SkBudgeted) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkImage_pinAsTexture(const SkImage* image, GrContext* ctx) {
|
||||
SkASSERT(image);
|
||||
SkASSERT(ctx);
|
||||
|
@ -733,35 +733,6 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext* ctx,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& info,
|
||||
const GrMipLevel texels[], int mipLevelCount,
|
||||
SkBudgeted budgeted,
|
||||
SkDestinationSurfaceColorMode colorMode) {
|
||||
SkASSERT(mipLevelCount >= 1);
|
||||
if (!ctx) {
|
||||
return nullptr;
|
||||
}
|
||||
GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider();
|
||||
|
||||
// For images where the client is passing the mip data we require that all the mip levels have
|
||||
// valid data.
|
||||
for (int i = 0; i < mipLevelCount; ++i) {
|
||||
if (!texels[i].fPixels) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
sk_sp<GrTextureProxy> proxy(GrUploadMipMapToTextureProxy(proxyProvider, info,
|
||||
texels, mipLevelCount, colorMode));
|
||||
if (!proxy) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkASSERT(proxy->priv().isExact());
|
||||
return sk_make_sp<SkImage_Gpu>(ctx, kNeedNewImageUniqueID,
|
||||
info.alphaType(), std::move(proxy),
|
||||
info.refColorSpace(), budgeted);
|
||||
}
|
||||
|
||||
sk_sp<SkImage> SkImage_Gpu::onMakeColorSpace(sk_sp<SkColorSpace> target, SkColorType,
|
||||
SkTransferFunctionBehavior premulBehavior) const {
|
||||
if (SkTransferFunctionBehavior::kRespect == premulBehavior) {
|
||||
|
@ -104,16 +104,6 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
|
||||
desc.fWidth = 64;
|
||||
desc.fHeight = 64;
|
||||
|
||||
// Enough space for the first mip of our largest pixel config
|
||||
const size_t pixelBufferSize = desc.fWidth * desc.fHeight *
|
||||
GrBytesPerPixel(kRGBA_float_GrPixelConfig);
|
||||
std::unique_ptr<char[]> pixelData(new char[pixelBufferSize]);
|
||||
memset(pixelData.get(), 0, pixelBufferSize);
|
||||
|
||||
// We re-use the same mip level objects (with updated pointers and rowBytes) for each config
|
||||
const int levelCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
|
||||
std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[levelCount]);
|
||||
|
||||
for (GrPixelConfig config : configs) {
|
||||
for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
|
||||
desc.fFlags = kNone_GrSurfaceFlags;
|
||||
@ -126,15 +116,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(GrSurfaceRenderability, reporter, ctxInfo) {
|
||||
REPORTER_ASSERT(reporter, SkToBool(tex) == ict,
|
||||
"config:%d, tex:%d, isConfigTexturable:%d", config, SkToBool(tex), ict);
|
||||
|
||||
size_t rowBytes = desc.fWidth * GrBytesPerPixel(desc.fConfig);
|
||||
for (int i = 0; i < levelCount; ++i) {
|
||||
texels[i].fPixels = pixelData.get();
|
||||
texels[i].fRowBytes = rowBytes >> i;
|
||||
}
|
||||
|
||||
sk_sp<GrTextureProxy> proxy = proxyProvider->createMipMapProxy(
|
||||
desc, SkBudgeted::kNo,
|
||||
texels.get(), levelCount);
|
||||
desc, SkBudgeted::kNo);
|
||||
REPORTER_ASSERT(reporter, SkToBool(proxy.get()) ==
|
||||
(caps->isConfigTexturable(desc.fConfig) &&
|
||||
caps->mipMapSupport()));
|
||||
|
@ -1659,29 +1659,6 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrProxyProvider* proxyProvider,
|
||||
GrSurfaceFlags flags,
|
||||
int width, int height,
|
||||
int sampleCnt) {
|
||||
SkBitmap bm;
|
||||
|
||||
bm.allocN32Pixels(width, height, true);
|
||||
bm.eraseColor(SK_ColorBLUE);
|
||||
|
||||
sk_sp<SkMipMap> mipmaps(SkMipMap::Build(bm, SkDestinationSurfaceColorMode::kLegacy, nullptr));
|
||||
SkASSERT(mipmaps);
|
||||
SkASSERT(mipmaps->countLevels() > 1);
|
||||
|
||||
int mipLevelCount = mipmaps->countLevels() + 1;
|
||||
|
||||
std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[mipLevelCount]);
|
||||
|
||||
texels[0].fPixels = bm.getPixels();
|
||||
texels[0].fRowBytes = bm.rowBytes();
|
||||
|
||||
for (int i = 1; i < mipLevelCount; ++i) {
|
||||
SkMipMap::Level generatedMipLevel;
|
||||
mipmaps->getLevel(i - 1, &generatedMipLevel);
|
||||
texels[i].fPixels = generatedMipLevel.fPixmap.addr();
|
||||
texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes();
|
||||
}
|
||||
|
||||
GrSurfaceDesc desc;
|
||||
desc.fFlags = flags;
|
||||
desc.fOrigin = (flags & kRenderTarget_GrSurfaceFlag) ? kBottomLeft_GrSurfaceOrigin
|
||||
@ -1691,7 +1668,7 @@ static sk_sp<GrTextureProxy> make_mipmap_proxy(GrProxyProvider* proxyProvider,
|
||||
desc.fConfig = kRGBA_8888_GrPixelConfig;
|
||||
desc.fSampleCnt = sampleCnt;
|
||||
|
||||
return proxyProvider->createMipMapProxy(desc, SkBudgeted::kYes, texels.get(), mipLevelCount);
|
||||
return proxyProvider->createMipMapProxy(desc, SkBudgeted::kYes);
|
||||
}
|
||||
|
||||
// Exercise GrSurface::gpuMemorySize for different combos of MSAA, RT-only,
|
||||
|
Loading…
Reference in New Issue
Block a user