Index: src/gpu/effects/GrTextureStripAtlas.cpp |
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp |
index 6aeaf6f1844f4f23ba985cb6419897bccb3117b9..ca688d821be04bfc5ab1735499fdf0fc6dce2698 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); |
} |