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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorExMix <rahuba.youri@mapswithme.com>2014-01-28 14:59:29 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:10:44 +0300
commit93bd500250017a0ed9701204366fbbc6435b1f58 (patch)
tree97c76085ca76102b24a69c82510f16eb04a5127e /drape_frontend/viewport.cpp
parentee1c1ef6c3b1aaa3a3c6ad7a62d255bae90d7fb3 (diff)
[drape] device-independent viewport
Diffstat (limited to 'drape_frontend/viewport.cpp')
-rw-r--r--drape_frontend/viewport.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/drape_frontend/viewport.cpp b/drape_frontend/viewport.cpp
new file mode 100644
index 0000000000..351deafaa9
--- /dev/null
+++ b/drape_frontend/viewport.cpp
@@ -0,0 +1,46 @@
+#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::GetX0() const
+ {
+ return m_zero.x;
+ }
+
+ uint32_t Viewport::GetY0() const
+ {
+ return m_zero.y;
+ }
+
+ uint32_t Viewport::GetWidth() const
+ {
+ return m_size.x;
+ }
+
+ uint32_t Viewport::GetHeight() const
+ {
+ return m_size.y;
+ }
+
+ void Viewport::Apply() const
+ {
+ GLFunctions::glViewport(m_zero.x * m_pixelRatio, m_zero.y * m_pixelRatio,
+ m_size.x * m_pixelRatio, m_size.y * m_pixelRatio);
+ }
+}