From bf73c9b36ebc8098f257d51bd668c994b7ceb4e1 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Thu, 19 Nov 2015 08:51:52 +0300 Subject: [PATCH] Calculation visual scale by DPI. --- base/base.pro | 1 + base/visual_scale.hpp | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 base/visual_scale.hpp diff --git a/base/base.pro b/base/base.pro index 68df155c41..b08a697600 100644 --- a/base/base.pro +++ b/base/base.pro @@ -83,4 +83,5 @@ HEADERS += \ threaded_priority_queue.hpp \ timegm.hpp \ timer.hpp \ + visual_scale.hpp \ worker_thread.hpp \ diff --git a/base/visual_scale.hpp b/base/visual_scale.hpp new file mode 100644 index 0000000000..9b8fe1944d --- /dev/null +++ b/base/visual_scale.hpp @@ -0,0 +1,11 @@ +#pragma once + +inline double VisualScale(double exactDensityDPI) +{ + double const mdpiDensityDPI = 160.; + // For some old devices (for example iPad 2) the density could be less than 160 DPI. + // Returns one in that case to keep readable text on the map. + if (exactDensityDPI <= mdpiDensityDPI) + return 1.; + return exactDensityDPI / mdpiDensityDPI; +}