MCPcopy Create free account
hub / github.com/axmolengine/axmol / renameTextureWithKey

Method renameTextureWithKey

core/renderer/TextureCache.cpp:793–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793void 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

Callers

nothing calls this directly

Calls 8

getInstanceFunction · 0.85
fullPathForFilenameMethod · 0.80
initWithImageFileMethod · 0.80
initWithImageMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emplaceMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected