summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp6
-rw-r--r--src/mbgl/renderer/render_layer.hpp2
-rw-r--r--src/mbgl/text/placement.cpp4
-rw-r--r--src/mbgl/text/placement.hpp2
4 files changed, 6 insertions, 8 deletions
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 416704f167..a5b9aa32c8 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -583,21 +583,19 @@ void RenderSymbolLayer::prepare(const LayerPrepareParameters& params) {
assert(tile);
assert(tile->kind == Tile::Kind::Geometry);
- bool firstInBucket = true;
auto featureIndex = static_cast<const GeometryTile*>(tile)->getFeatureIndex();
if (bucket->sortKeyRanges.empty()) {
- placementData.push_back({*bucket, renderTile, featureIndex, firstInBucket, nullopt});
+ placementData.push_back({*bucket, renderTile, featureIndex, nullopt});
} else {
for (const auto& sortKeyRange : bucket->sortKeyRanges) {
- LayerPlacementData layerData{*bucket, renderTile, featureIndex, firstInBucket, sortKeyRange};
+ LayerPlacementData layerData{*bucket, renderTile, featureIndex, sortKeyRange};
auto sortPosition = std::upper_bound(
placementData.cbegin(), placementData.cend(), layerData, [](const auto& lhs, const auto& rhs) {
assert(lhs.sortKeyRange && rhs.sortKeyRange);
return lhs.sortKeyRange->sortKey < rhs.sortKeyRange->sortKey;
});
placementData.insert(sortPosition, std::move(layerData));
- firstInBucket = false;
}
}
}
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index 6a10898797..9c87a7e225 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -30,6 +30,7 @@ public:
class SortKeyRange {
public:
+ bool isFirstRange() const { return start == 0u; }
float sortKey;
size_t start;
size_t end;
@@ -40,7 +41,6 @@ public:
std::reference_wrapper<Bucket> bucket;
std::reference_wrapper<const RenderTile> tile;
std::shared_ptr<FeatureIndex> featureIndex;
- bool firstInBucket;
optional<SortKeyRange> sortKeyRange;
};
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index 398e0f9e03..de8a5894bc 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -144,7 +144,7 @@ void Placement::placeBucket(const SymbolBucket& bucket,
std::set<uint32_t>& seenCrossTileIDs) {
assert(updateParameters);
const auto& layout = *bucket.layout;
- const auto& renderTile = params.tile;
+ const RenderTile& renderTile = params.tile;
const auto& state = collisionIndex.getTransformState();
const float pixelsToTileUnits = renderTile.id.pixelsToTileUnits(1, placementZoom);
const OverscaledTileID& overscaledID = renderTile.getOverscaledTileID();
@@ -735,7 +735,7 @@ void Placement::commit() {
void Placement::updateLayerBuckets(const RenderLayer& layer, const TransformState& state, bool updateOpacities) const {
std::set<uint32_t> seenCrossTileIDs;
for (const auto& item : layer.getPlacementData()) {
- if (item.firstInBucket) {
+ if (!item.sortKeyRange || item.sortKeyRange->isFirstRange()) {
item.bucket.get().updateVertices(*this, updateOpacities, state, item.tile, seenCrossTileIDs);
}
}
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index dd29a6e3b8..cbb22dc404 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -88,7 +88,7 @@ private:
class BucketPlacementParameters {
public:
- const RenderTile& tile;
+ std::reference_wrapper<const RenderTile> tile;
std::string sourceId;
std::shared_ptr<FeatureIndex> featureIndex;
optional<SortKeyRange> sortKeyRange;