Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: src/gpu/GrTexture.cpp

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/GrTexturePriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 378e9900f7cf805362d63b76c1fce0498772cb50..30dbbb659a32558b06e53b57384d1466a3c1ec5e 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -66,42 +66,7 @@ void GrTexture::validateDesc() const {
//////////////////////////////////////////////////////////////////////////////
-// These flags need to fit in a GrResourceKey::ResourceFlags so they can be folded into the texture
-// key
-enum TextureFlags {
- /**
- * The kStretchToPOT bit is set when the texture is NPOT and is being repeated but the
- * hardware doesn't support that feature.
- */
- kStretchToPOT_TextureFlag = 0x1,
- /**
- * The kBilerp bit can only be set when the kStretchToPOT flag is set and indicates whether the
- * stretched texture should be bilerped.
- */
- kBilerp_TextureFlag = 0x2,
-};
-
namespace {
-GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu,
- const GrTextureParams* params,
- const GrSurfaceDesc& desc) {
- GrResourceKey::ResourceFlags flags = 0;
- bool tiled = params && params->isTiled();
- if (tiled && !gpu->caps()->npotTextureTileSupport()) {
- if (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight)) {
- flags |= kStretchToPOT_TextureFlag;
- switch(params->filterMode()) {
- case GrTextureParams::kNone_FilterMode:
- break;
- case GrTextureParams::kBilerp_FilterMode:
- case GrTextureParams::kMipMap_FilterMode:
- flags |= kBilerp_TextureFlag;
- break;
- }
- }
- }
- return flags;
-}
// FIXME: This should be refactored with the code in gl/GrGLGpu.cpp.
GrSurfaceOrigin resolve_origin(const GrSurfaceDesc& desc) {
@@ -132,14 +97,6 @@ GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc)
fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
}
-GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu,
- const GrTextureParams* params,
- const GrSurfaceDesc& desc,
- const GrCacheID& cacheID) {
- GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc);
- return GrResourceKey(cacheID, flags);
-}
-
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
@@ -158,11 +115,3 @@ void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* k
builder[0] = desc.fWidth | (desc.fHeight << 16);
builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
}
-
-bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) {
- return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
-}
-
-bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) {
- return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
-}
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.cpp ('k') | src/gpu/GrTexturePriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698