1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#pragma once
#include "geometry/rect2d.hpp"
#include "geometry/screenbase.hpp"
#include "std/atomic.hpp"
#include "std/cstdint.hpp"
#include "std/noncopyable.hpp"
namespace df
{
class VisualParams : private noncopyable
{
public:
static double const kMdpiScale;
static double const kHdpiScale;
static double const kXhdpiScale;
static double const k6plusScale;
static double const kXxhdpiScale;
static void Init(double vs, uint32_t tileSize);
static VisualParams & Instance();
VisualParams();
static string const & GetResourcePostfix(double visualScale);
string const & GetResourcePostfix() const;
double GetVisualScale() const;
uint32_t GetTileSize() const;
/// How many pixels around touch point are used to get bookmark or POI in consideration of visual scale.
uint32_t GetTouchRectRadius() const;
double GetDragThreshold() const;
double GetScaleThreshold() const;
struct GlyphVisualParams
{
float m_contrast;
float m_gamma;
float m_outlineContrast;
float m_outlineGamma;
float m_guiContrast;
float m_guiGamma;
};
GlyphVisualParams const & GetGlyphVisualParams() const;
uint32_t GetGlyphSdfScale() const;
uint32_t GetGlyphBaseSize() const;
double GetFontScale() const;
void SetFontScale(double fontScale);
private:
int m_tileSize;
double m_visualScale;
GlyphVisualParams m_glyphVisualParams;
atomic<double> m_fontScale;
};
m2::RectD const & GetWorldRect();
int GetTileScaleBase(ScreenBase const & s, uint32_t tileSize);
int GetTileScaleBase(ScreenBase const & s);
int GetTileScaleBase(m2::RectD const & r);
/// @return Adjusting base tile scale to look the same across devices with different
/// tile size and visual scale values.
int GetTileScaleIncrement(uint32_t tileSize, double visualScale);
int GetTileScaleIncrement();
int GetDrawTileScale(int baseScale, uint32_t tileSize, double visualScale);
int GetDrawTileScale(ScreenBase const & s, uint32_t tileSize, double visualScale);
int GetDrawTileScale(m2::RectD const & r, uint32_t tileSize, double visualScale);
int GetDrawTileScale(int baseScale);
int GetDrawTileScale(ScreenBase const & s);
int GetDrawTileScale(m2::RectD const & r);
m2::RectD GetRectForDrawScale(int drawScale, m2::PointD const & center, uint32_t tileSize, double visualScale);
m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center, uint32_t tileSize, double visualScale);
m2::RectD GetRectForDrawScale(int drawScale, m2::PointD const & center);
m2::RectD GetRectForDrawScale(double drawScale, m2::PointD const & center);
uint32_t CalculateTileSize(uint32_t screenWidth, uint32_t screenHeight);
double GetZoomLevel(double scale);
double GetNormalizedZoomLevel(double scale, int minZoom = 1);
double GetScale(double zoomLevel);
} // namespace df
|