diff options
author | 2012-12-20 14:18:10 +0000 | |
---|---|---|
committer | 2012-12-20 14:18:10 +0000 | |
commit | 4b86e3428b115202e82d49a0914ea8ab6dc25940 (patch) | |
tree | d519732030f8abec0f9e8a31b4ce87c1035cfe3e /src/gpu/effects | |
parent | 9532953aa11289aea7c1fbd1438adca61a34bb24 (diff) |
Simplify cache IDs and keys.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6954047
git-svn-id: http://skia.googlecode.com/svn/trunk@6914 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 18 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index 92f5ad5c6f..30d7ce4d48 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -17,9 +17,6 @@ #define VALIDATE #endif -GR_DEFINE_RESOURCE_CACHE_DOMAIN(GrTextureStripAtlas, GetTextureStripAtlasDomain) - - int32_t GrTextureStripAtlas::gCacheCount = 0; GrTHashTable<GrTextureStripAtlas::AtlasEntry, @@ -73,7 +70,7 @@ GrTextureStripAtlas* GrTextureStripAtlas::GetAtlas(const GrTextureStripAtlas::De } GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc) - : fCacheID(sk_atomic_inc(&gCacheCount)) + : fCacheKey(sk_atomic_inc(&gCacheCount)) , fLockedRows(0) , fDesc(desc) , fNumRows(desc.fHeight / desc.fRowHeight) @@ -198,11 +195,16 @@ void GrTextureStripAtlas::lockTexture() { texDesc.fWidth = fDesc.fWidth; texDesc.fHeight = fDesc.fHeight; texDesc.fConfig = fDesc.fConfig; - GrCacheData cacheData(fCacheID); - cacheData.fResourceDomain = GetTextureStripAtlasDomain(); - fTexture = fDesc.fContext->findTexture(texDesc, cacheData, ¶ms); + + static const GrCacheID::Domain gTextureStripAtlasDomain = GrCacheID::GenerateDomain(); + GrCacheID::Key key; + *key.fData32 = fCacheKey; + memset(key.fData32 + 1, 0, sizeof(key) - sizeof(uint32_t)); + GrCacheID cacheID(gTextureStripAtlasDomain, key); + + fTexture = fDesc.fContext->findTexture(texDesc, cacheID, ¶ms); if (NULL == fTexture) { - fTexture = fDesc.fContext->createTexture(¶ms, texDesc, cacheData, NULL, 0); + fTexture = fDesc.fContext->createTexture(¶ms, texDesc, cacheID, NULL, 0); // This is a new texture, so all of our cache info is now invalid this->initLRU(); fKeyTable.rewind(); diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h index 210d88ec90..1e1e5088c7 100644 --- a/src/gpu/effects/GrTextureStripAtlas.h +++ b/src/gpu/effects/GrTextureStripAtlas.h @@ -21,8 +21,6 @@ */ class GrTextureStripAtlas { public: - GR_DECLARE_RESOURCE_CACHE_DOMAIN(GetTextureStripAtlasDomain) - /** * Descriptor struct which we'll use as a hash table key **/ @@ -157,7 +155,7 @@ private: // A unique ID for this texture (formed with: gCacheCount++), so we can be sure that if we // get a texture back from the texture cache, that it's the same one we last used. - const uint64_t fCacheID; + const int32_t fCacheKey; // Total locks on all rows (when this reaches zero, we can unlock our texture) int32_t fLockedRows; |