From 3270440f234570f1426c442898c2400e36608ebf Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 8 Jun 2017 13:58:46 -0700 Subject: [core] Per-tile glyph/icon atlases --- src/mbgl/tile/geometry_tile_worker.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/mbgl/tile/geometry_tile_worker.cpp') diff --git a/src/mbgl/tile/geometry_tile_worker.cpp b/src/mbgl/tile/geometry_tile_worker.cpp index d67cbca76b..a5a82a7920 100644 --- a/src/mbgl/tile/geometry_tile_worker.cpp +++ b/src/mbgl/tile/geometry_tile_worker.cpp @@ -386,14 +386,24 @@ void GeometryTileWorker::attemptPlacement() { auto collisionTile = std::make_unique(*placementConfig); std::unordered_map> buckets; + optional glyphAtlasImage; + optional iconAtlasImage; + for (auto& symbolLayout : symbolLayouts) { if (obsolete) { return; } if (symbolLayout->state == SymbolLayout::Pending) { - symbolLayout->prepare(glyphMap, imageMap); + GlyphAtlas glyphAtlas = makeGlyphAtlas(glyphMap); + ImageAtlas imageAtlas = makeImageAtlas(imageMap); + + symbolLayout->prepare(glyphMap, glyphAtlas.positions, + imageMap, imageAtlas.positions); symbolLayout->state = SymbolLayout::Placed; + + glyphAtlasImage = std::move(glyphAtlas.image); + iconAtlasImage = std::move(imageAtlas.image); } if (!symbolLayout->hasSymbolInstances()) { @@ -409,6 +419,8 @@ void GeometryTileWorker::attemptPlacement() { parent.invoke(&GeometryTile::onPlacement, GeometryTile::PlacementResult { std::move(buckets), std::move(collisionTile), + std::move(glyphAtlasImage), + std::move(iconAtlasImage), correlationID }); } -- cgit v1.2.1