| 659 | } |
| 660 | |
| 661 | void TextureCache::removeUnusedTextures() |
| 662 | { |
| 663 | for (auto it = _textures.cbegin(); it != _textures.cend(); /* nothing */) |
| 664 | { |
| 665 | Texture2D* tex = it->second; |
| 666 | if (tex->getReferenceCount() == 1) |
| 667 | { |
| 668 | AXLOGD("TextureCache: removing unused texture: {}", it->first); |
| 669 | |
| 670 | tex->release(); |
| 671 | it = _textures.erase(it); |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | ++it; |
| 676 | } |
| 677 | } |
| 678 | } |
| 679 | |
| 680 | void TextureCache::removeTexture(Texture2D* texture) |
| 681 | { |