MythTV  master
mythpainterwindowopengl.cpp
Go to the documentation of this file.
1 // MythTV
2 #include "mythmainwindow.h"
4 
5 #define LOC QString("GLPaintWin: ")
6 
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
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 
38 {
39  if (m_render)
40  m_render->DecrRef();
41 }
42 
44 {
45  return m_valid;
46 }
47 
48 void MythPainterWindowOpenGL::paintEvent(QPaintEvent* /*PaintEvent*/)
49 {
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:34
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:58
MythRenderOpenGL
Definition: mythrenderopengl.h:96
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