diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-10-18 17:57:04 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-10-23 12:23:40 +0200 |
commit | 70d5972e104aac91f4198540d4af14562e92d555 (patch) | |
tree | 83e92385784d2c89df052690cd3a15ad1ca3eb01 /src/mbgl/text | |
parent | 282c71e8e9a8ec9c2eab612f2e60a71b15d24c8a (diff) | |
download | qtlocation-mapboxgl-70d5972e104aac91f4198540d4af14562e92d555.tar.gz |
[core] don't use <boost/functional/hash.hpp> to avoid <locale> include
Diffstat (limited to 'src/mbgl/text')
-rw-r--r-- | src/mbgl/text/glyph.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/text/glyph_manager.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/glyph_range.hpp | 21 |
3 files changed, 15 insertions, 12 deletions
diff --git a/src/mbgl/text/glyph.hpp b/src/mbgl/text/glyph.hpp index 55cd50fd9b..034784dc24 100644 --- a/src/mbgl/text/glyph.hpp +++ b/src/mbgl/text/glyph.hpp @@ -115,7 +115,7 @@ MBGL_CONSTEXPR WritingModeType operator~(WritingModeType value) { return WritingModeType(~mbgl::underlying_type(value)); } -using GlyphDependencies = std::map<FontStack,GlyphIDs>; -using GlyphRangeDependencies = std::map<FontStack,GlyphRangeSet>; +using GlyphDependencies = std::map<FontStack, GlyphIDs>; +using GlyphRangeDependencies = std::map<FontStack, std::unordered_set<GlyphRange>>; } // end namespace mbgl diff --git a/src/mbgl/text/glyph_manager.cpp b/src/mbgl/text/glyph_manager.cpp index c4a7a2de66..b947ef72c8 100644 --- a/src/mbgl/text/glyph_manager.cpp +++ b/src/mbgl/text/glyph_manager.cpp @@ -31,7 +31,7 @@ void GlyphManager::getGlyphs(GlyphRequestor& requestor, GlyphDependencies glyphD Entry& entry = entries[fontStack]; const GlyphIDs& glyphIDs = dependency.second; - GlyphRangeSet ranges; + std::unordered_set<GlyphRange> ranges; for (const auto& glyphID : glyphIDs) { if (localGlyphRasterizer->canRasterizeGlyph(fontStack, glyphID)) { if (entry.glyphs.find(glyphID) == entry.glyphs.end()) { diff --git a/src/mbgl/text/glyph_range.hpp b/src/mbgl/text/glyph_range.hpp index 74afb73dfc..35a1f74b94 100644 --- a/src/mbgl/text/glyph_range.hpp +++ b/src/mbgl/text/glyph_range.hpp @@ -3,21 +3,24 @@ #include <utility> #include <cstdint> #include <unordered_set> -#include <boost/functional/hash.hpp> +#include <mbgl/util/hash.hpp> namespace mbgl { using GlyphRange = std::pair<uint16_t, uint16_t>; -struct GlyphRangeHash { - std::size_t operator()(const GlyphRange& glyphRange) const { - return boost::hash_value(glyphRange); - } -}; - -using GlyphRangeSet = std::unordered_set<GlyphRange, GlyphRangeHash>; - constexpr uint32_t GLYPHS_PER_GLYPH_RANGE = 256; constexpr uint32_t GLYPH_RANGES_PER_FONT_STACK = 256; } // end namespace mbgl + +namespace std { + +template <> +struct hash<mbgl::GlyphRange> { + std::size_t operator()(const mbgl::GlyphRange& range) const { + return mbgl::util::hash(range.first, range.second); + } +}; + +} // namespace std |