summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-05-19 12:09:50 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-05-22 16:41:10 +0300
commit25093370e293d51d78734c335913a37c712cc071 (patch)
tree51e6745570c9a5aff14fe93877876b995b51ddd1 /src
parent84d3b5f89971c839c1a15beedf56d8b064be1d6f (diff)
downloadqtlocation-mapboxgl-25093370e293d51d78734c335913a37c712cc071.tar.gz
[core] RenderLayer::setRenderTiles(RenderTiles) -> prepare(LayerPrepareParameters)
RenderLayer::prepare() is responsible for the complete initialization of a render layer, so that it can render.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.cpp7
-rw-r--r--src/mbgl/renderer/layers/render_symbol_layer.hpp2
-rw-r--r--src/mbgl/renderer/render_layer.cpp6
-rw-r--r--src/mbgl/renderer/render_layer.hpp10
-rw-r--r--src/mbgl/renderer/renderer_impl.cpp3
5 files changed, 18 insertions, 10 deletions
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp
index 644056f24d..0aae4e469c 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.cpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp
@@ -2,6 +2,7 @@
#include <mbgl/renderer/buckets/symbol_bucket.hpp>
#include <mbgl/renderer/bucket_parameters.hpp>
#include <mbgl/renderer/property_evaluation_parameters.hpp>
+#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/upload_parameters.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
@@ -652,9 +653,9 @@ style::TextPaintProperties::PossiblyEvaluated RenderSymbolLayer::textPaintProper
};
}
-void RenderSymbolLayer::setRenderTiles(RenderTiles tiles, const TransformState& state) {
- renderTiles = std::move(tiles);
- const auto comp = [bearing = state.getBearing()](const RenderTile& a, const RenderTile& b) {
+void RenderSymbolLayer::prepare(const LayerPrepareParameters& params) {
+ renderTiles = params.source->getRenderTiles();
+ const auto comp = [bearing = params.state.getBearing()](const RenderTile& a, const RenderTile& b) {
Point<float> pa(a.id.canonical.x, a.id.canonical.y);
Point<float> pb(b.id.canonical.x, b.id.canonical.y);
diff --git a/src/mbgl/renderer/layers/render_symbol_layer.hpp b/src/mbgl/renderer/layers/render_symbol_layer.hpp
index 351ed4833e..354f433e60 100644
--- a/src/mbgl/renderer/layers/render_symbol_layer.hpp
+++ b/src/mbgl/renderer/layers/render_symbol_layer.hpp
@@ -67,7 +67,7 @@ private:
bool hasCrossfade() const override;
void upload(gfx::UploadPass&, UploadParameters&) override;
void render(PaintParameters&, RenderSource*) override;
- void setRenderTiles(RenderTiles, const TransformState&) override;
+ void prepare(const LayerPrepareParameters&) override;
// Paint properties
style::SymbolPaintProperties::Unevaluated unevaluated;
diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp
index da5269a20f..c4e7c9bf05 100644
--- a/src/mbgl/renderer/render_layer.cpp
+++ b/src/mbgl/renderer/render_layer.cpp
@@ -1,5 +1,6 @@
#include <mbgl/renderer/render_layer.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
+#include <mbgl/renderer/render_source.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/style/types.hpp>
#include <mbgl/style/layer.hpp>
@@ -44,8 +45,9 @@ bool RenderLayer::supportsZoom(float zoom) const {
return baseImpl->minZoom <= zoom && baseImpl->maxZoom >= zoom;
}
-void RenderLayer::setRenderTiles(RenderTiles tiles, const TransformState&) {
- renderTiles = filterRenderTiles(std::move(tiles));
+void RenderLayer::prepare(const LayerPrepareParameters& params) {
+ assert(params.source);
+ renderTiles = filterRenderTiles(params.source->getRenderTiles());
}
optional<Color> RenderLayer::getSolidBackground() const {
diff --git a/src/mbgl/renderer/render_layer.hpp b/src/mbgl/renderer/render_layer.hpp
index ae5e1a48b0..08646a5dff 100644
--- a/src/mbgl/renderer/render_layer.hpp
+++ b/src/mbgl/renderer/render_layer.hpp
@@ -34,6 +34,12 @@ public:
bool rotateWithMap;
};
+class LayerPrepareParameters {
+public:
+ RenderSource* source;
+ const TransformState& state;
+};
+
class RenderLayer {
protected:
RenderLayer(Immutable<style::LayerProperties>);
@@ -84,8 +90,7 @@ public:
const float,
const mat4&) const { return false; };
- using RenderTiles = std::vector<std::reference_wrapper<RenderTile>>;
- virtual void setRenderTiles(RenderTiles, const TransformState&);
+ virtual void prepare(const LayerPrepareParameters&);
const std::vector<LayerPlacementData>& getPlacementData() const {
return placementData;
@@ -107,6 +112,7 @@ protected:
void checkRenderability(const PaintParameters&, uint32_t activeBindingCount);
protected:
+ using RenderTiles = std::vector<std::reference_wrapper<RenderTile>>;
// Stores current set of tiles to be rendered for this layer.
RenderTiles renderTiles;
diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp
index 10d60cbef7..87086c329a 100644
--- a/src/mbgl/renderer/renderer_impl.cpp
+++ b/src/mbgl/renderer/renderer_impl.cpp
@@ -300,13 +300,12 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
}
}
- // Set render tiles to the render items.
for (auto& renderItem : renderItems) {
if (!renderItem.source) {
continue;
}
RenderLayer& renderLayer = renderItem.layer;
- renderLayer.setRenderTiles(renderItem.source->getRenderTiles(), updateParameters.transformState);
+ renderLayer.prepare({renderItem.source, updateParameters.transformState});
if (renderLayer.needsPlacement()) {
layersNeedPlacement.emplace_back(renderLayer);
}