[core] Avoid gratuitous SymbolBucket creation

This commit is contained in:
John Firebaugh
2016-09-14 12:34:57 -07:00
parent c8217a8739
commit a9f5224664
2 changed files with 5 additions and 4 deletions

View File

@@ -40,7 +40,8 @@ void SymbolBucket::render(Painter& painter,
}
bool SymbolBucket::hasData() const {
return hasTextData() || hasIconData();
assert(false); // Should be calling SymbolLayout::hasSymbolInstances() instead.
return false;
}
bool SymbolBucket::hasTextData() const {

View File

@@ -167,9 +167,9 @@ TilePlacementResult TileWorker::redoPlacement(const PlacementConfig& config) {
for (auto& symbolLayout : symbolLayouts) {
symbolLayout->state = SymbolLayout::Placed;
std::unique_ptr<Bucket> bucket = symbolLayout->place(*result.collisionTile);
if (bucket->hasData() || symbolLayout->hasSymbolInstances()) {
result.buckets.emplace(symbolLayout->bucketName, std::move(bucket));
if (symbolLayout->hasSymbolInstances()) {
result.buckets.emplace(symbolLayout->bucketName,
symbolLayout->place(*result.collisionTile));
}
}