summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-06 13:23:50 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-10-25 13:52:36 -0700
commit5cc390d694fc7510d445310d8eb9e32429a5e67b (patch)
tree7a24706f919ac3e8154be8b4ce33aed5bf42188d /bin
parent45f4dc0166f2d609d014d2174209fdbe1994c943 (diff)
downloadqtlocation-mapboxgl-5cc390d694fc7510d445310d8eb9e32429a5e67b.tar.gz
[core] separate Backend from View for headless rendering
Diffstat (limited to 'bin')
-rw-r--r--bin/glfw.cpp8
-rw-r--r--bin/render.cpp5
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/glfw.cpp b/bin/glfw.cpp
index c0d61820f8..44713d7532 100644
--- a/bin/glfw.cpp
+++ b/bin/glfw.cpp
@@ -16,7 +16,7 @@
namespace {
-std::unique_ptr<GLFWView> view;
+GLFWView* view = nullptr;
}
@@ -104,7 +104,8 @@ int main(int argc, char *argv[]) {
mbgl::Log::Info(mbgl::Event::General, "BENCHMARK MODE: Some optimizations are disabled.");
}
- view = std::make_unique<GLFWView>(fullscreen, benchmark);
+ GLFWView backend(fullscreen, benchmark);
+ view = &backend;
mbgl::DefaultFileSource fileSource("/tmp/mbgl-cache.db", ".");
@@ -118,7 +119,7 @@ int main(int argc, char *argv[]) {
mbgl::ThreadPool threadPool(4);
- mbgl::Map map(*view, fileSource, threadPool);
+ mbgl::Map map(backend, backend, backend.getPixelRatio(), fileSource, threadPool);
// Load settings
mbgl::Settings_JSON settings;
@@ -181,5 +182,6 @@ int main(int argc, char *argv[]) {
"Exit location: --lat=\"%f\" --lon=\"%f\" --zoom=\"%f\" --bearing \"%f\"",
settings.latitude, settings.longitude, settings.zoom, settings.bearing);
+ view = nullptr;
return 0;
}
diff --git a/bin/render.cpp b/bin/render.cpp
index e4d9951c05..f9574d0523 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -3,7 +3,7 @@
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
-#include <mbgl/platform/default/headless_display.hpp>
+#include <mbgl/platform/default/headless_backend.hpp>
#include <mbgl/platform/default/headless_view.hpp>
#include <mbgl/platform/default/thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
@@ -84,9 +84,10 @@ int main(int argc, char *argv[]) {
fileSource.setAccessToken(std::string(token));
}
+ HeadlessBackend backend;
HeadlessView view(pixelRatio, width, height);
ThreadPool threadPool(4);
- Map map(view, fileSource, threadPool, MapMode::Still);
+ Map map(backend, view, view.getPixelRatio(), fileSource, threadPool, MapMode::Still);
map.setStyleJSON(style);
map.setClasses(classes);