| 610 | } |
| 611 | |
| 612 | bool 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 |
nothing calls this directly
no test coverage detected