diff options
author | halcanary <halcanary@google.com> | 2015-08-27 07:41:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-27 07:41:16 -0700 |
commit | 96fcdcc219d2a0d3579719b84b28bede76efba64 (patch) | |
tree | 0ec5ea0193d8292df8bf5ed9dd8498a5eb5763dd /src/gpu/effects/GrTextureStripAtlas.cpp | |
parent | 435af2f736c85c3274a0c6760a3523810750d237 (diff) |
Style Change: NULL->nullptr
DOCS_PREVIEW= https://skia.org/?cl=1316233002
Review URL: https://codereview.chromium.org/1316233002
Diffstat (limited to 'src/gpu/effects/GrTextureStripAtlas.cpp')
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp index 6aeaf6f184..ca688d821b 100644 --- a/src/gpu/effects/GrTextureStripAtlas.cpp +++ b/src/gpu/effects/GrTextureStripAtlas.cpp @@ -22,11 +22,11 @@ class GrTextureStripAtlas::Hash : public SkTDynamicHash<GrTextureStripAtlas::Atl int32_t GrTextureStripAtlas::gCacheCount = 0; -GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = NULL; +GrTextureStripAtlas::Hash* GrTextureStripAtlas::gAtlasCache = nullptr; GrTextureStripAtlas::Hash* GrTextureStripAtlas::GetCache() { - if (NULL == gAtlasCache) { + if (nullptr == gAtlasCache) { gAtlasCache = new Hash; } @@ -47,13 +47,13 @@ void GrTextureStripAtlas::CleanUp(const GrContext*, void* info) { if (0 == GetCache()->count()) { delete gAtlasCache; - gAtlasCache = NULL; + gAtlasCache = nullptr; } } GrTextureStripAtlas* GrTextureStripAtlas::GetAtlas(const GrTextureStripAtlas::Desc& desc) { AtlasEntry* entry = GetCache()->find(desc); - if (NULL == entry) { + if (nullptr == entry) { entry = new AtlasEntry; entry->fAtlas = new GrTextureStripAtlas(desc); @@ -72,10 +72,10 @@ GrTextureStripAtlas::GrTextureStripAtlas(GrTextureStripAtlas::Desc desc) , fLockedRows(0) , fDesc(desc) , fNumRows(desc.fHeight / desc.fRowHeight) - , fTexture(NULL) + , fTexture(nullptr) , fRows(new AtlasRow[fNumRows]) - , fLRUFront(NULL) - , fLRUBack(NULL) { + , fLRUFront(nullptr) + , fLRUBack(nullptr) { SkASSERT(fNumRows * fDesc.fRowHeight == fDesc.fHeight); this->initLRU(); fNormalizedYHeight = SK_Scalar1 / fDesc.fHeight; @@ -118,11 +118,11 @@ int GrTextureStripAtlas::lockRow(const SkBitmap& data) { ++fLockedRows; - if (NULL == row) { + if (nullptr == row) { // force a flush, which should unlock all the rows; then try again fDesc.fContext->flush(); row = this->getLRU(); - if (NULL == row) { + if (nullptr == row) { --fLockedRows; return -1; } @@ -201,8 +201,8 @@ void GrTextureStripAtlas::lockTexture() { builder.finish(); fTexture = fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key); - if (NULL == fTexture) { - fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, true, NULL, 0); + if (nullptr == fTexture) { + fTexture = fDesc.fContext->textureProvider()->createTexture(texDesc, true, nullptr, 0); if (!fTexture) { return; } @@ -217,26 +217,26 @@ void GrTextureStripAtlas::lockTexture() { void GrTextureStripAtlas::unlockTexture() { SkASSERT(fTexture && 0 == fLockedRows); fTexture->unref(); - fTexture = NULL; + fTexture = nullptr; } void GrTextureStripAtlas::initLRU() { - fLRUFront = NULL; - fLRUBack = NULL; + fLRUFront = nullptr; + fLRUBack = nullptr; // Initially all the rows are in the LRU list for (int i = 0; i < fNumRows; ++i) { fRows[i].fKey = kEmptyAtlasRowKey; - fRows[i].fNext = NULL; - fRows[i].fPrev = NULL; + fRows[i].fNext = nullptr; + fRows[i].fPrev = nullptr; this->appendLRU(fRows + i); } - SkASSERT(NULL == fLRUFront || NULL == fLRUFront->fPrev); - SkASSERT(NULL == fLRUBack || NULL == fLRUBack->fNext); + SkASSERT(nullptr == fLRUFront || nullptr == fLRUFront->fPrev); + SkASSERT(nullptr == fLRUBack || nullptr == fLRUBack->fNext); } void GrTextureStripAtlas::appendLRU(AtlasRow* row) { - SkASSERT(NULL == row->fPrev && NULL == row->fNext); - if (NULL == fLRUFront && NULL == fLRUBack) { + SkASSERT(nullptr == row->fPrev && nullptr == row->fNext); + if (nullptr == fLRUFront && nullptr == fLRUBack) { fLRUFront = row; fLRUBack = row; } else { @@ -252,23 +252,23 @@ void GrTextureStripAtlas::removeFromLRU(AtlasRow* row) { row->fPrev->fNext = row->fNext; row->fNext->fPrev = row->fPrev; } else { - if (NULL == row->fNext) { + if (nullptr == row->fNext) { SkASSERT(row == fLRUBack); fLRUBack = row->fPrev; if (fLRUBack) { - fLRUBack->fNext = NULL; + fLRUBack->fNext = nullptr; } } - if (NULL == row->fPrev) { + if (nullptr == row->fPrev) { SkASSERT(row == fLRUFront); fLRUFront = row->fNext; if (fLRUFront) { - fLRUFront->fPrev = NULL; + fLRUFront->fPrev = nullptr; } } } - row->fNext = NULL; - row->fPrev = NULL; + row->fNext = nullptr; + row->fPrev = nullptr; } int GrTextureStripAtlas::searchByKey(uint32_t key) { @@ -294,10 +294,10 @@ void GrTextureStripAtlas::validate() { int lruCount = 0; // Validate LRU pointers, and count LRU entries - SkASSERT(NULL == fLRUFront || NULL == fLRUFront->fPrev); - SkASSERT(NULL == fLRUBack || NULL == fLRUBack->fNext); - for (AtlasRow* r = fLRUFront; r != NULL; r = r->fNext) { - if (NULL == r->fNext) { + SkASSERT(nullptr == fLRUFront || nullptr == fLRUFront->fPrev); + SkASSERT(nullptr == fLRUBack || nullptr == fLRUBack->fNext); + for (AtlasRow* r = fLRUFront; r != nullptr; r = r->fNext) { + if (nullptr == r->fNext) { SkASSERT(r == fLRUBack); } else { SkASSERT(r->fNext->fPrev == r); @@ -314,7 +314,7 @@ void GrTextureStripAtlas::validate() { ++freeRows; bool inLRU = false; // Step through the LRU and make sure it's present - for (AtlasRow* r = fLRUFront; r != NULL; r = r->fNext) { + for (AtlasRow* r = fLRUFront; r != nullptr; r = r->fNext) { if (r == &fRows[i]) { inLRU = true; break; @@ -341,7 +341,7 @@ void GrTextureStripAtlas::validate() { // If we have locked rows, we should have a locked texture, otherwise // it should be unlocked if (fLockedRows == 0) { - SkASSERT(NULL == fTexture); + SkASSERT(nullptr == fTexture); } else { SkASSERT(fTexture); } |