From 5e2b6bf636472a4464e6ab3ae0d9d01c68de041b Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Thu, 7 Mar 2019 14:29:19 +0200 Subject: [core] Add MapOptions to define properties of Map To simplify the Map constructor, introduce MapOptions interface to define the properties that can be set on a Map. --- benchmark/api/query.benchmark.cpp | 4 +++- benchmark/api/render.benchmark.cpp | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'benchmark') diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 8d060087de..275a79372c 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include @@ -34,7 +35,8 @@ public: DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." }; ThreadPool threadPool{ 4 }; HeadlessFrontend frontend { { 1000, 1000 }, 1, fileSource, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, fileSource, threadPool, MapMode::Static}; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, + fileSource, threadPool, MapOptions().withMapMode(MapMode::Static) }; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; }; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 3362da1a4f..8709f18d9c 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -41,7 +42,8 @@ static void prepare(Map& map, optional json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, + bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; prepare(map); while (state.KeepRunning()) { @@ -52,7 +54,8 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, + bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; while (state.KeepRunning()) { prepare(map, { "{}" }); @@ -67,7 +70,8 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { while (state.KeepRunning()) { HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Static}; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, + bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; prepare(map); frontend.render(map); } -- cgit v1.2.1