Merge branch 'master' into perspective-without-y-flip

This commit is contained in:
Minh Nguyễn
2015-08-25 14:13:16 -07:00
9 changed files with 41 additions and 35 deletions

View File

@@ -178,6 +178,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.
{
@@ -196,6 +199,7 @@ void Painter::render(const Style& style, TransformState state_, const FrameData&
}
}
// - CLIPPING MASKS ----------------------------------------------------------------------------
// Draws the clipping masks to the stencil buffer.
{
@@ -265,8 +269,6 @@ void Painter::renderPass(RenderPass pass_,
std::size_t i, int8_t increment) {
pass = pass_;
const double zoom = state.getZoom();
MBGL_DEBUG_GROUP(pass == RenderPass::Opaque ? "opaque" : "translucent");
if (debug::renderTree) {
@@ -280,13 +282,6 @@ void Painter::renderPass(RenderPass pass_,
currentLayer = i;
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));
prepareTile(*item.tile);
@@ -303,8 +298,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;
@@ -341,6 +336,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);
@@ -354,6 +358,8 @@ void Painter::updateRenderOrder(const Style& style) {
}
}
}
return order;
}
void Painter::renderBackground(const StyleLayer &layer_desc) {