[core] Split style image collection from SpriteAtlas

This commit is contained in:
Ivo van Dongen
2017-05-12 23:19:00 +03:00
committed by John Firebaugh
parent c80f3e9d29
commit cc9f040a2d
33 changed files with 677 additions and 413 deletions

View File

@@ -0,0 +1,29 @@
#include <mbgl/sprite/sprite_loader_worker.hpp>
#include <mbgl/sprite/sprite_loader.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
namespace mbgl {
SpriteLoaderWorker::SpriteLoaderWorker(ActorRef<SpriteLoaderWorker>, ActorRef<SpriteLoader> parent_)
: parent(std::move(parent_)) {
}
void SpriteLoaderWorker::parse(std::shared_ptr<const std::string> image,
std::shared_ptr<const std::string> json) {
try {
if (!image) {
// This shouldn't happen, since we always invoke it with a non-empty pointer.
throw std::runtime_error("missing sprite image");
}
if (!json) {
// This shouldn't happen, since we always invoke it with a non-empty pointer.
throw std::runtime_error("missing sprite metadata");
}
parent.invoke(&SpriteLoader::onParsed, parseSprite(*image, *json));
} catch (...) {
parent.invoke(&SpriteLoader::onError, std::current_exception());
}
}
} // namespace mbgl