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; +}