diff options
Diffstat (limited to 'benchmark/src')
-rw-r--r-- | benchmark/src/mbgl/benchmark/util.cpp | 22 | ||||
-rw-r--r-- | benchmark/src/mbgl/benchmark/util.hpp | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/benchmark/src/mbgl/benchmark/util.cpp b/benchmark/src/mbgl/benchmark/util.cpp new file mode 100644 index 0000000000..a8f71f1206 --- /dev/null +++ b/benchmark/src/mbgl/benchmark/util.cpp @@ -0,0 +1,22 @@ +#include <mbgl/benchmark/util.hpp> + +#include <mbgl/map/map.hpp> +#include <mbgl/util/image.hpp> +#include <mbgl/util/run_loop.hpp> + +namespace mbgl { +namespace benchmark { + +void render(Map& map) { + PremultipliedImage result; + map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) { + result = std::move(image); + }); + + while (!result.size()) { + util::RunLoop::Get()->runOnce(); + } +} + +} // namespace benchmark +} // namespace mbgl diff --git a/benchmark/src/mbgl/benchmark/util.hpp b/benchmark/src/mbgl/benchmark/util.hpp new file mode 100644 index 0000000000..759015e0e3 --- /dev/null +++ b/benchmark/src/mbgl/benchmark/util.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace mbgl { + +class Map; + +namespace benchmark { + +void render(Map&); + +} // namespace benchmark +} // namespace mbgl |