diff options
| author | Matthew Parlane <parlane@gmail.com> | 2014-03-10 09:24:09 +1300 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2014-03-10 09:24:09 +1300 |
| commit | 633dc75e857d649ffab7c4398e92536bccc9e1de (patch) | |
| tree | f9aa8831a0731ea246bd921d979f4bffa7f07bd0 /Source/Core/VideoCommon/TextureCacheBase.cpp | |
| parent | f4012638672472afdbd9956229f273a18a77fd77 (diff) | |
| parent | d802d392811be44d34ae9cd23f616db93e54c50f (diff) | |
Merge pull request #142 from Tilka/clang-modernize
Run clang-modernize and manually fix the result
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 9ea6fae5ad..c5f4f127f2 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -25,7 +25,7 @@ enum TextureCache *g_texture_cache; -GC_ALIGNED16(u8 *TextureCache::temp) = NULL; +GC_ALIGNED16(u8 *TextureCache::temp) = nullptr; unsigned int TextureCache::temp_size; TextureCache::TexCache TextureCache::textures; @@ -61,12 +61,10 @@ void TextureCache::RequestInvalidateTextureCache() void TextureCache::Invalidate() { - TexCache::iterator - iter = textures.begin(), - tcend = textures.end(); - for (; iter != tcend; ++iter) - delete iter->second; - + for (auto& tex : textures) + { + delete tex.second; + } textures.clear(); } @@ -74,7 +72,7 @@ TextureCache::~TextureCache() { Invalidate(); FreeAlignedMemory(temp); - temp = NULL; + temp = nullptr; } void TextureCache::OnConfigChanged(VideoConfig& config) @@ -336,7 +334,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int maxlevel, bool const from_tmem) { if (0 == address) - return NULL; + return nullptr; // TexelSizeInNibbles(format) * width * height / 16; const unsigned int bsw = TexDecoder_GetBlockWidthInTexels(texformat) - 1; @@ -433,7 +431,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { // delete the texture and make a new one delete entry; - entry = NULL; + entry = nullptr; } } @@ -454,7 +452,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, if(entry) { delete entry; - entry = NULL; + entry = nullptr; } } using_custom_texture = true; @@ -482,7 +480,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1; // TODO: Should be forced to 1 for non-pow2 textures (e.g. efb copies with automatically adjusted IR) // create the entry/texture - if (NULL == entry) + if (nullptr == entry) { textures[texID] = entry = g_texture_cache->CreateTexture(width, height, expandedWidth, texLevels, pcfmt); @@ -524,8 +522,8 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, { src_data += texture_size; - const u8* ptr_even = NULL; - const u8* ptr_odd = NULL; + const u8* ptr_even = nullptr; + const u8* ptr_odd = nullptr; if (from_tmem) { ptr_even = &texMem[bpmem.tex[stage/4].texImage1[stage%4].tmem_even * TMEM_LINE_SIZE + texture_size]; @@ -864,11 +862,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat { // remove it and recreate it as a render target delete entry; - entry = NULL; + entry = nullptr; } } - if (NULL == entry) + if (nullptr == entry) { // create the texture textures[dstAddr] = entry = g_texture_cache->CreateRenderTargetTexture(scaled_tex_w, scaled_tex_h); |
