summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-12 13:01:00 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-13 09:28:53 -0700
commitb3ec985568176b077756b66754470988436d43c1 (patch)
tree45638ff9787938cd34240542e95e51509773edbf /src
parent84e39611a096058826dbdb89dccbd1affad05f76 (diff)
downloadqtlocation-mapboxgl-b3ec985568176b077756b66754470988436d43c1.tar.gz
[core] Trim StyleObserver interface
It doesn't need to inherit from SpriteLoaderObserver and GlyphAtlasObserver.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/style/observer.hpp6
-rw-r--r--src/mbgl/style/style.cpp7
-rw-r--r--src/mbgl/style/style.hpp3
3 files changed, 2 insertions, 14 deletions
diff --git a/src/mbgl/style/observer.hpp b/src/mbgl/style/observer.hpp
index 77d97685be..3b2c0db3c0 100644
--- a/src/mbgl/style/observer.hpp
+++ b/src/mbgl/style/observer.hpp
@@ -1,7 +1,5 @@
#pragma once
-#include <mbgl/text/glyph_atlas_observer.hpp>
-#include <mbgl/sprite/sprite_loader_observer.hpp>
#include <mbgl/style/source_observer.hpp>
#include <mbgl/map/update.hpp>
@@ -10,9 +8,7 @@
namespace mbgl {
namespace style {
-class Observer : public GlyphAtlasObserver,
- public SpriteLoaderObserver,
- public SourceObserver {
+class Observer : public SourceObserver {
public:
virtual void onUpdate(Update) {}
virtual void onStyleError(std::exception_ptr) {}
diff --git a/src/mbgl/style/style.cpp b/src/mbgl/style/style.cpp
index 5f67d495bd..ae9ed97427 100644
--- a/src/mbgl/style/style.cpp
+++ b/src/mbgl/style/style.cpp
@@ -729,15 +729,10 @@ void Style::setObserver(style::Observer* observer_) {
observer = observer_;
}
-void Style::onGlyphsLoaded(const FontStack& fontStack, const GlyphRange& glyphRange) {
- observer->onGlyphsLoaded(fontStack, glyphRange);
-}
-
void Style::onGlyphsError(const FontStack& fontStack, const GlyphRange& glyphRange, std::exception_ptr error) {
lastError = error;
Log::Error(Event::Style, "Failed to load glyph range %d-%d for font stack %s: %s",
glyphRange.first, glyphRange.second, fontStackToString(fontStack).c_str(), util::toString(error).c_str());
- observer->onGlyphsError(fontStack, glyphRange, error);
observer->onResourceError(error);
}
@@ -789,14 +784,12 @@ void Style::onSpriteLoaded(SpriteLoader::Images&& images) {
spriteAtlas->onSpriteLoaded(std::move(addedImages));
// Update observer
- observer->onSpriteLoaded(std::move(images));
observer->onUpdate(Update::Repaint); // For *-pattern properties.
}
void Style::onSpriteError(std::exception_ptr error) {
lastError = error;
Log::Error(Event::Style, "Failed to load sprite: %s", util::toString(error).c_str());
- observer->onSpriteError(error);
observer->onResourceError(error);
}
diff --git a/src/mbgl/style/style.hpp b/src/mbgl/style/style.hpp
index 5953d823d9..fb724e2b46 100644
--- a/src/mbgl/style/style.hpp
+++ b/src/mbgl/style/style.hpp
@@ -154,8 +154,7 @@ private:
std::vector<std::unique_ptr<Layer>>::const_iterator findLayer(const std::string& layerID) const;
- // GlyphStoreObserver implementation.
- void onGlyphsLoaded(const FontStack&, const GlyphRange&) override;
+ // GlyphAtlasObserver implementation.
void onGlyphsError(const FontStack&, const GlyphRange&, std::exception_ptr) override;
// SpriteLoaderObserver implementation.