Skip to content

Commit

Permalink
libmythui: Add a type enumeration to the MythRender classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Kendall committed Mar 28, 2011
1 parent 5638997 commit 62f4a70
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 19 deletions.
15 changes: 14 additions & 1 deletion mythtv/libs/libmythui/mythrender_base.h
Expand Up @@ -3,6 +3,16 @@

#include <QSize>

typedef enum
{
kRenderUnknown = 0,
kRenderDirect3D9,
kRenderVDPAU,
kRenderOpenGL1,
kRenderOpenGL2,
kRenderOpenGL2ES,
} RenderType;

typedef enum
{
kMasterUI = 0,
Expand All @@ -12,14 +22,17 @@ typedef enum
class MythRender
{
public:
MythRender() : m_master(kMasterUI), m_size(QSize()), m_errored(false) { }
MythRender(RenderType type)
: m_type(type), m_master(kMasterUI), m_size(QSize()), m_errored(false) { }
virtual ~MythRender() { }

RenderType Type(void) { return m_type; }
void SetMaster(RenderMaster master) { m_master = master; }
bool IsErrored(void) const { return m_errored; }
QSize GetSize(void) const { return m_size; }

protected:
RenderType m_type;
RenderMaster m_master;
QSize m_size;
bool m_errored;
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythui/mythrender_d3d9.cpp
Expand Up @@ -188,7 +188,8 @@ void* MythRenderD3D9::ResolveAddress(const char* lib, const char* proc)
}

MythRenderD3D9::MythRenderD3D9(void)
: m_d3d(NULL), m_rootD3DDevice(NULL),
: MythRender(kRenderDirect3D9),
m_d3d(NULL), m_rootD3DDevice(NULL),
m_adaptor_fmt(D3DFMT_UNKNOWN),
m_videosurface_fmt(D3DFMT_UNKNOWN),
m_surface_fmt(D3DFMT_UNKNOWN), m_texture_fmt(D3DFMT_A8R8G8B8),
Expand Down
9 changes: 5 additions & 4 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Expand Up @@ -57,13 +57,14 @@ MythRenderOpenGL* MythRenderOpenGL::Create(const QGLFormat& format, QPaintDevice
#endif
}

MythRenderOpenGL::MythRenderOpenGL(const QGLFormat& format, QPaintDevice* device)
: QGLContext(format, device)
MythRenderOpenGL::MythRenderOpenGL(const QGLFormat& format, QPaintDevice* device,
RenderType type)
: QGLContext(format, device), MythRender(type)
{
}

MythRenderOpenGL::MythRenderOpenGL(const QGLFormat& format)
: QGLContext(format)
MythRenderOpenGL::MythRenderOpenGL(const QGLFormat& format, RenderType type)
: QGLContext(format), MythRender(type)
{
}

Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythui/mythrender_opengl.h
Expand Up @@ -101,8 +101,9 @@ class MUI_PUBLIC MythRenderOpenGL : public QGLContext, public MythRender
static MythRenderOpenGL* Create(const QGLFormat& format,
QPaintDevice* device = NULL);

MythRenderOpenGL(const QGLFormat& format, QPaintDevice* device);
MythRenderOpenGL(const QGLFormat& format);
MythRenderOpenGL(const QGLFormat& format, QPaintDevice* device,
RenderType type = kRenderUnknown);
MythRenderOpenGL(const QGLFormat& format, RenderType type = kRenderUnknown);
virtual ~MythRenderOpenGL();

virtual void makeCurrent();
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythrender_opengl1.cpp
Expand Up @@ -4,14 +4,14 @@
#define LOC_ERR QString("OpenGL1 Error: ")

MythRenderOpenGL1::MythRenderOpenGL1(const QGLFormat& format, QPaintDevice* device)
: MythRenderOpenGL(format, device)
: MythRenderOpenGL(format, device, kRenderOpenGL1)
{
ResetVars();
ResetProcs();
}

MythRenderOpenGL1::MythRenderOpenGL1(const QGLFormat& format)
: MythRenderOpenGL(format)
: MythRenderOpenGL(format, kRenderOpenGL1)
{
ResetVars();
ResetProcs();
Expand Down
10 changes: 6 additions & 4 deletions mythtv/libs/libmythui/mythrender_opengl2.cpp
Expand Up @@ -134,15 +134,17 @@ class MythGLShaderObject
GLuint m_fragment_shader;
};

MythRenderOpenGL2::MythRenderOpenGL2(const QGLFormat& format, QPaintDevice* device)
: MythRenderOpenGL(format, device)
MythRenderOpenGL2::MythRenderOpenGL2(const QGLFormat& format,
QPaintDevice* device,
RenderType type)
: MythRenderOpenGL(format, device, type)
{
ResetVars();
ResetProcs();
}

MythRenderOpenGL2::MythRenderOpenGL2(const QGLFormat& format)
: MythRenderOpenGL(format)
MythRenderOpenGL2::MythRenderOpenGL2(const QGLFormat& format, RenderType type)
: MythRenderOpenGL(format, type)
{
ResetVars();
ResetProcs();
Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmythui/mythrender_opengl2.h
Expand Up @@ -20,8 +20,9 @@ class MythGLShaderObject;
class MUI_PUBLIC MythRenderOpenGL2 : public MythRenderOpenGL
{
public:
MythRenderOpenGL2(const QGLFormat& format, QPaintDevice* device);
MythRenderOpenGL2(const QGLFormat& format);
MythRenderOpenGL2(const QGLFormat& format, QPaintDevice* device,
RenderType type = kRenderOpenGL2);
MythRenderOpenGL2(const QGLFormat& format, RenderType type = kRenderOpenGL2);
virtual ~MythRenderOpenGL2();

virtual uint CreateShaderObject(const QString &vert, const QString &frag);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythrender_opengl2es.h
Expand Up @@ -7,12 +7,12 @@ class MUI_PUBLIC MythRenderOpenGL2ES : public MythRenderOpenGL2
{
public:
MythRenderOpenGL2ES(const QGLFormat& format, QPaintDevice* device)
: MythRenderOpenGL2(format, device)
: MythRenderOpenGL2(format, device, kRenderOpenGL2ES)
{
}

MythRenderOpenGL2ES(const QGLFormat& format)
: MythRenderOpenGL2(format)
: MythRenderOpenGL2(format, kRenderOpenGL2ES)
{
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythrender_vdpau.cpp
Expand Up @@ -251,7 +251,7 @@ bool MythRenderVDPAU::gVDPAUMPEG4Accel = false;
uint MythRenderVDPAU::gVDPAUBestScaling = 0;

MythRenderVDPAU::MythRenderVDPAU()
: m_preempted(false), m_recreating(false),
: MythRender(kRenderVDPAU), m_preempted(false), m_recreating(false),
m_recreated(false), m_reset_video_surfaces(false),
m_render_lock(QMutex::Recursive), m_decode_lock(QMutex::Recursive),
m_display(NULL), m_window(0), m_device(0), m_surface(0),
Expand Down

0 comments on commit 62f4a70

Please sign in to comment.