Remove support for prerendered layers
https://github.com/mapbox/mapbox-gl-style-spec/issues/232
This commit is contained in:
@@ -575,12 +575,8 @@ void Map::updateSources(const util::ptr<StyleLayerGroup> &group) {
|
||||
}
|
||||
for (const util::ptr<StyleLayer> &layer : group->layers) {
|
||||
if (!layer) continue;
|
||||
if (layer->bucket) {
|
||||
if (layer->bucket->style_source) {
|
||||
(*activeSources.emplace(layer->bucket->style_source).first)->enabled = true;
|
||||
}
|
||||
} else if (layer->layers) {
|
||||
updateSources(layer->layers);
|
||||
if (layer->bucket && layer->bucket->style_source) {
|
||||
(*activeSources.emplace(layer->bucket->style_source).first)->enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,8 @@ void TileParser::parseStyleLayers(util::ptr<StyleLayerGroup> group) {
|
||||
if (layer_desc->isBackground()) {
|
||||
// background is a special, fake bucket
|
||||
continue;
|
||||
} else if (layer_desc->layers) {
|
||||
// This is a layer group.
|
||||
parseStyleLayers(layer_desc->layers);
|
||||
}
|
||||
|
||||
if (layer_desc->bucket) {
|
||||
// This is a singular layer. Check if this bucket already exists. If not,
|
||||
// parse this bucket.
|
||||
@@ -88,7 +86,7 @@ void TileParser::parseStyleLayers(util::ptr<StyleLayerGroup> group) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "[WARNING] layer '%s' does not have child layers or buckets\n", layer_desc->id.c_str());
|
||||
fprintf(stderr, "[WARNING] layer '%s' does not have buckets\n", layer_desc->id.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,8 +115,6 @@ std::unique_ptr<Bucket> TileParser::createBucket(util::ptr<StyleBucket> bucket_d
|
||||
} else {
|
||||
fprintf(stderr, "[WARNING] unknown bucket render type for layer '%s' (source layer '%s')\n", bucket_desc->name.c_str(), bucket_desc->source_layer.c_str());
|
||||
}
|
||||
} else if (bucket_desc->render.is<StyleBucketRaster>() && bucket_desc->render.get<StyleBucketRaster>().prerendered == true) {
|
||||
return createRasterBucket(bucket_desc->render.get<StyleBucketRaster>());
|
||||
} else {
|
||||
// The layer specified in the bucket does not exist. Do nothing.
|
||||
if (debug::tileParseWarnings) {
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/style/style_properties.hpp>
|
||||
#include <mbgl/renderer/prerendered_texture.hpp>
|
||||
#include <mbgl/renderer/raster_bucket.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
void Painter::preparePrerender(RasterBucket &bucket) {
|
||||
MBGL_CHECK_ERROR(glDisable(GL_DEPTH_TEST));
|
||||
MBGL_CHECK_ERROR(glDisable(GL_STENCIL_TEST));
|
||||
|
||||
// Render the actual tile.
|
||||
#if GL_EXT_discard_framebuffer
|
||||
const GLenum discards[] = {GL_COLOR_ATTACHMENT0};
|
||||
MBGL_CHECK_ERROR(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
|
||||
#endif
|
||||
MBGL_CHECK_ERROR(glClearColor(0.0, 0.0, 0.0, 0.0));
|
||||
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT));
|
||||
|
||||
MBGL_CHECK_ERROR(glViewport(0, 0, bucket.properties.size, bucket.properties.size));
|
||||
}
|
||||
|
||||
void Painter::renderPrerenderedTexture(RasterBucket &bucket, const mat4 &matrix, const RasterProperties& properties) {
|
||||
const int buffer = bucket.properties.buffer * 4096.0f;
|
||||
|
||||
// draw the texture on a quad
|
||||
useProgram(rasterShader->program);
|
||||
rasterShader->u_matrix = matrix;
|
||||
rasterShader->u_opacity = 1;
|
||||
|
||||
depthRange(strata, 1.0f);
|
||||
|
||||
MBGL_CHECK_ERROR(glActiveTexture(GL_TEXTURE0));
|
||||
rasterShader->u_image = 0;
|
||||
rasterShader->u_buffer = buffer;
|
||||
rasterShader->u_opacity = properties.opacity;
|
||||
rasterShader->u_brightness_low = properties.brightness[0];
|
||||
rasterShader->u_brightness_high = properties.brightness[1];
|
||||
rasterShader->u_saturation_factor = saturationFactor(properties.saturation);
|
||||
rasterShader->u_contrast_factor = contrastFactor(properties.contrast);
|
||||
rasterShader->u_spin_weights = spinWeights(properties.hue_rotate);
|
||||
bucket.texture.bindTexture();
|
||||
coveringRasterArray.bind(*rasterShader, tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, (GLsizei)tileStencilBuffer.index()));
|
||||
}
|
||||
@@ -9,53 +9,11 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
void Painter::renderRaster(RasterBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID& id, const mat4 &matrix) {
|
||||
void Painter::renderRaster(RasterBucket& bucket, util::ptr<StyleLayer> layer_desc, const Tile::ID&, const mat4 &matrix) {
|
||||
if (pass != RenderPass::Translucent) return;
|
||||
|
||||
const RasterProperties &properties = layer_desc->getProperties<RasterProperties>();
|
||||
|
||||
if (layer_desc->layers) {
|
||||
|
||||
if (!bucket.texture.getTexture()) {
|
||||
|
||||
bucket.texture.bindFramebuffer();
|
||||
|
||||
preparePrerender(bucket);
|
||||
|
||||
const int buffer = bucket.properties.buffer * 4096.0f;
|
||||
|
||||
const mat4 preMatrix = [&]{
|
||||
mat4 vtxMatrix;
|
||||
matrix::ortho(vtxMatrix, -buffer, 4096 + buffer, -4096 - buffer, buffer, 0, 1);
|
||||
matrix::translate(vtxMatrix, vtxMatrix, 0, -4096, 0);
|
||||
return vtxMatrix;
|
||||
}();
|
||||
|
||||
for (const util::ptr<StyleLayer> &layer : layer_desc->layers->layers) {
|
||||
setOpaque();
|
||||
renderLayer(layer, &id, &preMatrix);
|
||||
setTranslucent();
|
||||
renderLayer(layer, &id, &preMatrix);
|
||||
}
|
||||
|
||||
if (bucket.properties.blur > 0) {
|
||||
bucket.texture.blur(*this, bucket.properties.blur);
|
||||
}
|
||||
|
||||
bucket.texture.unbindFramebuffer();
|
||||
|
||||
MBGL_CHECK_ERROR(glEnable(GL_DEPTH_TEST));
|
||||
MBGL_CHECK_ERROR(glEnable(GL_STENCIL_TEST));
|
||||
|
||||
MBGL_CHECK_ERROR(glViewport(0, 0, gl_viewport[0], gl_viewport[1]));
|
||||
|
||||
}
|
||||
|
||||
renderPrerenderedTexture(bucket, matrix, properties);
|
||||
|
||||
}
|
||||
|
||||
// Only draw non-prerendered raster here
|
||||
if (bucket.hasData()) {
|
||||
depthMask(false);
|
||||
|
||||
@@ -75,7 +33,6 @@ void Painter::renderRaster(RasterBucket& bucket, util::ptr<StyleLayer> layer_des
|
||||
|
||||
depthMask(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float Painter::saturationFactor(float saturation) {
|
||||
|
||||
@@ -1,154 +0,0 @@
|
||||
#include <mbgl/renderer/prerendered_texture.hpp>
|
||||
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
PrerenderedTexture::PrerenderedTexture(const StyleBucketRaster &properties_)
|
||||
: properties(properties_) {
|
||||
}
|
||||
|
||||
PrerenderedTexture::~PrerenderedTexture() {
|
||||
if (texture != 0) {
|
||||
MBGL_CHECK_ERROR(glDeleteTextures(1, &texture));
|
||||
texture = 0;
|
||||
}
|
||||
|
||||
if (fbo != 0) {
|
||||
MBGL_CHECK_ERROR(glDeleteFramebuffers(1, &fbo));
|
||||
fbo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PrerenderedTexture::bindTexture() {
|
||||
if (texture == 0) {
|
||||
bindFramebuffer();
|
||||
unbindFramebuffer();
|
||||
}
|
||||
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture));
|
||||
}
|
||||
|
||||
void PrerenderedTexture::bindFramebuffer() {
|
||||
MBGL_CHECK_ERROR(glGetIntegerv(GL_FRAMEBUFFER_BINDING, &previous_fbo));
|
||||
|
||||
if (texture == 0) {
|
||||
MBGL_CHECK_ERROR(glGenTextures(1, &texture));
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture));
|
||||
#ifndef GL_ES_VERSION_2_0
|
||||
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0));
|
||||
#endif
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, properties.size, properties.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0));
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, 0));
|
||||
}
|
||||
|
||||
if (fbo_depth_stencil == 0) {
|
||||
// Create depth/stencil buffer
|
||||
MBGL_CHECK_ERROR(glGenRenderbuffers(1, &fbo_depth_stencil));
|
||||
MBGL_CHECK_ERROR(glBindRenderbuffer(GL_RENDERBUFFER, fbo_depth_stencil));
|
||||
#ifdef GL_ES_VERSION_2_0
|
||||
MBGL_CHECK_ERROR(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, properties.size, properties.size));
|
||||
#else
|
||||
MBGL_CHECK_ERROR(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, properties.size, properties.size));
|
||||
#endif
|
||||
MBGL_CHECK_ERROR(glBindRenderbuffer(GL_RENDERBUFFER, 0));
|
||||
}
|
||||
|
||||
if (fbo == 0) {
|
||||
MBGL_CHECK_ERROR(glGenFramebuffers(1, &fbo));
|
||||
MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, fbo));
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0));
|
||||
#ifdef GL_ES_VERSION_2_0
|
||||
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo_depth_stencil));
|
||||
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_depth_stencil));
|
||||
#else
|
||||
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo_depth_stencil));
|
||||
#endif
|
||||
|
||||
GLenum status = MBGL_CHECK_ERROR(glCheckFramebufferStatus(GL_FRAMEBUFFER));
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
fprintf(stderr, "Couldn't create framebuffer: ");
|
||||
switch (status) {
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: fprintf(stderr, "incomplete attachment\n"); break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: fprintf(stderr, "incomplete missing attachment\n"); break;
|
||||
#ifdef GL_ES_VERSION_2_0
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: fprintf(stderr, "incomplete dimensions\n"); break;
|
||||
#else
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: fprintf(stderr, "incomplete draw buffer\n"); break;
|
||||
#endif
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED: fprintf(stderr, "unsupported\n"); break;
|
||||
default: fprintf(stderr, "other\n"); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, fbo));
|
||||
}
|
||||
}
|
||||
|
||||
void PrerenderedTexture::unbindFramebuffer() {
|
||||
MBGL_CHECK_ERROR(glBindFramebuffer(GL_FRAMEBUFFER, previous_fbo));
|
||||
|
||||
if (fbo != 0) {
|
||||
MBGL_CHECK_ERROR(glDeleteFramebuffers(1, &fbo));
|
||||
fbo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PrerenderedTexture::blur(Painter& painter, uint16_t passes) {
|
||||
const GLuint original_texture = texture;
|
||||
|
||||
// Create a secondary texture
|
||||
GLuint secondary_texture;
|
||||
MBGL_CHECK_ERROR(glGenTextures(1, &secondary_texture));
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, secondary_texture));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, properties.size, properties.size, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0));
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, 0));
|
||||
|
||||
|
||||
painter.useProgram(painter.gaussianShader->program);
|
||||
painter.gaussianShader->u_matrix = painter.flipMatrix;
|
||||
painter.gaussianShader->u_image = 0;
|
||||
MBGL_CHECK_ERROR(glActiveTexture(GL_TEXTURE0));
|
||||
|
||||
for (int i = 0; i < passes; i++) {
|
||||
// Render horizontal
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, secondary_texture, 0));
|
||||
#if GL_EXT_discard_framebuffer
|
||||
const GLenum discards[] = { GL_COLOR_ATTACHMENT0 };
|
||||
MBGL_CHECK_ERROR(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
|
||||
#endif
|
||||
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT));
|
||||
|
||||
painter.gaussianShader->u_offset = {{ 1.0f / float(properties.size), 0 }};
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, original_texture));
|
||||
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index()));
|
||||
|
||||
|
||||
|
||||
// Render vertical
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, original_texture, 0));
|
||||
#if GL_EXT_discard_framebuffer
|
||||
MBGL_CHECK_ERROR(glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, discards));
|
||||
#endif
|
||||
MBGL_CHECK_ERROR(glClear(GL_COLOR_BUFFER_BIT));
|
||||
|
||||
painter.gaussianShader->u_offset = {{ 0, 1.0f / float(properties.size) }};
|
||||
MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, secondary_texture));
|
||||
painter.coveringGaussianArray.bind(*painter.gaussianShader, painter.tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLES, 0, (GLsizei)painter.tileStencilBuffer.index()));
|
||||
}
|
||||
|
||||
MBGL_CHECK_ERROR(glDeleteTextures(1, &secondary_texture));
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef MBGL_RENDERER_PRERENDERED_TEXTURE
|
||||
#define MBGL_RENDERER_PRERENDERED_TEXTURE
|
||||
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class StyleBucketRaster;
|
||||
class Painter;
|
||||
|
||||
class PrerenderedTexture : private util::noncopyable {
|
||||
public:
|
||||
PrerenderedTexture(const StyleBucketRaster &properties);
|
||||
~PrerenderedTexture();
|
||||
|
||||
void bindTexture();
|
||||
void bindFramebuffer();
|
||||
void unbindFramebuffer();
|
||||
|
||||
inline GLuint getTexture() const { return texture; }
|
||||
|
||||
void blur(Painter& painter, uint16_t passes);
|
||||
|
||||
public:
|
||||
const StyleBucketRaster &properties;
|
||||
|
||||
private:
|
||||
GLint previous_fbo = 0;
|
||||
GLuint fbo = 0;
|
||||
GLuint texture = 0;
|
||||
GLuint fbo_depth_stencil = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,6 @@ using namespace mbgl;
|
||||
|
||||
RasterBucket::RasterBucket(TexturePool& texturePool, const StyleBucketRaster& properties_)
|
||||
: properties(properties_),
|
||||
texture(properties_),
|
||||
raster(texturePool) {
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/util/raster.hpp>
|
||||
#include <mbgl/renderer/prerendered_texture.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
|
||||
@@ -24,7 +23,6 @@ public:
|
||||
bool setImage(const std::string &data);
|
||||
|
||||
const StyleBucketRaster &properties;
|
||||
PrerenderedTexture texture;
|
||||
|
||||
void drawRaster(RasterShader& shader, StaticVertexBuffer &vertices, VertexArrayObject &array);
|
||||
|
||||
|
||||
@@ -80,10 +80,6 @@ public:
|
||||
|
||||
class StyleBucketRaster {
|
||||
public:
|
||||
bool prerendered = false;
|
||||
uint16_t size = 256;
|
||||
float blur = 0.0f;
|
||||
float buffer = 0.03125f;
|
||||
};
|
||||
|
||||
typedef mapbox::util::variant<StyleBucketFill, StyleBucketLine, StyleBucketSymbol,
|
||||
|
||||
@@ -51,11 +51,6 @@ void StyleLayer::setClasses(const std::vector<std::string> &class_names, const t
|
||||
appliedProperties.add(ClassID::Fallback, begin, end, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Update all child layers as well.
|
||||
if (layers) {
|
||||
layers->setClasses(class_names, now, defaultTransition);
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function for applying all properties of a a single class that haven't been applied yet.
|
||||
@@ -239,10 +234,6 @@ void StyleLayer::applyStyleProperties<BackgroundProperties>(const float z, const
|
||||
}
|
||||
|
||||
void StyleLayer::updateProperties(float z, const timestamp now) {
|
||||
if (layers) {
|
||||
layers->updateProperties(z, now);
|
||||
}
|
||||
|
||||
cleanupAppliedStyleProperties(now);
|
||||
|
||||
switch (type) {
|
||||
|
||||
@@ -79,9 +79,6 @@ public:
|
||||
// Stores the evaluated, and cascaded styling information, specific to this
|
||||
// layer's type.
|
||||
StyleProperties properties;
|
||||
|
||||
// Child layer array (if this layer has child layers).
|
||||
util::ptr<StyleLayerGroup> layers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -490,10 +490,6 @@ util::ptr<StyleLayer> StyleParser::createLayer(JSVal value) {
|
||||
util::ptr<StyleLayer> layer = std::make_shared<StyleLayer>(
|
||||
layer_id, std::move(paints));
|
||||
|
||||
if (value.HasMember("layers")) {
|
||||
layer->layers = createLayers(value["layers"]);
|
||||
}
|
||||
|
||||
// Store the layer ID so we can reference it later.
|
||||
layers.emplace(layer_id, std::pair<JSVal, util::ptr<StyleLayer>> { value, layer });
|
||||
|
||||
@@ -523,7 +519,7 @@ void StyleParser::parseLayer(std::pair<JSVal, util::ptr<StyleLayer>> &pair) {
|
||||
}
|
||||
}
|
||||
|
||||
if (layer->bucket || (layer->layers && layer->type != StyleLayerType::Raster)) {
|
||||
if (layer->bucket) {
|
||||
// Skip parsing this again. We already have a valid layer definition.
|
||||
return;
|
||||
}
|
||||
@@ -661,18 +657,9 @@ void StyleParser::parseReference(JSVal value, util::ptr<StyleLayer> &layer) {
|
||||
parseLayer(it->second);
|
||||
stack.pop_front();
|
||||
|
||||
|
||||
util::ptr<StyleLayer> reference = it->second.second;
|
||||
|
||||
layer->type = reference->type;
|
||||
|
||||
if (reference->layers) {
|
||||
Log::Warning(Event::ParseStyle, "layer '%s' references composite layer", layer->id.c_str());
|
||||
// We cannot parse this layer further.
|
||||
return;
|
||||
} else {
|
||||
layer->bucket = reference->bucket;
|
||||
}
|
||||
layer->bucket = reference->bucket;
|
||||
}
|
||||
|
||||
#pragma mark - Parse Bucket
|
||||
@@ -812,17 +799,6 @@ void StyleParser::parseLayout(JSVal value, util::ptr<StyleLayer> &layer) {
|
||||
parseRenderProperty(value, render.text.optional, "text-optional");
|
||||
} break;
|
||||
|
||||
case StyleLayerType::Raster: {
|
||||
StyleBucketRaster &render = bucket.render.get<StyleBucketRaster>();
|
||||
|
||||
parseRenderProperty(value, render.size, "raster-size");
|
||||
parseRenderProperty(value, render.blur, "raster-blur");
|
||||
parseRenderProperty(value, render.buffer, "raster-buffer");
|
||||
if (layer->layers) {
|
||||
render.prerendered = true;
|
||||
}
|
||||
} break;
|
||||
|
||||
default:
|
||||
// There are no render properties for these layer types.
|
||||
break;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <mbgl/util/texture_pool.hpp>
|
||||
#include <mbgl/util/image.hpp>
|
||||
#include <mbgl/util/ptr.hpp>
|
||||
#include <mbgl/renderer/prerendered_texture.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
Reference in New Issue
Block a user