Welcome to mirror list, hosted at ThFree Co, Russian Federation.

drape_global.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d3933057d0f04655df00bf1aeb0c00968b0c34e5 (plain)
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
#pragma once

#include "color.hpp"

#include "base/assert.hpp"

namespace dp
{
enum ApiVersion
{
  OpenGLES2 = 0,
  OpenGLES3
};

enum TextureFormat
{
  RGBA8,
  ALPHA,
  UNSPECIFIED
};

inline uint8_t GetBytesPerPixel(TextureFormat format)
{
  uint8_t result = 0;
  switch (format)
  {
  case RGBA8: result = 4; break;
  case ALPHA: result = 1; break;
  default: ASSERT(false, ()); break;
  }
  return result;
}

enum Anchor
{
  Center = 0,
  Left = 0x1,
  Right = Left << 1,
  Top = Right << 1,
  Bottom = Top << 1,
  LeftTop = Left | Top,
  RightTop = Right | Top,
  LeftBottom = Left | Bottom,
  RightBottom = Right | Bottom
};

enum LineCap
{
  SquareCap = -1,
  RoundCap = 0,
  ButtCap = 1,
};

enum LineJoin
{
  MiterJoin = -1,
  BevelJoin = 0,
  RoundJoin = 1,
};

struct FontDecl
{
  FontDecl() = default;
  FontDecl(Color const & color, float size, bool isSdf = true,
           Color const & outlineColor = Color::Transparent())
    : m_color(color), m_outlineColor(outlineColor), m_size(size), m_isSdf(isSdf)
  {
  }

  Color m_color = Color::Transparent();
  Color m_outlineColor = Color::Transparent();
  float m_size = 0;
  bool m_isSdf = true;
};

inline std::string DebugPrint(dp::ApiVersion apiVersion)
{
  if (apiVersion == dp::OpenGLES2)
    return "OpenGLES2";
  else if (apiVersion == dp::OpenGLES3)
    return "OpenGLES3";
  return "Unknown";
}
}  // namespace dp