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

Method reloadTexture

core/renderer/TextureCache.cpp:612–648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

610}
611
612bool TextureCache::reloadTexture(std::string_view fileName)
613{
614 Texture2D* texture = nullptr;
615
616 std::string fullpath = FileUtils::getInstance()->fullPathForFilename(fileName);
617 if (fullpath.empty())
618 {
619 return false;
620 }
621
622 auto it = _textures.find(fullpath);
623 if (it != _textures.end())
624 {
625 texture = it->second;
626 }
627
628 bool ret = false;
629 if (!texture)
630 {
631 texture = this->addImage(fullpath);
632 ret = (texture != nullptr);
633 }
634 else
635 {
636 do
637 {
638 Image image;
639
640 bool bRet = image.initWithImageFile(fullpath);
641 AX_BREAK_IF(!bRet);
642
643 ret = texture->initWithImage(&image);
644 } while (0);
645 }
646
647 return ret;
648}
649
650// TextureCache - Remove
651

Callers

nothing calls this directly

Calls 8

addImageMethod · 0.95
getInstanceFunction · 0.85
fullPathForFilenameMethod · 0.80
initWithImageFileMethod · 0.80
initWithImageMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected