-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathGLVideoView.cpp
More file actions
54 lines (42 loc) · 1.33 KB
/
GLVideoView.cpp
File metadata and controls
54 lines (42 loc) · 1.33 KB
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
#include "GLVideoView.h"
#include <util/ScreenHelper.h>
#include "Interfaces/IController/IController.h"
#include "Model/TextureObject.h"
GLVideoView::GLVideoView(QWidget* parent,
IController* controller,
IModel* model)
: IViewOpenGLWidget(parent, controller, model)
{
}
GLVideoView::~GLVideoView()
{
}
void GLVideoView::paintGL()
{
TextureObject* textureObject = dynamic_cast<TextureObject*>(getModel());
QImage img = textureObject->get();
QPainter painter(this);
painter.setBrush(QColor(0, 0, 0));
painter.drawRect(QRect(0, 0, this->width(), this->height()));
painter.setBrush(QColor(0, 0, 0, 0));
QRect window;
QRect viewport;
const float viewport_skew =
BioTracker::Core::ScreenHelper::calculate_viewport(
textureObject->width(),
textureObject->height(),
this->width(),
this->height(),
window,
viewport);
painter.setWindow(window);
painter.setViewport(viewport);
QRectF target(0, 0, textureObject->width(), textureObject->height());
QRectF source(0, 0, textureObject->width(), textureObject->height());
painter.drawImage(target, img, source);
QPainter p(this);
}
void GLVideoView::getNotified()
{
this->update();
}