diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-10 12:31:46 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-07-17 09:19:02 -0700 |
commit | 902d9442da0f2f2c74530a4b770c9ff05f5d4d1e (patch) | |
tree | 50466237456b21162652d9e0a9be4ab6e0fec0f2 /src/mbgl | |
parent | cf83f117f0e3e338454ba1bc0e5a13b3b9565228 (diff) | |
download | qtlocation-mapboxgl-902d9442da0f2f2c74530a4b770c9ff05f5d4d1e.tar.gz |
[core] No need for optional in map of VertexArrays
Diffstat (limited to 'src/mbgl')
-rw-r--r-- | src/mbgl/programs/program.hpp | 8 | ||||
-rw-r--r-- | src/mbgl/programs/segment.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/programs/symbol_program.hpp | 8 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index 8cd6c07322..ca8434cf0a 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -67,10 +67,10 @@ public: .concat(paintPropertyBinders.attributeBindings(currentProperties)); for (auto& segment : segments) { - optional<gl::VertexArray>& vertexArray = segment.vertexArrays[layerID]; + auto vertexArrayIt = segment.vertexArrays.find(layerID); - if (!vertexArray) { - vertexArray = context.createVertexArray(); + if (vertexArrayIt == segment.vertexArrays.end()) { + vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; } program.draw( @@ -80,7 +80,7 @@ public: std::move(stencilMode), std::move(colorMode), allUniformValues, - *vertexArray, + vertexArrayIt->second, Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), indexBuffer, segment.indexOffset, diff --git a/src/mbgl/programs/segment.hpp b/src/mbgl/programs/segment.hpp index 74bf4a75c5..937df4dece 100644 --- a/src/mbgl/programs/segment.hpp +++ b/src/mbgl/programs/segment.hpp @@ -2,7 +2,6 @@ #include <mbgl/gl/context.hpp> #include <mbgl/gl/vertex_array.hpp> -#include <mbgl/util/optional.hpp> #include <cstddef> #include <vector> @@ -35,7 +34,7 @@ public: // data-driven paint properties // * when two fill layers have the same layout properties, but one // uses fill-color and the other uses fill-pattern - mutable std::map<std::string, optional<gl::VertexArray>> vertexArrays; + mutable std::map<std::string, gl::VertexArray> vertexArrays; }; template <class Attributes> diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 3bf82009e2..5fb0c4f15f 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -371,10 +371,10 @@ public: .concat(paintPropertyBinders.attributeBindings(currentProperties)); for (auto& segment : segments) { - optional<gl::VertexArray>& vertexArray = segment.vertexArrays[layerID]; + auto vertexArrayIt = segment.vertexArrays.find(layerID); - if (!vertexArray) { - vertexArray = context.createVertexArray(); + if (vertexArrayIt == segment.vertexArrays.end()) { + vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; } program.draw( @@ -384,7 +384,7 @@ public: std::move(stencilMode), std::move(colorMode), allUniformValues, - *vertexArray, + vertexArrayIt->second, Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), indexBuffer, segment.indexOffset, |