diff options
-rw-r--r-- | include/mbgl/storage/network_status.hpp | 4 | ||||
-rw-r--r-- | platform/default/mbgl/storage/offline_download.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/algorithm/update_renderables.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/annotation/annotation_manager.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/layout/symbol_layout.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/renderer/render_item.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/symbol_bucket.hpp | 1 | ||||
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/storage/network_status.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/update_batch.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/text/collision_tile.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/glyph_atlas.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/text/glyph_atlas.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/text/glyph_range.hpp | 10 | ||||
-rw-r--r-- | test/text/glyph_atlas.cpp | 2 |
16 files changed, 36 insertions, 26 deletions
diff --git a/include/mbgl/storage/network_status.hpp b/include/mbgl/storage/network_status.hpp index d7f502a3b2..0d1ae54ec4 100644 --- a/include/mbgl/storage/network_status.hpp +++ b/include/mbgl/storage/network_status.hpp @@ -2,7 +2,7 @@ #include <atomic> #include <mutex> -#include <set> +#include <unordered_set> namespace mbgl { @@ -28,7 +28,7 @@ public: private: static std::atomic<bool> online; static std::mutex mtx; - static std::set<util::AsyncTask*> observers; + static std::unordered_set<util::AsyncTask*> observers; }; } // namespace mbgl diff --git a/platform/default/mbgl/storage/offline_download.hpp b/platform/default/mbgl/storage/offline_download.hpp index 27c5f0b139..77389d63db 100644 --- a/platform/default/mbgl/storage/offline_download.hpp +++ b/platform/default/mbgl/storage/offline_download.hpp @@ -3,7 +3,7 @@ #include <mbgl/storage/offline.hpp> #include <list> -#include <set> +#include <unordered_set> #include <memory> namespace mbgl { @@ -58,7 +58,7 @@ private: OfflineRegionStatus status; std::unique_ptr<OfflineRegionObserver> observer; std::list<std::unique_ptr<AsyncRequest>> requests; - std::set<std::string> requiredSourceURLs; + std::unordered_set<std::string> requiredSourceURLs; }; } // namespace mbgl diff --git a/src/mbgl/algorithm/update_renderables.hpp b/src/mbgl/algorithm/update_renderables.hpp index 5a6a26f987..fe2dc2c570 100644 --- a/src/mbgl/algorithm/update_renderables.hpp +++ b/src/mbgl/algorithm/update_renderables.hpp @@ -4,7 +4,7 @@ #include <mbgl/util/range.hpp> #include <mbgl/storage/resource.hpp> -#include <set> +#include <unordered_set> namespace mbgl { namespace algorithm { @@ -21,7 +21,7 @@ void updateRenderables(GetTileFn getTile, const IdealTileIDs& idealTileIDs, const Range<uint8_t>& zoomRange, const uint8_t dataTileZoom) { - std::set<UnwrappedTileID> checked; + std::unordered_set<UnwrappedTileID> checked; bool covered; int32_t overscaledZ; diff --git a/src/mbgl/annotation/annotation_manager.hpp b/src/mbgl/annotation/annotation_manager.hpp index b4959964f6..856aeeed72 100644 --- a/src/mbgl/annotation/annotation_manager.hpp +++ b/src/mbgl/annotation/annotation_manager.hpp @@ -8,7 +8,7 @@ #include <string> #include <vector> -#include <set> +#include <unordered_set> #include <unordered_map> namespace mbgl { @@ -72,8 +72,8 @@ private: SymbolAnnotationTree symbolTree; SymbolAnnotationMap symbolAnnotations; ShapeAnnotationMap shapeAnnotations; - std::set<std::string> obsoleteShapeAnnotationLayers; - std::set<AnnotationTile*> tiles; + std::unordered_set<std::string> obsoleteShapeAnnotationLayers; + std::unordered_set<AnnotationTile*> tiles; SpriteAtlas spriteAtlas; }; diff --git a/src/mbgl/layout/symbol_layout.hpp b/src/mbgl/layout/symbol_layout.hpp index db27f1b817..c4e6455794 100644 --- a/src/mbgl/layout/symbol_layout.hpp +++ b/src/mbgl/layout/symbol_layout.hpp @@ -7,7 +7,7 @@ #include <memory> #include <map> -#include <set> +#include <unordered_set> #include <vector> namespace mbgl { @@ -88,7 +88,7 @@ private: bool sdfIcons = false; bool iconsNeedLinear = false; - std::set<GlyphRange> ranges; + GlyphRangeSet ranges; std::vector<SymbolInstance> symbolInstances; std::vector<SymbolFeature> features; }; diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index 915f83f01b..9822b6b914 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -31,6 +31,7 @@ #include <cassert> #include <algorithm> #include <iostream> +#include <unordered_set> namespace mbgl { @@ -80,7 +81,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a RenderData renderData = style.getRenderData(frame.debugOptions); const std::vector<RenderItem>& order = renderData.order; - const std::set<Source*>& sources = renderData.sources; + const std::unordered_set<Source*>& sources = renderData.sources; const Color& background = renderData.backgroundColor; // Update the default matrices to the current viewport dimensions. diff --git a/src/mbgl/renderer/render_item.hpp b/src/mbgl/renderer/render_item.hpp index 82ea897047..b4b1f4aec2 100644 --- a/src/mbgl/renderer/render_item.hpp +++ b/src/mbgl/renderer/render_item.hpp @@ -2,7 +2,7 @@ #include <mbgl/util/color.hpp> -#include <set> +#include <unordered_set> #include <vector> namespace mbgl { @@ -31,7 +31,7 @@ public: class RenderData { public: Color backgroundColor; - std::set<style::Source*> sources; + std::unordered_set<style::Source*> sources; std::vector<RenderItem> order; }; diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp index 8f0c21bc95..ad53cd6630 100644 --- a/src/mbgl/renderer/symbol_bucket.hpp +++ b/src/mbgl/renderer/symbol_bucket.hpp @@ -10,7 +10,6 @@ #include <mbgl/style/layers/symbol_layer_properties.hpp> #include <memory> -#include <set> #include <vector> namespace mbgl { diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index d23d3a0fd1..7a3c2c8b45 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -11,7 +11,7 @@ #include <string> #include <map> #include <mutex> -#include <set> +#include <unordered_set> #include <array> #include <memory> @@ -140,7 +140,7 @@ private: std::recursive_mutex mtx; BinPack<dimension> bin; std::map<Key, Holder> images; - std::set<std::string> uninitialized; + std::unordered_set<std::string> uninitialized; std::unique_ptr<uint32_t[]> data; std::atomic<bool> dirtyFlag; bool fullUploadRequired = true; diff --git a/src/mbgl/storage/network_status.cpp b/src/mbgl/storage/network_status.cpp index 1ef5619bd6..1bd392d578 100644 --- a/src/mbgl/storage/network_status.cpp +++ b/src/mbgl/storage/network_status.cpp @@ -11,7 +11,7 @@ namespace mbgl { std::atomic<bool> NetworkStatus::online(true); std::mutex NetworkStatus::mtx; -std::set<util::AsyncTask *> NetworkStatus::observers; +std::unordered_set<util::AsyncTask *> NetworkStatus::observers; NetworkStatus::Status NetworkStatus::Get() { if (online) { diff --git a/src/mbgl/style/update_batch.hpp b/src/mbgl/style/update_batch.hpp index ee82c98fda..562df52afa 100644 --- a/src/mbgl/style/update_batch.hpp +++ b/src/mbgl/style/update_batch.hpp @@ -1,6 +1,6 @@ #pragma once -#include <set> +#include <unordered_set> #include <string> namespace mbgl { @@ -8,7 +8,7 @@ namespace style { class UpdateBatch { public: - std::set<std::string> sourceIDs; + std::unordered_set<std::string> sourceIDs; }; } // namespace style diff --git a/src/mbgl/text/collision_tile.cpp b/src/mbgl/text/collision_tile.cpp index 982dff1688..32a1a5474a 100644 --- a/src/mbgl/text/collision_tile.cpp +++ b/src/mbgl/text/collision_tile.cpp @@ -156,7 +156,7 @@ Box CollisionTile::getTreeBox(const Point<float>& anchor, const CollisionBox& bo std::vector<IndexedSubfeature> CollisionTile::queryRenderedSymbols(const mapbox::geometry::box<int16_t>& box, const float scale) { std::vector<IndexedSubfeature> result; - std::unordered_map<std::string, std::set<std::size_t>> sourceLayerFeatures; + std::unordered_map<std::string, std::unordered_set<std::size_t>> sourceLayerFeatures; auto anchor = util::matrixMultiply(rotationMatrix, convertPoint<float>(box.min)); CollisionBox queryBox(anchor, 0, 0, box.max.x - box.min.x, box.max.y - box.min.y, scale); diff --git a/src/mbgl/text/glyph_atlas.cpp b/src/mbgl/text/glyph_atlas.cpp index 9e92e3e81e..f46c156b20 100644 --- a/src/mbgl/text/glyph_atlas.cpp +++ b/src/mbgl/text/glyph_atlas.cpp @@ -39,7 +39,7 @@ void GlyphAtlas::requestGlyphRange(const FontStack& fontStack, const GlyphRange& std::make_unique<GlyphPBF>(this, fontStack, range, observer, fileSource)); } -bool GlyphAtlas::hasGlyphRanges(const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) { +bool GlyphAtlas::hasGlyphRanges(const FontStack& fontStack, const GlyphRangeSet& glyphRanges) { if (glyphRanges.empty()) { return true; } diff --git a/src/mbgl/text/glyph_atlas.hpp b/src/mbgl/text/glyph_atlas.hpp index ca88d16f8b..5c6cbf45f0 100644 --- a/src/mbgl/text/glyph_atlas.hpp +++ b/src/mbgl/text/glyph_atlas.hpp @@ -13,7 +13,7 @@ #include <atomic> #include <string> -#include <set> +#include <unordered_set> #include <unordered_map> #include <mutex> #include <exception> @@ -41,7 +41,7 @@ public: // made and when the glyph if finally parsed, it gets added to the respective // GlyphSet and a signal is emitted to notify the observers. This method // can be called from any thread. - bool hasGlyphRanges(const FontStack&, const std::set<GlyphRange>&); + bool hasGlyphRanges(const FontStack&, const GlyphRangeSet&); void setURL(const std::string &url) { glyphURL = url; @@ -95,7 +95,7 @@ private: GlyphValue(Rect<uint16_t> rect_, uintptr_t id) : rect(std::move(rect_)), ids({ id }) {} Rect<uint16_t> rect; - std::set<uintptr_t> ids; + std::unordered_set<uintptr_t> ids; }; std::mutex mtx; diff --git a/src/mbgl/text/glyph_range.hpp b/src/mbgl/text/glyph_range.hpp index 644046d7f8..aa11b35f5e 100644 --- a/src/mbgl/text/glyph_range.hpp +++ b/src/mbgl/text/glyph_range.hpp @@ -2,9 +2,19 @@ #include <utility> #include <cstdint> +#include <unordered_set> +#include <boost/functional/hash.hpp> namespace mbgl { typedef std::pair<uint16_t, uint16_t> GlyphRange; +struct GlyphRangeHash { + std::size_t operator()(const GlyphRange& glyphRange) const { + return boost::hash_value(glyphRange); + } +}; + +typedef std::unordered_set<GlyphRange, GlyphRangeHash> GlyphRangeSet; + } // end namespace mbgl diff --git a/test/text/glyph_atlas.cpp b/test/text/glyph_atlas.cpp index 27d43a1721..8634cbe913 100644 --- a/test/text/glyph_atlas.cpp +++ b/test/text/glyph_atlas.cpp @@ -18,7 +18,7 @@ public: StubStyleObserver observer; GlyphAtlas glyphAtlas { 32, 32, fileSource }; - void run(const std::string& url, const FontStack& fontStack, const std::set<GlyphRange>& glyphRanges) { + void run(const std::string& url, const FontStack& fontStack, const GlyphRangeSet& glyphRanges) { // Squelch logging. Log::setObserver(std::make_unique<Log::NullObserver>()); |