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

viewport.cpp « drape_frontend - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4d5e709e0b6845ee8ff43e297cbdbe421a0a486a (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
#include "viewport.hpp"
#include "../drape/glfunctions.hpp"

namespace df
{

Viewport::Viewport(float pixelRatio,
                   uint32_t x0, uint32_t y0,
                   uint32_t w, uint32_t h)
  : m_pixelRatio(pixelRatio)
  , m_zero(x0, y0)
  , m_size(w, h)
{
}

void Viewport::SetViewport(uint32_t x0, uint32_t y0, uint32_t w, uint32_t h)
{
  m_zero = m2::PointU(x0 ,y0);
  m_size = m2::PointU(w, h);
}

uint32_t Viewport::GetLogicX0() const
{
  return m_zero.x;
}

uint32_t Viewport::GetLogicY0() const
{
  return m_zero.y;
}

uint32_t Viewport::GetLogicWidth() const
{
  return m_size.x;
}

uint32_t Viewport::GetLogicHeight() const
{
  return m_size.y;
}

uint32_t Viewport::GetX0() const
{
  return GetLogicX0() * m_pixelRatio;
}

uint32_t Viewport::GetY0() const
{
  return GetLogicY0() * m_pixelRatio;
}

uint32_t Viewport::GetWidth() const
{
  return GetLogicWidth() * m_pixelRatio;
}

uint32_t Viewport::GetHeight() const
{
  return GetLogicHeight() * m_pixelRatio;
}

float Viewport::GetPixelRatio() const
{
  return m_pixelRatio;
}

void Viewport::Apply() const
{
  GLFunctions::glViewport(GetX0(), GetY0(), GetWidth(), GetHeight());
}

} // namespace df