| 791 | } |
| 792 | |
| 793 | void TextureCache::renameTextureWithKey(std::string_view srcName, std::string_view dstName) |
| 794 | { |
| 795 | auto it = _textures.find(srcName); |
| 796 | |
| 797 | if (it == _textures.end()) |
| 798 | { |
| 799 | auto key = FileUtils::getInstance()->fullPathForFilename(srcName); |
| 800 | it = _textures.find(key); |
| 801 | } |
| 802 | |
| 803 | if (it != _textures.end()) |
| 804 | { |
| 805 | std::string fullpath = FileUtils::getInstance()->fullPathForFilename(dstName); |
| 806 | Texture2D* tex = it->second; |
| 807 | |
| 808 | Image image; |
| 809 | bool ret = image.initWithImageFile(dstName); |
| 810 | if (ret) |
| 811 | { |
| 812 | tex->initWithImage(&image); |
| 813 | _textures.emplace(fullpath, tex); |
| 814 | _textures.erase(it); |
| 815 | } |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | #if AX_ENABLE_CACHE_TEXTURE_DATA |
| 820 |
nothing calls this directly
no test coverage detected