summaryrefslogtreecommitdiff
path: root/src/mbgl/layout/symbol_layout.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-06-28 17:39:49 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-06-28 18:20:45 +0300
commit5a03ae3d906336536ee493426d6cdcc3129c155d (patch)
tree8083c4a5dfd1c743db6c73d0e14434c06390d16a /src/mbgl/layout/symbol_layout.cpp
parenta35b268606b6becf218286036e4d1cfc22ddcaa3 (diff)
downloadqtlocation-mapboxgl-5a03ae3d906336536ee493426d6cdcc3129c155d.tar.gz
[core] Reserve space for index/vertex items when possibleupstream/index-vertex-vector-reserve
Diffstat (limited to 'src/mbgl/layout/symbol_layout.cpp')
-rw-r--r--src/mbgl/layout/symbol_layout.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mbgl/layout/symbol_layout.cpp b/src/mbgl/layout/symbol_layout.cpp
index adc7eaaed8..793b128010 100644
--- a/src/mbgl/layout/symbol_layout.cpp
+++ b/src/mbgl/layout/symbol_layout.cpp
@@ -501,6 +501,8 @@ std::unique_ptr<SymbolBucket> SymbolLayout::place(CollisionTile& collisionTile)
const float placementZoom = util::max(util::log2(glyphScale) + zoom, 0.0f);
collisionTile.insertFeature(symbolInstance.textCollisionFeature, glyphScale, layout.get<TextIgnorePlacement>());
if (glyphScale < collisionTile.maxScale) {
+ bucket->text.vertices.reserve(bucket->text.vertices.vertexSize() + (symbolInstance.glyphQuads.size() * 4));
+ bucket->text.triangles.reserve(bucket->text.triangles.indexSize() + (symbolInstance.glyphQuads.size() * 2));
for (const auto& symbol : symbolInstance.glyphQuads) {
addSymbol(
bucket->text, *bucket->textSizeBinder, symbol, feature, placementZoom,
@@ -621,6 +623,8 @@ void SymbolLayout::addToDebugBuffers(CollisionTile& collisionTile, SymbolBucket&
for (const SymbolInstance &symbolInstance : symbolInstances) {
auto populateCollisionBox = [&](const auto& feature) {
+ collisionBox.vertices.reserve(collisionBox.vertices.vertexSize() + (feature.boxes.size() * 4));
+ collisionBox.lines.reserve(collisionBox.lines.indexSize() + (feature.boxes.size() * 4));
for (const CollisionBox &box : feature.boxes) {
auto& anchor = box.anchor;