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();