Add ratio argument to render.cpp (#7161)
This commit is contained in:
committed by
GitHub
parent
edb487b74d
commit
5a4b73f3be
@@ -27,6 +27,7 @@ int main(int argc, char *argv[]) {
|
||||
double bearing = 0;
|
||||
double pitch = 0;
|
||||
|
||||
uint32_t pixelRatio = 1;
|
||||
uint32_t width = 512;
|
||||
uint32_t height = 512;
|
||||
static std::string output = "out.png";
|
||||
@@ -46,6 +47,7 @@ int main(int argc, char *argv[]) {
|
||||
("pitch,p", po::value(&pitch)->value_name("degrees")->default_value(pitch), "Pitch")
|
||||
("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")
|
||||
@@ -84,9 +86,9 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
HeadlessBackend backend;
|
||||
OffscreenView view(backend.getContext(), { width, height });
|
||||
OffscreenView view(backend.getContext(), { width * pixelRatio, height * pixelRatio });
|
||||
ThreadPool threadPool(4);
|
||||
Map map(backend, view.size, 1, fileSource, threadPool, MapMode::Still);
|
||||
Map map(backend, mbgl::Size { width, height }, pixelRatio, fileSource, threadPool, MapMode::Still);
|
||||
|
||||
map.setStyleJSON(style);
|
||||
map.setClasses(classes);
|
||||
|
||||
Reference in New Issue
Block a user