diff options
-rw-r--r-- | include/llmr/style/style.hpp | 37 | ||||
-rw-r--r-- | src/renderer/painter_fill.cpp | 4 | ||||
-rw-r--r-- | src/renderer/painter_icon.cpp | 4 | ||||
-rw-r--r-- | src/renderer/painter_line.cpp | 4 | ||||
-rw-r--r-- | src/renderer/painter_raster.cpp | 4 | ||||
-rw-r--r-- | src/renderer/painter_text.cpp | 4 | ||||
-rw-r--r-- | src/style/style.cpp | 14 |
7 files changed, 36 insertions, 35 deletions
diff --git a/include/llmr/style/style.hpp b/include/llmr/style/style.hpp index 4aa4b748b3..048c4d545a 100644 --- a/include/llmr/style/style.hpp +++ b/include/llmr/style/style.hpp @@ -12,6 +12,7 @@ #include <llmr/util/uv.hpp> #include <map> +#include <unordered_map> #include <vector> #include <set> #include <memory> @@ -52,12 +53,12 @@ public: std::set<std::string> appliedClasses; struct { BackgroundProperties background; - std::map<std::string, FillProperties> fills; - std::map<std::string, LineProperties> lines; - std::map<std::string, IconProperties> icons; - std::map<std::string, TextProperties> texts; - std::map<std::string, RasterProperties> rasters; - std::map<std::string, CompositeProperties> composites; + std::unordered_map<std::string, FillProperties> fills; + std::unordered_map<std::string, LineProperties> lines; + std::unordered_map<std::string, IconProperties> icons; + std::unordered_map<std::string, TextProperties> texts; + std::unordered_map<std::string, RasterProperties> rasters; + std::unordered_map<std::string, CompositeProperties> composites; std::map<std::string, std::map<TransitionablePropertyKey, std::string>> effective_classes; } computed; @@ -74,24 +75,24 @@ private: // Last applied settings. struct { BackgroundProperties background; - std::map<std::string, FillProperties> fills; - std::map<std::string, LineProperties> lines; - std::map<std::string, IconProperties> icons; - std::map<std::string, TextProperties> texts; - std::map<std::string, RasterProperties> rasters; - std::map<std::string, CompositeProperties> composites; + std::unordered_map<std::string, FillProperties> fills; + std::unordered_map<std::string, LineProperties> lines; + std::unordered_map<std::string, IconProperties> icons; + std::unordered_map<std::string, TextProperties> texts; + std::unordered_map<std::string, RasterProperties> rasters; + std::unordered_map<std::string, CompositeProperties> composites; std::map<std::string, std::map<TransitionablePropertyKey, std::string>> effective_classes; } previous; // Settings values currently being transitioned. struct { BackgroundProperties background; - std::map<std::string, FillProperties> fills; - std::map<std::string, LineProperties> lines; - std::map<std::string, IconProperties> icons; - std::map<std::string, TextProperties> texts; - std::map<std::string, RasterProperties> rasters; - std::map<std::string, CompositeProperties> composites; + std::unordered_map<std::string, FillProperties> fills; + std::unordered_map<std::string, LineProperties> lines; + std::unordered_map<std::string, IconProperties> icons; + std::unordered_map<std::string, TextProperties> texts; + std::unordered_map<std::string, RasterProperties> rasters; + std::unordered_map<std::string, CompositeProperties> composites; } transitioning; std::map<std::string, std::map<TransitionablePropertyKey, PropertyTransition>> properties_to_transition; diff --git a/src/renderer/painter_fill.cpp b/src/renderer/painter_fill.cpp index b52f8c396f..5f014dc014 100644 --- a/src/renderer/painter_fill.cpp +++ b/src/renderer/painter_fill.cpp @@ -144,8 +144,8 @@ void Painter::renderFill(FillBucket& bucket, const std::string& layer_name, cons // Abort early. if (!bucket.hasData()) return; - auto fill_properties = map.getStyle().computed.fills; - auto fill_properties_it = fill_properties.find(layer_name); + const std::unordered_map<std::string, FillProperties> &fill_properties = map.getStyle().computed.fills; + const std::unordered_map<std::string, FillProperties>::const_iterator fill_properties_it = fill_properties.find(layer_name); if (fill_properties_it == fill_properties.end()) return; const FillProperties& properties = fill_properties_it->second; diff --git a/src/renderer/painter_icon.cpp b/src/renderer/painter_icon.cpp index b5f4964e6a..382312c120 100644 --- a/src/renderer/painter_icon.cpp +++ b/src/renderer/painter_icon.cpp @@ -11,8 +11,8 @@ void Painter::renderIcon(IconBucket& bucket, const std::string& layer_name, cons if (!bucket.hasData()) return; if (pass == Opaque) return; - auto icon_properties = map.getStyle().computed.icons; - auto icon_properties_it = icon_properties.find(layer_name); + const std::unordered_map<std::string, IconProperties> &icon_properties = map.getStyle().computed.icons; + const std::unordered_map<std::string, IconProperties>::const_iterator icon_properties_it = icon_properties.find(layer_name); if (icon_properties_it == icon_properties.end()) return; const IconProperties& properties = icon_properties_it->second; diff --git a/src/renderer/painter_line.cpp b/src/renderer/painter_line.cpp index 8dc4862013..2788a8bb18 100644 --- a/src/renderer/painter_line.cpp +++ b/src/renderer/painter_line.cpp @@ -9,8 +9,8 @@ void Painter::renderLine(LineBucket& bucket, const std::string& layer_name, cons if (pass == Opaque) return; if (!bucket.hasData()) return; - auto line_properties = map.getStyle().computed.lines; - auto line_properties_it = line_properties.find(layer_name); + const std::unordered_map<std::string, LineProperties> &line_properties = map.getStyle().computed.lines; + const std::unordered_map<std::string, LineProperties>::const_iterator line_properties_it = line_properties.find(layer_name); if (line_properties_it == line_properties.end()) return; const LineProperties& properties = line_properties_it->second; diff --git a/src/renderer/painter_raster.cpp b/src/renderer/painter_raster.cpp index b877496e00..de0d352614 100644 --- a/src/renderer/painter_raster.cpp +++ b/src/renderer/painter_raster.cpp @@ -7,8 +7,8 @@ using namespace llmr; void Painter::renderRaster(RasterBucket& bucket, const std::string& layer_name, const Tile::ID& /*id*/) { if (pass == Translucent) return; - auto raster_properties = map.getStyle().computed.rasters; - auto raster_properties_it = raster_properties.find(layer_name); + const std::unordered_map<std::string, RasterProperties> &raster_properties = map.getStyle().computed.rasters; + const std::unordered_map<std::string, RasterProperties>::const_iterator raster_properties_it = raster_properties.find(layer_name); if (raster_properties_it == raster_properties.end()) return; const RasterProperties& properties = raster_properties_it->second; diff --git a/src/renderer/painter_text.cpp b/src/renderer/painter_text.cpp index f2e458d8c3..0c3c0a01bf 100644 --- a/src/renderer/painter_text.cpp +++ b/src/renderer/painter_text.cpp @@ -9,8 +9,8 @@ void Painter::renderText(TextBucket& bucket, const std::string& layer_name, cons if (pass == Opaque) return; if (!bucket.hasData()) return; - auto text_properties = map.getStyle().computed.texts; - auto text_properties_it = text_properties.find(layer_name); + const std::unordered_map<std::string, TextProperties> &text_properties = map.getStyle().computed.texts; + const std::unordered_map<std::string, TextProperties>::const_iterator text_properties_it = text_properties.find(layer_name); if (text_properties_it == text_properties.end()) return; const TextProperties& properties = text_properties_it->second; diff --git a/src/style/style.cpp b/src/style/style.cpp index 7f9b6ba782..38b8f17234 100644 --- a/src/style/style.cpp +++ b/src/style/style.cpp @@ -74,15 +74,15 @@ void Style::cascade(float z) { time start = util::now(); - previous.fills = computed.fills; - previous.lines = computed.lines; - previous.icons = computed.icons; - previous.texts = computed.texts; - previous.rasters = computed.rasters; - previous.composites = computed.composites; + previous.fills.swap(computed.fills); + previous.lines.swap(computed.lines); + previous.icons.swap(computed.icons); + previous.texts.swap(computed.texts); + previous.rasters.swap(computed.rasters); + previous.composites.swap(computed.composites); previous.background = computed.background; - previous.effective_classes = computed.effective_classes; + previous.effective_classes.swap(computed.effective_classes); reset(); |