[core] Move Sprite parsing to thread pool

This commit is contained in:
Konstantin Käfer
2017-04-20 12:28:35 +02:00
parent 197f0ca6b4
commit 59055cf403
20 changed files with 147 additions and 77 deletions

View File

@@ -40,8 +40,9 @@ namespace style {
static Observer nullObserver;
Style::Style(FileSource& fileSource_, float pixelRatio)
: fileSource(fileSource_),
Style::Style(Scheduler& scheduler_, FileSource& fileSource_, float pixelRatio)
: scheduler(scheduler_),
fileSource(fileSource_),
glyphAtlas(std::make_unique<GlyphAtlas>(Size{ 2048, 2048 }, fileSource)),
spriteAtlas(std::make_unique<SpriteAtlas>(Size{ 1024, 1024 }, pixelRatio)),
lineAtlas(std::make_unique<LineAtlas>(Size{ 256, 512 })),
@@ -133,7 +134,7 @@ void Style::setJSON(const std::string& json) {
defaultPitch = parser.pitch;
glyphAtlas->setURL(parser.glyphURL);
spriteAtlas->load(parser.spriteURL, fileSource);
spriteAtlas->load(parser.spriteURL, scheduler, fileSource);
loaded = true;