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