Ignore deactivate when no valid EGL display. Fixes #1435
Initialise NativeMapView's EGL variables before Map Fix hang Add check for double pause Add test for double pause
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
Map::Map(View& view, FileSource& fileSource, MapMode mode, bool startPaused)
|
||||
Map::Map(View& view, FileSource& fileSource, MapMode mode)
|
||||
: data(util::make_unique<MapData>(view, mode)),
|
||||
context(util::make_unique<util::Thread<MapContext>>("Map", util::ThreadPriority::Regular, view, fileSource, *data, startPaused))
|
||||
context(util::make_unique<util::Thread<MapContext>>("Map", util::ThreadPriority::Regular, view, fileSource, *data))
|
||||
{
|
||||
view.initialize(this);
|
||||
}
|
||||
@@ -23,13 +23,17 @@ Map::~Map() {
|
||||
void Map::pause() {
|
||||
assert(data->mode == MapMode::Continuous);
|
||||
|
||||
std::unique_lock<std::mutex> lockPause(data->mutexPause);
|
||||
context->invoke(&MapContext::pause);
|
||||
data->condPaused.wait(lockPause);
|
||||
if (!paused) {
|
||||
std::unique_lock<std::mutex> lockPause(data->mutexPause);
|
||||
context->invoke(&MapContext::pause);
|
||||
data->condPaused.wait(lockPause);
|
||||
paused = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Map::resume() {
|
||||
data->condResume.notify_all();
|
||||
paused = false;
|
||||
}
|
||||
|
||||
void Map::renderStill(StillImageCallback callback) {
|
||||
@@ -274,12 +278,12 @@ LatLngBounds Map::getBoundsForAnnotations(const std::vector<uint32_t>& annotatio
|
||||
|
||||
void Map::setDebug(bool value) {
|
||||
data->setDebug(value);
|
||||
update(Update::Debug);
|
||||
update();
|
||||
}
|
||||
|
||||
void Map::toggleDebug() {
|
||||
data->toggleDebug();
|
||||
update(Update::Debug);
|
||||
update();
|
||||
}
|
||||
|
||||
bool Map::getDebug() const {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
MapContext::MapContext(uv_loop_t* loop, View& view_, FileSource& fileSource, MapData& data_, bool startPaused)
|
||||
MapContext::MapContext(uv_loop_t* loop, View& view_, FileSource& fileSource, MapData& data_)
|
||||
: view(view_),
|
||||
data(data_),
|
||||
env(fileSource),
|
||||
@@ -40,20 +40,12 @@ MapContext::MapContext(uv_loop_t* loop, View& view_, FileSource& fileSource, Map
|
||||
glyphAtlas(util::make_unique<GlyphAtlas>(1024, 1024)),
|
||||
spriteAtlas(util::make_unique<SpriteAtlas>(512, 512)),
|
||||
lineAtlas(util::make_unique<LineAtlas>(512, 512)),
|
||||
texturePool(util::make_unique<TexturePool>()),
|
||||
painter(util::make_unique<Painter>(*spriteAtlas, *glyphAtlas, *lineAtlas))
|
||||
{
|
||||
texturePool(util::make_unique<TexturePool>()) {
|
||||
assert(Environment::currentlyOn(ThreadType::Map));
|
||||
|
||||
asyncUpdate->unref();
|
||||
|
||||
view.activate();
|
||||
|
||||
if (startPaused) {
|
||||
pause();
|
||||
}
|
||||
|
||||
painter->setup();
|
||||
}
|
||||
|
||||
MapContext::~MapContext() {
|
||||
@@ -173,11 +165,6 @@ void MapContext::update() {
|
||||
updated |= data.transform.updateTransitions(now);
|
||||
transformState = data.transform.currentState();
|
||||
|
||||
if (updated & static_cast<UpdateType>(Update::Debug)) {
|
||||
assert(painter);
|
||||
painter->setDebug(data.getDebug());
|
||||
}
|
||||
|
||||
if (style) {
|
||||
if (updated & static_cast<UpdateType>(Update::DefaultTransitionDuration)) {
|
||||
style->setDefaultTransitionDuration(data.getDefaultTransitionDuration());
|
||||
@@ -230,8 +217,13 @@ void MapContext::render() {
|
||||
env.performCleanup();
|
||||
|
||||
assert(style);
|
||||
assert(painter);
|
||||
|
||||
if (!painter) {
|
||||
painter = util::make_unique<Painter>(*spriteAtlas, *glyphAtlas, *lineAtlas);
|
||||
painter->setup();
|
||||
}
|
||||
|
||||
painter->setDebug(data.getDebug());
|
||||
painter->render(*style, transformState, data.getAnimationTime());
|
||||
|
||||
if (data.mode == MapMode::Still && callback && style->isLoaded() && resourceLoader->getSprite()->isLoaded()) {
|
||||
|
||||
@@ -35,7 +35,7 @@ struct LatLngBounds;
|
||||
|
||||
class MapContext : public ResourceLoader::Observer {
|
||||
public:
|
||||
MapContext(uv_loop_t*, View&, FileSource&, MapData&, bool startPaused);
|
||||
MapContext(uv_loop_t*, View&, FileSource&, MapData&);
|
||||
~MapContext();
|
||||
|
||||
void pause();
|
||||
|
||||
Reference in New Issue
Block a user