summaryrefslogtreecommitdiff
path: root/bin/render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/render.cpp')
-rw-r--r--bin/render.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/bin/render.cpp b/bin/render.cpp
index 0af933475a..51c6faef56 100644
--- a/bin/render.cpp
+++ b/bin/render.cpp
@@ -7,6 +7,7 @@
#include <mbgl/gl/offscreen_view.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
+#include <mbgl/style/style.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
@@ -27,14 +28,13 @@ int main(int argc, char *argv[]) {
double zoom = 0;
double bearing = 0;
double pitch = 0;
+ double pixelRatio = 1;
- uint32_t pixelRatio = 1;
uint32_t width = 512;
uint32_t height = 512;
static std::string output = "out.png";
std::string cache_file = "cache.sqlite";
std::string asset_root = ".";
- std::vector<std::string> classes;
std::string token;
bool debug = false;
@@ -49,7 +49,6 @@ int main(int argc, char *argv[]) {
("width,w", po::value(&width)->value_name("pixels")->default_value(width), "Image width")
("height,h", po::value(&height)->value_name("pixels")->default_value(height), "Image height")
("ratio,r", po::value(&pixelRatio)->value_name("number")->default_value(pixelRatio), "Image scale factor")
- ("class,c", po::value(&classes)->value_name("name"), "Class name")
("token,t", po::value(&token)->value_name("key")->default_value(token), "Mapbox access token")
("debug", po::bool_switch(&debug)->default_value(debug), "Debug mode")
("output,o", po::value(&output)->value_name("file")->default_value(output), "Output file name")
@@ -86,7 +85,8 @@ int main(int argc, char *argv[]) {
HeadlessBackend backend;
BackendScope scope { backend };
- OffscreenView view(backend.getContext(), { width * pixelRatio, height * pixelRatio });
+ OffscreenView view(backend.getContext(), { static_cast<uint32_t>(width * pixelRatio),
+ static_cast<uint32_t>(height * pixelRatio) });
ThreadPool threadPool(4);
Map map(backend, mbgl::Size { width, height }, pixelRatio, fileSource, threadPool, MapMode::Still);
@@ -94,10 +94,7 @@ int main(int argc, char *argv[]) {
style_path = std::string("file://") + style_path;
}
- map.setStyleURL(style_path);
-
- map.setClasses(classes);
-
+ map.getStyle().loadURL(style_path);
map.setLatLngZoom({ lat, lon }, zoom);
map.setBearing(bearing);
map.setPitch(pitch);