blob: 886f3b4eabcb1e71e37411e8a00f89d4fd69ccc2 (
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
|
#include "drape_head/drape_surface.hpp"
#include "drape_frontend/viewport.hpp"
#include "base/logging.hpp"
DrapeSurface::DrapeSurface()
{
}
DrapeSurface::~DrapeSurface()
{
m_timer.stop();
m_drapeEngine.reset();
}
void DrapeSurface::initializeGL()
{
CreateEngine();
m_timer.setInterval(1000 / 30);
m_timer.setSingleShot(false);
connect(&m_timer, SIGNAL(timeout()), SLOT(update()));
m_timer.start();
}
void DrapeSurface::paintGL()
{
m_drapeEngine->Draw();
}
void DrapeSurface::resizeGL(int width, int height)
{
if (m_drapeEngine != nullptr)
{
float const vs = devicePixelRatio();
int const w = width * vs;
int const h = height * vs;
m_drapeEngine->Resize(w, h);
}
}
void DrapeSurface::CreateEngine()
{
float const pixelRatio = devicePixelRatio();
m_drapeEngine = make_unique_dp<df::TestingEngine>(df::Viewport(0, 0, pixelRatio * width(), pixelRatio * height()),
pixelRatio);
}
|