diff options
| author | Lioncash <mathew1800@gmail.com> | 2015-12-29 07:21:51 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2015-12-29 08:40:15 -0500 |
| commit | 1d01fbd2175968dea6e7e0fcf4ba6bfb83bf32b8 (patch) | |
| tree | 7a8b28396b10e1b5f362c83ddfdc8332e34dec25 /Source/Core/VideoCommon/HiresTextures.cpp | |
| parent | 6a9e4511b569e6390cfd7706861c79af1229ec15 (diff) | |
HiresTextures: Make Load return a unique_ptr
Diffstat (limited to 'Source/Core/VideoCommon/HiresTextures.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index a552b63f39..60123b9cce 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -167,11 +167,11 @@ void HiresTexture::Prefetch() // But bad luck, SOIL isn't, so TODO: remove SOIL usage here and use libpng directly // Also TODO: remove s_textureCacheAquireMutex afterwards. It won't be needed as the main mutex will be locked rarely //lk.unlock(); - HiresTexture* t = Load(base_filename, 0, 0); + std::unique_ptr<HiresTexture> texture = Load(base_filename, 0, 0); //lk.lock(); - if (t) + if (texture) { - std::shared_ptr<HiresTexture> ptr(t); + std::shared_ptr<HiresTexture> ptr(std::move(texture)); iter = s_textureCache.insert(iter, std::make_pair(base_filename, ptr)); } } @@ -366,9 +366,9 @@ std::shared_ptr<HiresTexture> HiresTexture::Search(const u8* texture, size_t tex return ptr; } -HiresTexture* HiresTexture::Load(const std::string& base_filename, u32 width, u32 height) +std::unique_ptr<HiresTexture> HiresTexture::Load(const std::string& base_filename, u32 width, u32 height) { - HiresTexture* ret = nullptr; + std::unique_ptr<HiresTexture> ret; for (int level = 0;; level++) { std::string filename = base_filename; @@ -420,7 +420,7 @@ HiresTexture* HiresTexture::Load(const std::string& base_filename, u32 width, u3 height >>= 1; if (!ret) - ret = new HiresTexture(); + ret = std::unique_ptr<HiresTexture>(new HiresTexture); ret->m_levels.push_back(l); } else |
