summaryrefslogtreecommitdiff
path: root/src/mbgl/gfx/attribute.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-15 20:31:12 +0100
committerGitHub <noreply@github.com>2019-03-15 20:31:12 +0100
commitc8cfdb1ced822711e772dfcc8f708b1a7a68b5fc (patch)
treebf511253e25459cafc91a5f3bea2f5c773677162 /src/mbgl/gfx/attribute.cpp
parent62695c56956add5560933137a479f29f2d3a091b (diff)
downloadqtlocation-mapboxgl-c8cfdb1ced822711e772dfcc8f708b1a7a68b5fc.tar.gz
Merge pull request #14126 from mapbox/gfx-refactor-4
Graphics refactor #4
Diffstat (limited to 'src/mbgl/gfx/attribute.cpp')
-rw-r--r--src/mbgl/gfx/attribute.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mbgl/gfx/attribute.cpp b/src/mbgl/gfx/attribute.cpp
new file mode 100644
index 0000000000..ed5d4032f4
--- /dev/null
+++ b/src/mbgl/gfx/attribute.cpp
@@ -0,0 +1,21 @@
+#include <mbgl/gfx/attribute.hpp>
+
+#include <limits>
+#include <cassert>
+
+namespace mbgl {
+namespace gfx {
+
+optional<AttributeBinding> offsetAttributeBinding(const optional<AttributeBinding>& binding, std::size_t vertexOffset) {
+ assert(vertexOffset <= std::numeric_limits<uint32_t>::max());
+ if (binding) {
+ AttributeBinding result = *binding;
+ result.vertexOffset = static_cast<uint32_t>(vertexOffset);
+ return result;
+ } else {
+ return binding;
+ }
+}
+
+} // namespace gfx
+} // namespace mbgl