diff options
author | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-05-12 23:19:00 +0300 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-05-12 13:19:00 -0700 |
commit | cc9f040a2d35293c51dcc5be9c7affea7f1263bd (patch) | |
tree | de62a5610e719f5bfe07226c3382d4d2a5e17530 /src/mbgl/sprite/sprite_atlas.hpp | |
parent | c80f3e9d29d1c26ccc88ef30f8f17329c9bfb1b7 (diff) | |
download | qtlocation-mapboxgl-cc9f040a2d35293c51dcc5be9c7affea7f1263bd.tar.gz |
[core] Split style image collection from SpriteAtlas
Diffstat (limited to 'src/mbgl/sprite/sprite_atlas.hpp')
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.hpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index 5d99677726..7ae583dcba 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -7,7 +7,6 @@ #include <mbgl/style/image.hpp> #include <string> -#include <map> #include <set> #include <unordered_map> #include <array> @@ -15,10 +14,6 @@ namespace mbgl { -class Scheduler; -class FileSource; -class SpriteAtlasObserver; - namespace gl { class Context; } // namespace gl @@ -38,7 +33,7 @@ public: float height; }; -using IconMap = std::map<std::string, SpriteAtlasElement>; +using IconMap = std::unordered_map<std::string, SpriteAtlasElement>; using IconDependencies = std::set<std::string>; class IconRequestor { @@ -48,12 +43,12 @@ public: class SpriteAtlas : public util::noncopyable { public: - using Images = std::map<std::string, std::unique_ptr<style::Image>>; + using Images = std::unordered_map<std::string, std::unique_ptr<style::Image>>; SpriteAtlas(Size, float pixelRatio); ~SpriteAtlas(); - void load(const std::string& url, Scheduler&, FileSource&); + void onSpriteLoaded(Images&&); void markAsLoaded() { loaded = true; @@ -65,8 +60,6 @@ public: void dumpDebugLogs() const; - void setObserver(SpriteAtlasObserver*); - const style::Image* getImage(const std::string&) const; void addImage(const std::string&, std::unique_ptr<style::Image>); void removeImage(const std::string&); @@ -93,25 +86,12 @@ public: } private: - void emitSpriteLoadedIfComplete(); - - // Invoked by SpriteAtlasWorker - friend class SpriteAtlasWorker; - void onParsed(Images&& result); - void onError(std::exception_ptr); - const Size size; const float pixelRatio; - - struct Loader; - std::unique_ptr<Loader> loader; - bool loaded = false; - SpriteAtlasObserver* observer = nullptr; - struct Entry { - std::unique_ptr<style::Image> image; + std::unique_ptr<const style::Image> image; // One sprite image might be used as both an icon image and a pattern image. If so, // it must have two distinct entries in the texture. The one for the icon image has |