diff options
author | 2012-08-16 14:49:16 +0000 | |
---|---|---|
committer | 2012-08-16 14:49:16 +0000 | |
commit | 1f47f4f7325971dd53991e2bb02da94fa7c6d962 (patch) | |
tree | a5b5dc02a15a3f3d4edeb921bda4ea1895f4ce77 /src/gpu/effects/GrTextureStripAtlas.cpp | |
parent | 71329d809a42889af8d2cadc4e43c60488a739a1 (diff) |
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
Diffstat (limited to 'src/gpu/effects/GrTextureStripAtlas.cpp')
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index 1a8a93b90a..a1a9d0301c 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -63,6 +63,7 @@ GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc) , fLockedRows(0) , fDesc(desc) , fNumRows(desc.fHeight / desc.fRowHeight) + , fTexture(NULL) , fRows(SkNEW_ARRAY(AtlasRow, fNumRows)) , fLRUFront(NULL) , fLRUBack(NULL) { @@ -139,7 +140,7 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) { // 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 @@ void GrTextureStripAtlas::lockTexture() { 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 @@ void GrTextureStripAtlas::validate() { // 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 |