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, &params);
-    if (NULL == fEntry.texture()) {
-        fEntry = fDesc.fContext->createAndLockTexture(&params, texDesc, cacheData, NULL, 0);
+    fTexture = fDesc.fContext->findAndLockTexture(texDesc, cacheData, &params);
+    if (NULL == fTexture) {
+        fTexture = fDesc.fContext->createAndLockTexture(&params, 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
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index 22e2e47..c763599 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -69,7 +69,7 @@
     GrScalar getVerticalScaleFactor() const { return SkIntToScalar(fDesc.fRowHeight) / fDesc.fHeight; }
 
     GrContext* getContext() const { return fDesc.fContext; }
-    GrTexture* getTexture() const { return fEntry.texture(); }
+    GrTexture* getTexture() const { return fTexture; }
 
 private:
 
@@ -141,7 +141,7 @@
 
     const Desc fDesc;
     const uint16_t fNumRows;
-    GrContext::TextureCacheEntry fEntry;
+    GrTexture* fTexture;
 
     // Array of AtlasRows which store the state of all our rows. Stored in a contiguous array, in
     // order that they appear in our texture, this means we can subtract this pointer from a row