diff --git a/src/mbgl/map/raster_tile_data.cpp b/src/mbgl/map/raster_tile_data.cpp index 84e9bb236..524475f30 100644 --- a/src/mbgl/map/raster_tile_data.cpp +++ b/src/mbgl/map/raster_tile_data.cpp @@ -7,7 +7,7 @@ using namespace mbgl; RasterTileData::RasterTileData(Tile::ID const& id_, TexturePool& texturePool, const SourceInfo& source_, FileSource& fileSource_) : TileData(id_, source_, fileSource_), - bucket(texturePool, properties) { + bucket(texturePool, layout) { } RasterTileData::~RasterTileData() { diff --git a/src/mbgl/map/raster_tile_data.hpp b/src/mbgl/map/raster_tile_data.hpp index 7f338056f..a3c9f08cd 100644 --- a/src/mbgl/map/raster_tile_data.hpp +++ b/src/mbgl/map/raster_tile_data.hpp @@ -3,6 +3,7 @@ #include #include +#include #include namespace mbgl { @@ -24,7 +25,7 @@ public: virtual bool hasData(StyleLayer const& layer_desc) const; protected: - StyleBucketRaster properties; + StyleLayoutRaster layout; RasterBucket bucket; }; diff --git a/src/mbgl/map/source.cpp b/src/mbgl/map/source.cpp index cdf9bdd37..13f3f30c9 100644 --- a/src/mbgl/map/source.cpp +++ b/src/mbgl/map/source.cpp @@ -190,7 +190,7 @@ TileData::State Source::addTile(Map& map, uv::worker& worker, new_tile.data = std::make_shared(normalized_id, map.getMaxZoom(), style, glyphAtlas, glyphStore, spriteAtlas, sprite, - texturePool, info, fileSource); + info, fileSource); } else if (info.type == SourceType::Raster) { new_tile.data = std::make_shared(normalized_id, texturePool, info, fileSource); } else { diff --git a/src/mbgl/map/tile_parser.cpp b/src/mbgl/map/tile_parser.cpp index aeed805d9..087f2a33c 100644 --- a/src/mbgl/map/tile_parser.cpp +++ b/src/mbgl/map/tile_parser.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -33,8 +34,7 @@ TileParser::TileParser(const std::string &data, VectorTileData &tile_, GlyphAtlas & glyphAtlas_, GlyphStore & glyphStore_, SpriteAtlas & spriteAtlas_, - const util::ptr &sprite_, - TexturePool& texturePool_) + const util::ptr &sprite_) : vector_data(pbf((const uint8_t *)data.data(), data.size())), tile(tile_), style(style_), @@ -42,7 +42,6 @@ TileParser::TileParser(const std::string &data, VectorTileData &tile_, glyphStore(glyphStore_), spriteAtlas(spriteAtlas_), sprite(sprite_), - texturePool(texturePool_), collision(util::make_unique(tile.id.z, 4096, tile.source.tile_size, tile.depth)) { assert(&tile != nullptr); assert(style); @@ -123,18 +122,25 @@ void applyLayoutProperty(PropertyKey key, const ClassProperties &classProperties } } -void parseLayoutProperties(StyleBucketFill &/*fill*/, const StyleBucket &/*bucket*/, const float /*z*/) { +std::unique_ptr parseStyleLayoutFill(const StyleBucket &/*bucket*/, const float /*z*/) { // no-op; Fill buckets don't currently have any applicable layout properties + auto fillPtr = util::make_unique(); + return fillPtr; } -void parseLayoutProperties(StyleBucketLine &line, const StyleBucket &bucket_desc, const float z) { +std::unique_ptr parseStyleLayoutLine(const StyleBucket &bucket_desc, const float z) { + auto linePtr = util::make_unique(); + auto &line = *linePtr; applyLayoutProperty(PropertyKey::LineCap, bucket_desc.layout, line.cap, z); applyLayoutProperty(PropertyKey::LineJoin, bucket_desc.layout, line.join, z); applyLayoutProperty(PropertyKey::LineMiterLimit, bucket_desc.layout, line.miter_limit, z); applyLayoutProperty(PropertyKey::LineRoundLimit, bucket_desc.layout, line.round_limit, z); + return linePtr; } -void parseLayoutProperties(StyleBucketSymbol &symbol, const StyleBucket &bucket_desc, const float z) { +std::unique_ptr parseStyleLayoutSymbol(const StyleBucket &bucket_desc, const float z) { + auto symbolPtr = util::make_unique(); + auto &symbol = *symbolPtr; applyLayoutProperty(PropertyKey::SymbolPlacement, bucket_desc.layout, symbol.placement, z); if (symbol.placement == PlacementType::Line) { symbol.icon.rotation_alignment = RotationAlignmentType::Map; @@ -172,6 +178,7 @@ void parseLayoutProperties(StyleBucketSymbol &symbol, const StyleBucket &bucket_ applyLayoutProperty(PropertyKey::TextTransform, bucket_desc.layout, symbol.text.transform, z); applyLayoutProperty(PropertyKey::TextOffset, bucket_desc.layout, symbol.text.offset, z); applyLayoutProperty(PropertyKey::TextAllowOverlap, bucket_desc.layout, symbol.text.allow_overlap, z); + return symbolPtr; } std::unique_ptr TileParser::createBucket(const StyleBucket &bucket_desc) { @@ -225,8 +232,7 @@ void TileParser::addBucketGeometries(Bucket& bucket, const VectorTileLayer& laye std::unique_ptr TileParser::createFillBucket(const VectorTileLayer &layer, const StyleBucket &bucket_desc) { - auto fill = util::make_unique(); - parseLayoutProperties(*fill, bucket_desc, tile.id.z); + auto fill = parseStyleLayoutFill(bucket_desc, tile.id.z); auto bucket = util::make_unique(std::move(fill), tile.fillVertexBuffer, tile.triangleElementsBuffer, @@ -235,15 +241,9 @@ std::unique_ptr TileParser::createFillBucket(const VectorTileLayer &laye return obsolete() ? nullptr : std::move(bucket); } -std::unique_ptr TileParser::createRasterBucket(const StyleBucketRaster &raster) { - std::unique_ptr bucket = util::make_unique(texturePool, raster); - return obsolete() ? nullptr : std::move(bucket); -} - std::unique_ptr TileParser::createLineBucket(const VectorTileLayer &layer, const StyleBucket &bucket_desc) { - auto line = util::make_unique(); - parseLayoutProperties(*line, bucket_desc, tile.id.z); + auto line = parseStyleLayoutLine(bucket_desc, tile.id.z); auto bucket = util::make_unique(std::move(line), tile.lineVertexBuffer, tile.triangleElementsBuffer, @@ -254,8 +254,7 @@ std::unique_ptr TileParser::createLineBucket(const VectorTileLayer &laye std::unique_ptr TileParser::createSymbolBucket(const VectorTileLayer &layer, const StyleBucket &bucket_desc) { - auto symbol = util::make_unique(); - parseLayoutProperties(*symbol, bucket_desc, tile.id.z); + auto symbol = parseStyleLayoutSymbol(bucket_desc, tile.id.z); auto bucket = util::make_unique(std::move(symbol), *collision); bucket->addFeatures( layer, bucket_desc.filter, tile.id, spriteAtlas, *sprite, glyphAtlas, glyphStore); diff --git a/src/mbgl/map/tile_parser.hpp b/src/mbgl/map/tile_parser.hpp index 4d4f8efe7..0cf5b20d8 100644 --- a/src/mbgl/map/tile_parser.hpp +++ b/src/mbgl/map/tile_parser.hpp @@ -23,10 +23,10 @@ class SpriteAtlas; class Sprite; class Style; class StyleBucket; -class StyleBucketFill; -class StyleBucketRaster; -class StyleBucketLine; -class StyleBucketSymbol; +class StyleLayoutFill; +class StyleLayoutRaster; +class StyleLayoutLine; +class StyleLayoutSymbol; class StyleLayerGroup; class VectorTileData; class Collision; @@ -40,8 +40,7 @@ public: GlyphAtlas & glyphAtlas, GlyphStore & glyphStore, SpriteAtlas & spriteAtlas, - const util::ptr &sprite, - TexturePool& texturePool); + const util::ptr &sprite); ~TileParser(); public: @@ -53,7 +52,6 @@ private: std::unique_ptr createBucket(const StyleBucket &bucket_desc); std::unique_ptr createFillBucket(const VectorTileLayer &layer, const StyleBucket &bucket_desc); - std::unique_ptr createRasterBucket(const StyleBucketRaster &raster); std::unique_ptr createLineBucket(const VectorTileLayer& layer, const StyleBucket &bucket_desc); std::unique_ptr createSymbolBucket(const VectorTileLayer& layer, const StyleBucket &bucket_desc); @@ -69,7 +67,6 @@ private: GlyphStore & glyphStore; SpriteAtlas & spriteAtlas; util::ptr sprite; - TexturePool& texturePool; std::unique_ptr collision; }; diff --git a/src/mbgl/map/vector_tile_data.cpp b/src/mbgl/map/vector_tile_data.cpp index 646ad7318..5f6b24907 100644 --- a/src/mbgl/map/vector_tile_data.cpp +++ b/src/mbgl/map/vector_tile_data.cpp @@ -13,14 +13,12 @@ VectorTileData::VectorTileData(Tile::ID const& id_, float mapMaxZoom, util::ptr