diff options
Diffstat (limited to 'src/gpu/effects')
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 21 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.h | 4 |
2 files changed, 13 insertions, 12 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 diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h index 22e2e4765c..c763599963 100644 --- a/src/gpu/effects/GrTextureStripAtlas.h +++ b/src/gpu/effects/GrTextureStripAtlas.h @@ -69,7 +69,7 @@ public: 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 @@ private: 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 |