1+ #include < mbgl/actor/scheduler.hpp>
12#include < mbgl/layermanager/layer_manager.hpp>
23#include < mbgl/map/map_impl.hpp>
34#include < mbgl/renderer/update_parameters.hpp>
@@ -11,15 +12,17 @@ Map::Impl::Impl(RendererFrontend& frontend_,
1112 MapObserver& observer_,
1213 std::shared_ptr<FileSource> fileSource_,
1314 const MapOptions& mapOptions)
14- : observer(observer_),
15- rendererFrontend (frontend_),
16- transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()),
17- mode(mapOptions.mapMode()),
18- pixelRatio(mapOptions.pixelRatio()),
19- crossSourceCollisions(mapOptions.crossSourceCollisions()),
20- fileSource(std::move(fileSource_)),
21- style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
22- annotationManager(*style) {
15+ : observer(observer_),
16+ rendererFrontend (frontend_),
17+ transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()),
18+ mode(mapOptions.mapMode()),
19+ pixelRatio(mapOptions.pixelRatio()),
20+ crossSourceCollisions(mapOptions.crossSourceCollisions()),
21+ fileSource(std::move(fileSource_)),
22+ style(std::make_unique<style::Style>(*fileSource, pixelRatio)),
23+ annotationManager(*style),
24+ mailbox(std::make_shared<Mailbox>(*Scheduler::GetCurrent ())),
25+ actor(*this , mailbox) {
2326 transform.setNorthOrientation (mapOptions.northOrientation ());
2427 style->impl ->setObserver (this );
2528 rendererFrontend.setObserver (*this );
@@ -39,12 +42,16 @@ void Map::Impl::onSourceChanged(style::Source& source) {
3942}
4043
4144void Map::Impl::onUpdate () {
42- // Don't load/render anything in still mode until explicitly requested.
43- if (mode != MapMode::Continuous && !stillImageRequest) {
44- return ;
45+ if (mode == MapMode::Continuous) {
46+ actor.invoke (&Map::Impl::updateInternal, Clock::now ());
47+ } else if (stillImageRequest) {
48+ updateInternal (Clock::time_point::max ());
4549 }
50+ }
4651
47- TimePoint timePoint = mode == MapMode::Continuous ? Clock::now () : Clock::time_point::max ();
52+ void Map::Impl::updateInternal (TimePoint timePoint) {
53+ // Don't load/render anything in still mode until explicitly requested.
54+ assert (mode == MapMode::Continuous || stillImageRequest);
4855
4956 transform.updateTransitions (timePoint);
5057
0 commit comments