diff options
author | artemp <artem@mapnik.org> | 2014-10-27 12:35:17 -0400 |
---|---|---|
committer | artemp <artem@mapnik.org> | 2014-10-27 14:18:11 -0400 |
commit | 9364fd7322166578f6f0b7b57273db5a20bea2f7 (patch) | |
tree | f36ac8d81eb8a92c5e1e7f6daa8b5069eb954d01 /src/renderer | |
parent | 5508285424b68c6f0a26e70ede8e389715d02deb (diff) | |
download | qtlocation-mapboxgl-9364fd7322166578f6f0b7b57273db5a20bea2f7.tar.gz |
make addGlyphsToAtlas static method of SymbolBucket + add addGlyphs method to minimise number of mutex locking
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/symbol_bucket.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/renderer/symbol_bucket.cpp b/src/renderer/symbol_bucket.cpp index 47cc4db44c..7d5036eea3 100644 --- a/src/renderer/symbol_bucket.cpp +++ b/src/renderer/symbol_bucket.cpp @@ -34,18 +34,9 @@ bool SymbolBucket::hasTextData() const { return !text.groups.empty(); } bool SymbolBucket::hasIconData() const { return !icon.groups.empty(); } void SymbolBucket::addGlyphsToAtlas(uint64_t tileid, const std::string stackname, - const std::u32string &string, const FontStack &fontStack, + const std::u32string &text, const FontStack &fontStack, GlyphAtlas &glyphAtlas, GlyphPositions &face) { - const std::map<uint32_t, SDFGlyph> &sdfs = fontStack.getSDFs(); - // Loop through all characters and add glyph to atlas, positions. - for (uint32_t chr : string) { - auto sdf_it = sdfs.find(chr); - if (sdf_it != sdfs.end()) { - const SDFGlyph &sdf = sdf_it->second; - const Rect<uint16_t> rect = glyphAtlas.addGlyph(tileid, stackname, sdf); - face.emplace(chr, Glyph{rect, sdf.metrics}); - } - } + glyphAtlas.addGlyphs(tileid, text, stackname, fontStack,face); } std::vector<SymbolFeature> SymbolBucket::processFeatures(const VectorTileLayer &layer, @@ -150,8 +141,8 @@ void SymbolBucket::addFeatures(const VectorTileLayer &layer, const FilterExpress // Add the glyphs we need for this label to the glyph atlas. if (shaping.size()) { - addGlyphsToAtlas(id.to_uint64(), properties.text.font, feature.label, fontStack, - glyphAtlas, face); + SymbolBucket::addGlyphsToAtlas(id.to_uint64(), properties.text.font, feature.label, fontStack, + glyphAtlas, face); } } |