diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-09-01 15:07:17 +0300 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-04-14 13:44:08 -0700 |
commit | 204c7fee032bf8509747046b43a788366a189ae7 (patch) | |
tree | 8719b7ab8838bea52babd8bf42f2234ddc43dc9a /test/src/mbgl/test/util.cpp | |
parent | 18d8e80f52345a13236ae1da99b5866e7643f85b (diff) | |
download | qtlocation-mapboxgl-204c7fee032bf8509747046b43a788366a189ae7.tar.gz |
[core] Render from the main thread
Do not create a thread for the MapContext anymore.
Diffstat (limited to 'test/src/mbgl/test/util.cpp')
-rw-r--r-- | test/src/mbgl/test/util.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp index ca2282a4b5..4021fd89b1 100644 --- a/test/src/mbgl/test/util.cpp +++ b/test/src/mbgl/test/util.cpp @@ -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, |