diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-15 14:09:06 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-16 12:26:35 -0700 |
commit | cc1ea759a681cadcfd06fd7bdda79ca6deb38c62 (patch) | |
tree | 97ece422b0516b11979c84b8136f95aeabb1aa91 /src/mbgl/style/style.cpp | |
parent | c0f6e5ccefc67dbdaa6ab7c7ea75a2a2d0c3f2ae (diff) | |
download | qtlocation-mapboxgl-cc1ea759a681cadcfd06fd7bdda79ca6deb38c62.tar.gz |
[core, node, darwin, android, qt] Make image ID part of Image
More like Source and Layer.
Diffstat (limited to 'src/mbgl/style/style.cpp')
-rw-r--r-- | src/mbgl/style/style.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp index f601c4126c..84ee841c06 100644 --- a/src/mbgl/style/style.cpp +++ b/src/mbgl/style/style.cpp @@ -505,9 +505,9 @@ bool Style::isLoaded() const { return true; } -void Style::addImage(const std::string& id, std::unique_ptr<style::Image> image) { - addSpriteImage(spriteImages, id, std::move(image), [&](style::Image& added) { - spriteAtlas->addImage(id, added.impl); +void Style::addImage(std::unique_ptr<style::Image> image) { + addSpriteImage(spriteImages, std::move(image), [&](style::Image& added) { + spriteAtlas->addImage(added.impl); observer->onUpdate(Update::Repaint); }); } @@ -735,19 +735,11 @@ void Style::onTileError(RenderSource& source, const OverscaledTileID& tileID, st observer->onResourceError(error); } -void Style::onSpriteLoaded(SpriteLoader::Images&& images) { - // Add images to collection - Images addedImages; - for (auto& entry : images) { - addSpriteImage(spriteImages, entry.first, std::move(entry.second), [&] (style::Image& added) { - addedImages.emplace(entry.first, std::make_unique<Image>(added)); - }); +void Style::onSpriteLoaded(std::vector<std::unique_ptr<Image>>&& images) { + for (auto& image : images) { + addImage(std::move(image)); } - - // Update render sprite atlas - spriteAtlas->onSpriteLoaded(std::move(addedImages)); - - // Update observer + spriteAtlas->onSpriteLoaded(); observer->onUpdate(Update::Repaint); // For *-pattern properties. } |