diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-04-28 10:21:49 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-05-05 18:35:40 +0300 |
commit | f10839bac21a067bd4eff50a160223e5796a587e (patch) | |
tree | b5343d48c0227dfc34f85d232d9b4e0b21595c42 /src/mbgl/text/glyph_store.cpp | |
parent | 1455e5e53c1795401bec1b88272e93ce326d1753 (diff) | |
download | qtlocation-mapboxgl-f10839bac21a067bd4eff50a160223e5796a587e.tar.gz |
Make GlyphStore observable
GlyphStore will notify observers when a glyph range is loaded. By now
the notification is generic, but could be fine grained, causing the
processing of buckets depending on this particular range.
Diffstat (limited to 'src/mbgl/text/glyph_store.cpp')
-rw-r--r-- | src/mbgl/text/glyph_store.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mbgl/text/glyph_store.cpp b/src/mbgl/text/glyph_store.cpp index 1871908b02..aed162ade2 100644 --- a/src/mbgl/text/glyph_store.cpp +++ b/src/mbgl/text/glyph_store.cpp @@ -226,7 +226,13 @@ void GlyphPBF::parse(FontStack &stack) { data.clear(); } -GlyphStore::GlyphStore(Environment& env_) : env(env_), mtx(util::make_unique<uv::mutex>()) {} +GlyphStore::GlyphStore(Environment& env_) + : env(env_), mtx(util::make_unique<uv::mutex>()), observer(nullptr) { +} + +GlyphStore::~GlyphStore() { + observer = nullptr; +} void GlyphStore::setURL(const std::string &url) { glyphURL = url; @@ -289,5 +295,14 @@ uv::exclusive<FontStack> GlyphStore::getFontStack(const std::string &fontStack) return stack; } +void GlyphStore::setObserver(Observer* observer_) { + observer = observer_; +} + +void GlyphStore::emitGlyphRangeLoaded() { + if (observer) { + observer->onGlyphRangeLoaded(); + } +} } |