diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-29 12:52:49 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-09-06 12:52:14 -0700 |
commit | 3635b9f1476ffd5d8f38a7abdf5742faef012850 (patch) | |
tree | e1ec24db4a0b90e7eb0c23768312183d1a2a526d /src/mbgl/map | |
parent | 5b4f6335e384169bcd88633e38d59a500319a47b (diff) | |
download | qtlocation-mapboxgl-3635b9f1476ffd5d8f38a7abdf5742faef012850.tar.gz |
[core] Prepare style observer interfaces for source reloading
* Renamed {Source,Tile}Observer::onNeedsRepaint to onTileUpdated. Messages should be in terms of what happened to the observed object, not in terms of what the observer needs to do. This also removes a confusing overlap of virtual methods on StyleObserver.
* Added style::Observer::onUpdate(Update). This is also a violation of the above rule, but I'm hopeful that it will disappear when update batching is implemented.
Diffstat (limited to 'src/mbgl/map')
-rw-r--r-- | src/mbgl/map/map.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 5c58893b5a..fe0be15b87 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -37,7 +37,7 @@ class Map::Impl : public style::Observer { public: Impl(View&, FileSource&, MapMode, GLContextMode, ConstrainMode, ViewportMode); - void onNeedsRepaint() override; + void onUpdate(Update) override; void onStyleError() override; void onResourceError(std::exception_ptr) override; @@ -149,12 +149,7 @@ void Map::renderStill(StillImageCallback callback) { } void Map::update(Update flags) { - if (flags & Update::Dimensions) { - impl->transform.resize(impl->view.getSize()); - } - - impl->updateFlags |= flags; - impl->asyncUpdate.send(); + impl->onUpdate(flags); } void Map::render() { @@ -905,8 +900,12 @@ void Map::onLowMemory() { impl->view.invalidate(); } -void Map::Impl::onNeedsRepaint() { - updateFlags |= Update::Repaint; +void Map::Impl::onUpdate(Update flags) { + if (flags & Update::Dimensions) { + transform.resize(view.getSize()); + } + + updateFlags |= flags; asyncUpdate.send(); } |