Replaced TextureCacheEntry with GrTexture* and a back pointer to GrResourceEntry (in GrTexture)
http://codereview.appspot.com/6460089/
git-svn-id: http://skia.googlecode.com/svn/trunk@5122 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 1a8a93b..a1a9d03 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -63,6 +63,7 @@
, fLockedRows(0)
, fDesc(desc)
, fNumRows(desc.fHeight / desc.fRowHeight)
+ , fTexture(NULL)
, fRows(SkNEW_ARRAY(AtlasRow, fNumRows))
, fLRUFront(NULL)
, fLRUBack(NULL) {
@@ -139,7 +140,7 @@
// Pass in the kDontFlush flag, since we know we're writing to a part of this texture
// that is not currently in use
- fDesc.fContext->internalWriteTexturePixels(fEntry.texture(), 0,
+ fDesc.fContext->internalWriteTexturePixels(fTexture, 0,
rowNumber * fDesc.fRowHeight,
fDesc.fWidth,
fDesc.fRowHeight,
@@ -182,20 +183,20 @@
texDesc.fConfig = fDesc.fConfig;
GrCacheData cacheData(fCacheID);
cacheData.fResourceDomain = GetTextureStripAtlasDomain();
- fEntry = fDesc.fContext->findAndLockTexture(texDesc, cacheData, ¶ms);
- if (NULL == fEntry.texture()) {
- fEntry = fDesc.fContext->createAndLockTexture(¶ms, texDesc, cacheData, NULL, 0);
+ fTexture = fDesc.fContext->findAndLockTexture(texDesc, cacheData, ¶ms);
+ if (NULL == fTexture) {
+ fTexture = fDesc.fContext->createAndLockTexture(¶ms, texDesc, cacheData, NULL, 0);
// This is a new texture, so all of our cache info is now invalid
this->initLRU();
fKeyTable.rewind();
}
- GrAssert(NULL != fEntry.texture());
+ GrAssert(NULL != fTexture);
}
void GrTextureStripAtlas::unlockTexture() {
- GrAssert(NULL != fEntry.texture() && 0 == fLockedRows);
- fDesc.fContext->unlockTexture(fEntry);
- fEntry.reset();
+ GrAssert(NULL != fTexture && 0 == fLockedRows);
+ fDesc.fContext->unlockTexture(fTexture);
+ fTexture = NULL;
}
void GrTextureStripAtlas::initLRU() {
@@ -311,9 +312,9 @@
// If we have locked rows, we should have a locked texture, otherwise
// it should be unlocked
if (fLockedRows == 0) {
- GrAssert(NULL == fEntry.texture());
+ GrAssert(NULL == fTexture);
} else {
- GrAssert(NULL != fEntry.texture());
+ GrAssert(NULL != fTexture);
}
}
#endif