summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-10 17:16:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-10-25 13:52:36 -0700
commita4d259c33f9bb890bba97fd89552720e3e0ec09b (patch)
tree342ecc27a6993c48f3a2e1d739fce890350bc44d /benchmark
parent5cc390d694fc7510d445310d8eb9e32429a5e67b (diff)
downloadqtlocation-mapboxgl-a4d259c33f9bb890bba97fd89552720e3e0ec09b.tar.gz
[core] move gl::Context to Backend and refactor View
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/api/query.benchmark.cpp10
-rw-r--r--benchmark/src/mbgl/benchmark/util.cpp8
-rw-r--r--benchmark/src/mbgl/benchmark/util.hpp3
3 files changed, 11 insertions, 10 deletions
diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp
index 5fa6a84db7..5a95cd7666 100644
--- a/benchmark/api/query.benchmark.cpp
+++ b/benchmark/api/query.benchmark.cpp
@@ -3,7 +3,7 @@
#include <mbgl/benchmark/util.hpp>
#include <mbgl/map/map.hpp>
#include <mbgl/platform/default/headless_backend.hpp>
-#include <mbgl/platform/default/headless_view.hpp>
+#include <mbgl/platform/default/offscreen_view.hpp>
#include <mbgl/platform/default/thread_pool.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -29,17 +29,15 @@ public:
auto image = std::make_unique<SpriteImage>(std::move(decoded), 1.0);
map.addImage("test-icon", std::move(image));
- view.resize(1000, 1000);
-
- mbgl::benchmark::render(map);
+ mbgl::benchmark::render(map, view);
}
util::RunLoop loop;
HeadlessBackend backend;
- HeadlessView view;
+ OffscreenView view{ backend.getContext(), {{ 1000, 1000 }} };
DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." };
ThreadPool threadPool{ 4 };
- Map map{ backend, view, view.getPixelRatio(), fileSource, threadPool, MapMode::Still };
+ Map map{ backend, view.getSize(), 1, fileSource, threadPool, MapMode::Still };
ScreenBox box{{ 0, 0 }, { 1000, 1000 }};
};
diff --git a/benchmark/src/mbgl/benchmark/util.cpp b/benchmark/src/mbgl/benchmark/util.cpp
index a8f71f1206..39c5f86883 100644
--- a/benchmark/src/mbgl/benchmark/util.cpp
+++ b/benchmark/src/mbgl/benchmark/util.cpp
@@ -1,16 +1,18 @@
#include <mbgl/benchmark/util.hpp>
+#include <mbgl/platform/default/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) {
+void render(Map& map, OffscreenView& view) {
PremultipliedImage result;
- map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) {
- result = std::move(image);
+ map.renderStill(view, [&](std::exception_ptr) {
+ result = view.readStillImage();
});
while (!result.size()) {
diff --git a/benchmark/src/mbgl/benchmark/util.hpp b/benchmark/src/mbgl/benchmark/util.hpp
index 759015e0e3..73acfb69d5 100644
--- a/benchmark/src/mbgl/benchmark/util.hpp
+++ b/benchmark/src/mbgl/benchmark/util.hpp
@@ -3,10 +3,11 @@
namespace mbgl {
class Map;
+class OffscreenView;
namespace benchmark {
-void render(Map&);
+void render(Map&, OffscreenView&);
} // namespace benchmark
} // namespace mbgl