summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-08-25 11:18:31 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-08-25 11:36:10 -0700
commit765c4695d85ca9114c419e2e49f121b41f80a85d (patch)
tree1ff63b4a4ec271c5e3967ee94ce0daa98e0cc40e /src
parentc7dfbec96ec54fc6b99c03a6e4752bf7962e1f07 (diff)
downloadqtlocation-mapboxgl-765c4695d85ca9114c419e2e49f121b41f80a85d.tar.gz
Revert "only update the render order array when there are changes to tiles"
This reverts commit fd98607c5fcb14aaa29c046a0b7115f47aaf2ddc. Fixes #2163.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map_context.cpp5
-rw-r--r--src/mbgl/map/source.cpp9
-rw-r--r--src/mbgl/renderer/painter.cpp28
-rw-r--r--src/mbgl/renderer/painter.hpp6
4 files changed, 21 insertions, 27 deletions
diff --git a/src/mbgl/map/map_context.cpp b/src/mbgl/map/map_context.cpp
index 19e8d02ece..a8dd86284f 100644
--- a/src/mbgl/map/map_context.cpp
+++ b/src/mbgl/map/map_context.cpp
@@ -334,7 +334,6 @@ bool MapContext::renderSync(const TransformState& state, const FrameData& frame)
if (!painter) {
painter = std::make_unique<Painter>(data);
painter->setup();
- painter->updateRenderOrder(*style);
}
painter->setDebug(data.getDebug());
@@ -401,10 +400,6 @@ void MapContext::setSprite(const std::string& name, std::shared_ptr<const Sprite
void MapContext::onTileDataChanged() {
assert(util::ThreadContext::currentlyOn(util::ThreadType::Map));
- if (painter) {
- painter->updateRenderOrder(*style);
- }
-
updateFlags |= Update::Repaint;
asyncUpdate->send();
}
diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp
index 4b2ae2cfbd..518468af6e 100644
--- a/src/mbgl/map/source.cpp
+++ b/src/mbgl/map/source.cpp
@@ -529,14 +529,9 @@ void Source::invalidateTiles(const std::unordered_set<TileID, TileID::Hash>& ids
}
void Source::updateTilePtrs() {
- std::vector<Tile*> newPtrs;
+ tilePtrs.clear();
for (const auto& pair : tiles) {
- newPtrs.push_back(pair.second.get());
- }
-
- if (tilePtrs != newPtrs) {
- tilePtrs = newPtrs;
- emitTileLoaded(true);
+ tilePtrs.push_back(pair.second.get());
}
}
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index b55b71dcb1..9e5feaec72 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -184,6 +184,9 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
resize();
changeMatrix();
+ // Figure out what buckets we have to draw and what order we have to draw them in.
+ const auto order = determineRenderOrder(style);
+
// - UPLOAD PASS -------------------------------------------------------------------------------
// Uploads all required buffers and images before we do any actual rendering.
{
@@ -202,6 +205,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
}
}
+
// - CLIPPING MASKS ----------------------------------------------------------------------------
// Draws the clipping masks to the stencil buffer.
{
@@ -272,8 +276,6 @@ void Painter::renderPass(RenderPass pass_,
const float strataThickness) {
pass = pass_;
- const double zoom = state.getZoom();
-
MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");
if (debug::renderTree) {
@@ -286,13 +288,6 @@ void Painter::renderPass(RenderPass pass_,
for (; it != end; ++it, i += increment) {
const auto& item = *it;
if (item.bucket && item.tile) {
- // Skip this layer if it's outside the range of min/maxzoom.
- // This may occur when there /is/ a bucket created for this layer, but the min/max-zoom
- // is set to a fractional value, or value that is larger than the source maxzoom.
- if (item.layer.bucket->min_zoom > zoom ||
- item.layer.bucket->max_zoom <= zoom) {
- continue;
- }
if (item.layer.hasRenderPass(pass)) {
MBGL_DEBUG_GROUP(item.layer.id + " - " + std::string(item.tile->id));
setStrata(i * strataThickness);
@@ -311,8 +306,8 @@ void Painter::renderPass(RenderPass pass_,
}
}
-void Painter::updateRenderOrder(const Style& style) {
- order.clear();
+std::vector<RenderItem> Painter::determineRenderOrder(const Style& style) {
+ std::vector<RenderItem> order;
for (const auto& layerPtr : style.layers) {
const auto& layer = *layerPtr;
@@ -349,6 +344,15 @@ void Painter::updateRenderOrder(const Style& style) {
continue;
}
+ // Skip this layer if it's outside the range of min/maxzoom.
+ // This may occur when there /is/ a bucket created for this layer, but the min/max-zoom
+ // is set to a fractional value, or value that is larger than the source maxzoom.
+ const double zoom = state.getZoom();
+ if (layer.bucket->min_zoom > zoom ||
+ layer.bucket->max_zoom <= zoom) {
+ continue;
+ }
+
const auto& tiles = source->getTiles();
for (auto tile : tiles) {
assert(tile);
@@ -362,6 +366,8 @@ void Painter::updateRenderOrder(const Style& style) {
}
}
}
+
+ return order;
}
void Painter::renderBackground(const StyleLayer &layer_desc) {
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index 78cf308b7b..e4e1f8cff3 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -137,12 +137,12 @@ public:
bool needsAnimation() const;
- void updateRenderOrder(const Style& style);
-
private:
void setupShaders();
mat4 translatedMatrix(const mat4& matrix, const std::array<float, 2> &translation, const TileID &id, TranslateAnchorType anchor);
+ std::vector<RenderItem> determineRenderOrder(const Style& style);
+
template <class Iterator>
void renderPass(RenderPass,
Iterator it, Iterator end,
@@ -204,8 +204,6 @@ private:
const float strata_epsilon = 1.0f / (1 << 16);
Color background = {{ 0, 0, 0, 0 }};
- std::vector<RenderItem> order;
-
public:
FrameHistory frameHistory;