diff options
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 |