summaryrefslogtreecommitdiff
path: root/benchmark/src/mbgl/benchmark/util.cpp
blob: a56279886f6e04d12b70f4ce0addf1f2f9282ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <mbgl/benchmark/util.hpp>
#include <mbgl/gl/offscreen_view.hpp>

#include <mbgl/map/map.hpp>
#include <mbgl/map/view.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/run_loop.hpp>

namespace mbgl {
namespace benchmark {

void render(Map& map, OffscreenView& view) {
    PremultipliedImage result;
    map.renderStill([&](std::exception_ptr) {
        result = view.readStillImage();
    });

    while (!result.valid()) {
        util::RunLoop::Get()->runOnce();
    }
}

} // namespace benchmark
} // namespace mbgl