MythTV  master
mythrender_base.h
Go to the documentation of this file.
1 #ifndef MYTHRENDER_H_
2 #define MYTHRENDER_H_
3 
4 // Qt
5 #include <QString>
6 #include <QMutex>
7 #include <QSize>
8 #include <QStringList>
9 
10 // MythTV
11 #include "referencecounter.h"
12 #include "mythuiexp.h"
13 
15 {
20 };
21 
23 {
24  public:
26  ReferenceCounter(QString("MythRender:%1").arg(type)),
27  m_type(type), m_size(QSize()), m_errored(false)
28  {
29  }
30 
33  bool IsShared(void) const
34  {
35  return const_cast<QAtomicInt&>(m_referenceCount)
36  .fetchAndAddOrdered(0) > 1;
37  }
38 
39  RenderType Type(void) const { return m_type; }
40  bool IsErrored(void) const { return m_errored; }
41  QSize GetSize(void) const { return m_size; }
42  virtual QStringList GetDescription(void) { return QStringList(); }
43 
44  protected:
45  ~MythRender() override = default;
46  virtual void ReleaseResources(void) { }
47 
49  QSize m_size;
50  bool m_errored;
51 };
52 
53 #endif
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
MythRender::GetDescription
virtual QStringList GetDescription(void)
Definition: mythrender_base.h:42
MythRender::IsErrored
bool IsErrored(void) const
Definition: mythrender_base.h:40
MythRender::m_errored
bool m_errored
Definition: mythrender_base.h:50
arg
arg(title).arg(filename).arg(doDelete))
kRenderOpenGL
@ kRenderOpenGL
Definition: mythrender_base.h:18
kRenderVulkan
@ kRenderVulkan
Definition: mythrender_base.h:19
MythRender::~MythRender
~MythRender() override=default
RenderType
RenderType
Definition: mythrender_base.h:15
kRenderUnknown
@ kRenderUnknown
Definition: mythrender_base.h:16
MythRender::ReleaseResources
virtual void ReleaseResources(void)
Definition: mythrender_base.h:46
referencecounter.h
MythRender::m_type
RenderType m_type
Definition: mythrender_base.h:48
MythRender
Definition: mythrender_base.h:23
MythRender::IsShared
bool IsShared(void) const
Warning: The reference count can be decremented between the call to this function and the use of it's...
Definition: mythrender_base.h:33
MythRender::m_size
QSize m_size
Definition: mythrender_base.h:49
ReferenceCounter::m_referenceCount
QAtomicInt m_referenceCount
Definition: referencecounter.h:57
MythRender::Type
RenderType Type(void) const
Definition: mythrender_base.h:39
MythRender::MythRender
MythRender(RenderType type)
Definition: mythrender_base.h:25
kRenderDirect3D9
@ kRenderDirect3D9
Definition: mythrender_base.h:17
mythuiexp.h
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:27
MythRender::GetSize
QSize GetSize(void) const
Definition: mythrender_base.h:41