diff options
Diffstat (limited to 'src/mbgl/text')
-rw-r--r-- | src/mbgl/text/glyph_manager.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/text/glyph_manager.hpp | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mbgl/text/glyph_manager.cpp b/src/mbgl/text/glyph_manager.cpp index 3130418908..8e7cfe5ba7 100644 --- a/src/mbgl/text/glyph_manager.cpp +++ b/src/mbgl/text/glyph_manager.cpp @@ -5,6 +5,7 @@ #include <mbgl/storage/resource.hpp> #include <mbgl/storage/response.hpp> #include <mbgl/util/tiny_sdf.hpp> +#include <mbgl/util/std.hpp> namespace mbgl { @@ -153,4 +154,10 @@ void GlyphManager::removeRequestor(GlyphRequestor& requestor) { } } +void GlyphManager::evict(const std::set<FontStack>& keep) { + util::erase_if(entries, [&] (const auto& entry) { + return keep.count(entry.first) == 0; + }); +} + } // namespace mbgl diff --git a/src/mbgl/text/glyph_manager.hpp b/src/mbgl/text/glyph_manager.hpp index 84db2c4be5..642471bbf2 100644 --- a/src/mbgl/text/glyph_manager.hpp +++ b/src/mbgl/text/glyph_manager.hpp @@ -42,6 +42,9 @@ public: void setObserver(GlyphManagerObserver*); + // Remove glyphs for all but the supplied font stacks. + void evict(const std::set<FontStack>&); + private: Glyph generateLocalSDF(const FontStack& fontStack, GlyphID glyphID); |