summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-03 15:25:14 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2020-03-03 16:13:48 +0200
commit44ac1f008aeda27d13e6390405a3666ff522611b (patch)
tree6a09febcf5a071a78e3419654fd1d336035ee2b5
parent24fa5999038da096ce714e998061cf76610bb651 (diff)
downloadqtlocation-mapboxgl-44ac1f008aeda27d13e6390405a3666ff522611b.tar.gz
[core] Drop BucketPlacementParameters
-rw-r--r--src/mbgl/renderer/bucket.hpp4
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.cpp4
-rw-r--r--src/mbgl/renderer/buckets/symbol_bucket.hpp2
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp5
-rw-r--r--src/mbgl/renderer/render_layer.hpp1
-rw-r--r--src/mbgl/text/placement.cpp12
-rw-r--r--src/mbgl/text/placement.hpp10
7 files changed, 15 insertions, 23 deletions
diff --git a/src/mbgl/renderer/bucket.hpp b/src/mbgl/renderer/bucket.hpp
index 4e28107f07..68d6c46b7f 100644
--- a/src/mbgl/renderer/bucket.hpp
+++ b/src/mbgl/renderer/bucket.hpp
@@ -19,7 +19,7 @@ class PatternDependency;
using PatternLayerMap = std::map<std::string, PatternDependency>;
class Placement;
class TransformState;
-class BucketPlacementParameters;
+class BucketPlacementData;
class RenderTile;
class Bucket {
@@ -64,7 +64,7 @@ public:
return std::make_pair(0u, false);
}
// Places this bucket to the given placement.
- virtual void place(Placement&, const BucketPlacementParameters&, std::set<uint32_t>&) {}
+ virtual void place(Placement&, const BucketPlacementData&, std::set<uint32_t>&) {}
virtual void updateVertices(
const Placement&, bool /*updateOpacities*/, const TransformState&, const RenderTile&, std::set<uint32_t>&) {}
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.cpp b/src/mbgl/renderer/buckets/symbol_bucket.cpp
index af2a479c26..1858f29801 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.cpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.cpp
@@ -314,8 +314,8 @@ std::pair<uint32_t, bool> SymbolBucket::registerAtCrossTileIndex(CrossTileSymbol
return std::make_pair(bucketInstanceId, firstTimeAdded);
}
-void SymbolBucket::place(Placement& placement, const BucketPlacementParameters& params, std::set<uint32_t>& seenIds) {
- placement.placeBucket(*this, params, seenIds);
+void SymbolBucket::place(Placement& placement, const BucketPlacementData& data, std::set<uint32_t>& seenIds) {
+ placement.placeSymbolBucket(data, seenIds);
}
void SymbolBucket::updateVertices(const Placement& placement,
diff --git a/src/mbgl/renderer/buckets/symbol_bucket.hpp b/src/mbgl/renderer/buckets/symbol_bucket.hpp
index 3cdea1310c..752f92e889 100644
--- a/src/mbgl/renderer/buckets/symbol_bucket.hpp
+++ b/src/mbgl/renderer/buckets/symbol_bucket.hpp
@@ -84,7 +84,7 @@ public:
void upload(gfx::UploadPass&) override;
bool hasData() const override;
std::pair<uint32_t, bool> registerAtCrossTileIndex(CrossTileSymbolLayerIndex&, const RenderTile&) override;
- void place(Placement&, const BucketPlacementParameters&, std::set<uint32_t>&) override;
+ void place(Placement&, const BucketPlacementData&, std::set<uint32_t>&) override;
void updateVertices(
const Placement&, bool updateOpacities, const TransformState&, const RenderTile&, std::set<uint32_t>&) override;
bool hasTextData() const;
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 8de6267045..1d8c0a70a8 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -575,6 +575,7 @@ void RenderSymbolLayer::prepare(const LayerPrepareParameters& params) {
addRenderPassesFromTiles();
placementData.clear();
+
for (const RenderTile& renderTile : *renderTiles) {
auto* bucket = static_cast<SymbolBucket*>(renderTile.getBucket(*baseImpl));
if (bucket && bucket->bucketLeaderID == getID()) {
@@ -586,10 +587,10 @@ void RenderSymbolLayer::prepare(const LayerPrepareParameters& params) {
auto featureIndex = static_cast<const GeometryTile*>(tile)->getFeatureIndex();
if (bucket->sortKeyRanges.empty()) {
- placementData.push_back({*bucket, renderTile, featureIndex, nullopt});
+ placementData.push_back({*bucket, renderTile, featureIndex, baseImpl->source, nullopt});
} else {
for (const auto& sortKeyRange : bucket->sortKeyRanges) {
- BucketPlacementData layerData{*bucket, renderTile, featureIndex, sortKeyRange};
+ BucketPlacementData layerData{*bucket, renderTile, featureIndex, baseImpl->source, sortKeyRange};
auto sortPosition = std::upper_bound(
placementData.cbegin(), placementData.cend(), layerData, [](const auto& lhs, const auto& rhs) {
assert(lhs.sortKeyRange && rhs.sortKeyRange);
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index 40d073d562..53dafb3b7b 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -41,6 +41,7 @@ public:
std::reference_wrapper<Bucket> bucket;
std::reference_wrapper<const RenderTile> tile;
std::shared_ptr<FeatureIndex> featureIndex;
+ std::string sourceId;
optional<SortKeyRange> sortKeyRange;
};
diff --git a/src/mbgl/text/placement.cpp b/src/mbgl/text/placement.cpp
index de8a5894bc..a0e55c6f86 100644
--- a/src/mbgl/text/placement.cpp
+++ b/src/mbgl/text/placement.cpp
@@ -111,10 +111,9 @@ Placement::Placement() : collisionIndex({}, MapMode::Static), collisionGroups(tr
void Placement::placeLayer(const RenderLayer& layer) {
std::set<uint32_t> seenCrossTileIDs;
- for (const auto& item : layer.getPlacementData()) {
- Bucket& bucket = item.bucket;
- BucketPlacementParameters params{item.tile, layer.baseImpl->source, item.featureIndex, item.sortKeyRange};
- bucket.place(*this, params, seenCrossTileIDs);
+ for (const BucketPlacementData& data : layer.getPlacementData()) {
+ Bucket& bucket = data.bucket;
+ bucket.place(*this, data, seenCrossTileIDs);
}
}
@@ -139,10 +138,9 @@ Point<float> calculateVariableLayoutOffset(style::SymbolAnchorType anchor,
}
} // namespace
-void Placement::placeBucket(const SymbolBucket& bucket,
- const BucketPlacementParameters& params,
- std::set<uint32_t>& seenCrossTileIDs) {
+void Placement::placeSymbolBucket(const BucketPlacementData& params, std::set<uint32_t>& seenCrossTileIDs) {
assert(updateParameters);
+ const auto& bucket = static_cast<const SymbolBucket&>(params.bucket.get());
const auto& layout = *bucket.layout;
const RenderTile& renderTile = params.tile;
const auto& state = collisionIndex.getTransformState();
diff --git a/src/mbgl/text/placement.hpp b/src/mbgl/text/placement.hpp
index cbb22dc404..df7345d4cc 100644
--- a/src/mbgl/text/placement.hpp
+++ b/src/mbgl/text/placement.hpp
@@ -86,14 +86,6 @@ private:
bool crossSourceCollisions;
};
-class BucketPlacementParameters {
-public:
- std::reference_wrapper<const RenderTile> tile;
- std::string sourceId;
- std::shared_ptr<FeatureIndex> featureIndex;
- optional<SortKeyRange> sortKeyRange;
-};
-
class Placement;
class PlacementController {
@@ -132,7 +124,7 @@ public:
private:
friend SymbolBucket;
- void placeBucket(const SymbolBucket&, const BucketPlacementParameters&, std::set<uint32_t>& seenCrossTileIDs);
+ void placeSymbolBucket(const BucketPlacementData&, std::set<uint32_t>& seenCrossTileIDs);
// Returns `true` if bucket vertices were updated; returns `false` otherwise.
bool updateBucketDynamicVertices(SymbolBucket&, const TransformState&, const RenderTile& tile) const;
void updateBucketOpacities(SymbolBucket&, const TransformState&, std::set<uint32_t>&) const;