MythTV
master
libs
libmythui
opengl
mythpainterwindowopengl.cpp
Go to the documentation of this file.
1
// MythTV
2
#include "
mythmainwindow.h
"
3
#include "
opengl/mythpainterwindowopengl.h
"
4
5
#define LOC QString("GLPaintWin: ")
6
7
MythPainterWindowOpenGL::MythPainterWindowOpenGL
(
MythMainWindow
*MainWin)
8
:
MythPainterWindow
(MainWin),
9
m_parent(MainWin)
10
{
11
setAttribute(Qt::WA_NoSystemBackground);
12
setAttribute(Qt::WA_NativeWindow);
13
setAttribute(Qt::WA_DontCreateNativeAncestors);
14
winId();
15
#ifdef Q_OS_MACOS
16
// must be visible before OpenGL initialisation on OSX
17
setVisible(
true
);
18
#endif
19
MythRenderOpenGL
*render =
MythRenderOpenGL::Create
(
this
);
20
if
(render)
21
{
22
m_render
= render;
23
if
(render->
Init
() && render->
IsRecommendedRenderer
())
24
m_valid
=
true
;
25
}
26
else
27
{
28
LOG
(VB_GENERAL, LOG_ERR,
LOC
+
"Failed to create MythRenderOpenGL"
);
29
}
30
}
31
32
QPaintEngine *
MythPainterWindowOpenGL::paintEngine
(
void
)
const
33
{
34
return
testAttribute(Qt::WA_PaintOnScreen) ? nullptr :
m_parent
->
paintEngine
();
35
}
36
37
MythPainterWindowOpenGL::~MythPainterWindowOpenGL
()
38
{
39
if
(
m_render
)
40
m_render
->
DecrRef
();
41
}
42
43
bool
MythPainterWindowOpenGL::IsValid
(
void
)
const
44
{
45
return
m_valid
;
46
}
47
48
void
MythPainterWindowOpenGL::paintEvent
(QPaintEvent*
/*PaintEvent*/
)
49
{
50
m_parent
->
drawScreen
();
51
}
MythRenderOpenGL::Init
bool Init(void)
Definition:
mythrenderopengl.cpp:210
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition:
referencecounter.cpp:125
MythPainterWindowOpenGL::m_valid
bool m_valid
Definition:
mythpainterwindowopengl.h:25
MythPainterWindowOpenGL::~MythPainterWindowOpenGL
~MythPainterWindowOpenGL() override
Definition:
mythpainterwindowopengl.cpp:37
MythPainterWindowOpenGL::paintEngine
QPaintEngine * paintEngine(void) const override
Definition:
mythpainterwindowopengl.cpp:32
MythPainterWindow
Definition:
mythpainterwindow.h:38
MythPainterWindowOpenGL::IsValid
bool IsValid(void) const
Definition:
mythpainterwindowopengl.cpp:43
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition:
mythlogging.h:39
MythPainterWindowOpenGL::MythPainterWindowOpenGL
MythPainterWindowOpenGL(MythMainWindow *MainWin)
Definition:
mythpainterwindowopengl.cpp:7
LOC
#define LOC
Definition:
mythpainterwindowopengl.cpp:5
MythPainterWindow::m_render
MythRender * m_render
Definition:
mythpainterwindow.h:62
MythRenderOpenGL
Definition:
mythrenderopengl.h:100
MythMainWindow::paintEngine
QPaintEngine * paintEngine() const override
Definition:
mythmainwindow.cpp:472
MythRenderOpenGL::Create
static MythRenderOpenGL * Create(QWidget *Widget)
Definition:
mythrenderopengl.cpp:81
MythPainterWindowOpenGL::paintEvent
void paintEvent(QPaintEvent *PaintEvent) override
Definition:
mythpainterwindowopengl.cpp:48
MythPainterWindowOpenGL::m_parent
MythMainWindow * m_parent
Definition:
mythpainterwindowopengl.h:24
MythRenderOpenGL::IsRecommendedRenderer
bool IsRecommendedRenderer(void)
Definition:
mythrenderopengl.cpp:465
mythmainwindow.h
MythMainWindow
Definition:
mythmainwindow.h:28
MythMainWindow::drawScreen
void drawScreen(QPaintEvent *Event=nullptr)
Definition:
mythmainwindow.cpp:376
mythpainterwindowopengl.h
Generated on Sat Dec 2 2023 03:22:25 for MythTV by
1.8.17