Reland 6914 w/ fixes.
git-svn-id: http://skia.googlecode.com/svn/trunk@6916 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 92f5ad5..30d7ce4 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(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 @@
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 210d88e..1e1e508 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 @@
// 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;