[core] Render from the main thread

Do not create a thread for the MapContext anymore.
This commit is contained in:
John Firebaugh
2015-09-01 15:07:17 +03:00
parent 18d8e80f52
commit 204c7fee03
35 changed files with 268 additions and 525 deletions

View File

@@ -18,10 +18,7 @@ public:
void activate() override {};
void deactivate() override {};
void notify() override {};
void invalidate() override {}
void beforeRender() override {}
void afterRender() override {}
};
}

View File

@@ -5,6 +5,7 @@
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mapbox/pixelmatch.hpp>
@@ -86,11 +87,16 @@ Server::~Server() {
}
PremultipliedImage render(Map& map) {
std::promise<PremultipliedImage> promise;
map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) {
promise.set_value(std::move(image));
PremultipliedImage result;
map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) {
result = std::move(image);
});
return promise.get_future().get();
while (!result.size()) {
util::RunLoop::Get()->runOnce();
}
return result;
}
void checkImage(const std::string& base,