MythTV  master
Public Slots | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MythOpenGLPainter Class Reference

#include <mythpainteropengl.h>

Inheritance diagram for MythOpenGLPainter:
Inheritance graph
[legend]
Collaboration diagram for MythOpenGLPainter:
Collaboration graph
[legend]

Public Slots

void CurrentDPIChanged (qreal DPI)
 

Public Member Functions

 MythOpenGLPainter (MythRenderOpenGL *Render=nullptr, QWidget *Parent=nullptr)
 
 ~MythOpenGLPainter () override
 
void SetTarget (QOpenGLFramebufferObject *NewTarget)
 
void SetSwapControl (bool Swap)
 
void DeleteTextures (void)
 
QString GetName (void) override
 
bool SupportsAnimation (void) override
 
bool SupportsAlpha (void) override
 
bool SupportsClipping (void) override
 
void FreeResources (void) override
 
void Begin (QPaintDevice *Parent) override
 
void End () override
 
void DrawImage (const QRect &Dest, MythImage *Image, const QRect &Source, int Alpha) override
 
void DrawRect (const QRect &Area, const QBrush &FillBrush, const QPen &LinePen, int Alpha) override
 Draw a rectangle. More...
 
void DrawRoundRect (const QRect &Area, int CornerRadius, const QBrush &FillBrush, const QPen &LinePen, int Alpha) override
 
void PushTransformation (const UIEffects &Fx, QPointF Center=QPointF()) override
 
void PopTransformation (void) override
 
- Public Member Functions inherited from MythPainter
 MythPainter ()
 
virtual ~MythPainter ()=default
 MythPainter destructor. More...
 
virtual void SetClipRect (const QRect &clipRect)
 
virtual void SetClipRegion (const QRegion &clipRegion)
 
virtual void Clear (QPaintDevice *device, const QRegion &region)
 
QPaintDevice * GetParent (void)
 
void DrawImage (int x, int y, MythImage *im, int alpha)
 
void DrawImage (const QPoint &topLeft, MythImage *im, int alph)
 
virtual void DrawText (const QRect &r, const QString &msg, int flags, const MythFontProperties &font, int alpha, const QRect &boundRect)
 
virtual void DrawTextLayout (const QRect &canvasRect, const LayoutVector &layouts, const FormatVector &formats, const MythFontProperties &font, int alpha, const QRect &destRect)
 
virtual void DrawEllipse (const QRect &area, const QBrush &fillBrush, const QPen &linePen, int alpha)
 
MythImageGetFormatImage ()
 Returns a blank reference counted image in the format required for the Draw functions for this painter. More...
 
void DeleteFormatImage (MythImage *im)
 
void SetDebugMode (bool showBorders, bool showNames)
 
bool ShowBorders (void) const
 
bool ShowTypeNames (void) const
 
void SetMaximumCacheSizes (int hardware, int software)
 

Protected Member Functions

void ClearCache (void)
 
MythGLTextureGetTextureFromCache (MythImage *Image)
 
MythImageGetFormatImagePriv (void) override
 Creates a reference counted image, call DecrRef() to delete. More...
 
void DeleteFormatImagePriv (MythImage *Image) override
 
- Protected Member Functions inherited from MythPainter
MythImageGetImageFromString (const QString &msg, int flags, const QRect &r, const MythFontProperties &font)
 
MythImageGetImageFromTextLayout (const LayoutVector &layouts, const FormatVector &formats, const MythFontProperties &font, QRect &canvas, QRect &dest)
 
MythImageGetImageFromRect (const QRect &area, int radius, int ellipse, const QBrush &fillBrush, const QPen &linePen)
 
void ExpireImages (int64_t max=0)
 
virtual void Teardown (void)
 
void CheckFormatImage (MythImage *im)
 

Protected Attributes

QWidget * m_widget { nullptr }
 
MythRenderOpenGLm_render { nullptr }
 
QOpenGLFramebufferObject * m_target { nullptr }
 
bool m_swapControl { true }
 
QSize m_lastSize { }
 
qreal m_pixelRatio { 1.0 }
 
MythDisplaym_display { nullptr }
 
bool m_usingHighDPI { false }
 
QMap< MythImage *, MythGLTexture * > m_imageToTextureMap
 
std::list< MythImage * > m_ImageExpireList
 
std::list< MythGLTexture * > m_textureDeleteList
 
QMutex m_textureDeleteLock
 
QVector< MythGLTexture * > m_mappedTextures
 
QOpenGLBuffer * m_mappedBufferPool [MAX_BUFFER_POOL] { nullptr }
 
int m_mappedBufferPoolIdx { 0 }
 
bool m_mappedBufferPoolReady { false }
 
- Protected Attributes inherited from MythPainter
QPaintDevice * m_parent {nullptr}
 
int m_hardwareCacheSize {0}
 
int m_maxHardwareCacheSize {0}
 

Additional Inherited Members

- Static Protected Member Functions inherited from MythPainter
static void DrawTextPriv (MythImage *im, const QString &msg, int flags, const QRect &r, const MythFontProperties &font)
 
static void DrawRectPriv (MythImage *im, const QRect &area, int radius, int ellipse, const QBrush &fillBrush, const QPen &linePen)
 

Detailed Description

Definition at line 24 of file mythpainteropengl.h.

Constructor & Destructor Documentation

◆ MythOpenGLPainter()

MythOpenGLPainter::MythOpenGLPainter ( MythRenderOpenGL Render = nullptr,
QWidget *  Parent = nullptr 
)
explicit

Definition at line 14 of file mythpainteropengl.cpp.

◆ ~MythOpenGLPainter()

MythOpenGLPainter::~MythOpenGLPainter ( )
override

Definition at line 30 of file mythpainteropengl.cpp.

Member Function Documentation

◆ SetTarget()

void MythOpenGLPainter::SetTarget ( QOpenGLFramebufferObject *  NewTarget)
inline

Definition at line 32 of file mythpainteropengl.h.

◆ SetSwapControl()

void MythOpenGLPainter::SetSwapControl ( bool  Swap)
inline

◆ DeleteTextures()

void MythOpenGLPainter::DeleteTextures ( void  )

Definition at line 67 of file mythpainteropengl.cpp.

Referenced by Begin(), FreeResources(), and GetTextureFromCache().

◆ GetName()

QString MythOpenGLPainter::GetName ( void  )
inlineoverridevirtual

Implements MythPainter.

Definition at line 37 of file mythpainteropengl.h.

◆ SupportsAnimation()

bool MythOpenGLPainter::SupportsAnimation ( void  )
inlineoverridevirtual

Implements MythPainter.

Definition at line 38 of file mythpainteropengl.h.

◆ SupportsAlpha()

bool MythOpenGLPainter::SupportsAlpha ( void  )
inlineoverridevirtual

Implements MythPainter.

Definition at line 39 of file mythpainteropengl.h.

◆ SupportsClipping()

bool MythOpenGLPainter::SupportsClipping ( void  )
inlineoverridevirtual

Implements MythPainter.

Definition at line 40 of file mythpainteropengl.h.

◆ FreeResources()

void MythOpenGLPainter::FreeResources ( void  )
overridevirtual

Reimplemented from MythPainter.

Definition at line 49 of file mythpainteropengl.cpp.

Referenced by MythVideoOutputOpenGL::Init(), and ~MythOpenGLPainter().

◆ Begin()

void MythOpenGLPainter::Begin ( QPaintDevice *  Parent)
overridevirtual

Reimplemented from MythPainter.

Definition at line 105 of file mythpainteropengl.cpp.

◆ End()

void MythOpenGLPainter::End ( )
overridevirtual

Reimplemented from MythPainter.

Definition at line 165 of file mythpainteropengl.cpp.

◆ DrawImage()

void MythOpenGLPainter::DrawImage ( const QRect &  Dest,
MythImage Image,
const QRect &  Source,
int  Alpha 
)
overridevirtual

Implements MythPainter.

Definition at line 255 of file mythpainteropengl.cpp.

◆ DrawRect()

void MythOpenGLPainter::DrawRect ( const QRect &  Area,
const QBrush &  FillBrush,
const QPen &  LinePen,
int  Alpha 
)
overridevirtual

Draw a rectangle.

If it is a simple rectangle, then use our own shaders for rendering (which saves texture memory but may not be as accurate as Qt rendering) otherwise fallback to Qt painting to a QImage, which is uploaded as a texture.

Note
If high DPI scaling is in use, just use Qt painting rather than handling all of the adjustments required for pen width etc etc.

Reimplemented from MythPainter.

Definition at line 298 of file mythpainteropengl.cpp.

◆ DrawRoundRect()

void MythOpenGLPainter::DrawRoundRect ( const QRect &  Area,
int  CornerRadius,
const QBrush &  FillBrush,
const QPen &  LinePen,
int  Alpha 
)
overridevirtual

Reimplemented from MythPainter.

Definition at line 310 of file mythpainteropengl.cpp.

◆ PushTransformation()

void MythOpenGLPainter::PushTransformation ( const UIEffects Fx,
QPointF  Center = QPointF() 
)
overridevirtual

Reimplemented from MythPainter.

Definition at line 335 of file mythpainteropengl.cpp.

◆ PopTransformation()

void MythOpenGLPainter::PopTransformation ( void  )
overridevirtual

Reimplemented from MythPainter.

Definition at line 341 of file mythpainteropengl.cpp.

◆ CurrentDPIChanged

void MythOpenGLPainter::CurrentDPIChanged ( qreal  DPI)
slot

Definition at line 98 of file mythpainteropengl.cpp.

Referenced by MythOpenGLPainter().

◆ ClearCache()

void MythOpenGLPainter::ClearCache ( void  )
protected

Definition at line 83 of file mythpainteropengl.cpp.

Referenced by FreeResources().

◆ GetTextureFromCache()

MythGLTexture * MythOpenGLPainter::GetTextureFromCache ( MythImage Image)
protected

Definition at line 186 of file mythpainteropengl.cpp.

Referenced by DrawImage().

◆ GetFormatImagePriv()

MythImage* MythOpenGLPainter::GetFormatImagePriv ( void  )
inlineoverrideprotectedvirtual

Creates a reference counted image, call DecrRef() to delete.

Implements MythPainter.

Definition at line 60 of file mythpainteropengl.h.

◆ DeleteFormatImagePriv()

void MythOpenGLPainter::DeleteFormatImagePriv ( MythImage Image)
overrideprotectedvirtual

Implements MythPainter.

Definition at line 324 of file mythpainteropengl.cpp.

Referenced by GetTextureFromCache().

Member Data Documentation

◆ m_widget

QWidget* MythOpenGLPainter::m_widget { nullptr }
protected

Definition at line 64 of file mythpainteropengl.h.

Referenced by Begin(), and MythOpenGLPainter().

◆ m_render

MythRenderOpenGL* MythOpenGLPainter::m_render { nullptr }
protected

◆ m_target

QOpenGLFramebufferObject* MythOpenGLPainter::m_target { nullptr }
protected

Definition at line 66 of file mythpainteropengl.h.

Referenced by Begin(), DrawImage(), DrawRect(), DrawRoundRect(), and End().

◆ m_swapControl

bool MythOpenGLPainter::m_swapControl { true }
protected

Definition at line 67 of file mythpainteropengl.h.

Referenced by Begin(), and End().

◆ m_lastSize

QSize MythOpenGLPainter::m_lastSize { }
protected

Definition at line 68 of file mythpainteropengl.h.

Referenced by Begin().

◆ m_pixelRatio

qreal MythOpenGLPainter::m_pixelRatio { 1.0 }
protected

Definition at line 69 of file mythpainteropengl.h.

Referenced by Begin(), CurrentDPIChanged(), and DrawImage().

◆ m_display

MythDisplay* MythOpenGLPainter::m_display { nullptr }
protected

Definition at line 70 of file mythpainteropengl.h.

Referenced by MythOpenGLPainter().

◆ m_usingHighDPI

bool MythOpenGLPainter::m_usingHighDPI { false }
protected

Definition at line 71 of file mythpainteropengl.h.

Referenced by Begin(), CurrentDPIChanged(), DrawRect(), and DrawRoundRect().

◆ m_imageToTextureMap

QMap<MythImage *, MythGLTexture*> MythOpenGLPainter::m_imageToTextureMap
protected

Definition at line 73 of file mythpainteropengl.h.

Referenced by ClearCache(), DeleteFormatImagePriv(), and GetTextureFromCache().

◆ m_ImageExpireList

std::list<MythImage *> MythOpenGLPainter::m_ImageExpireList
protected

Definition at line 74 of file mythpainteropengl.h.

Referenced by ClearCache(), DeleteFormatImagePriv(), and GetTextureFromCache().

◆ m_textureDeleteList

std::list<MythGLTexture*> MythOpenGLPainter::m_textureDeleteList
protected

Definition at line 75 of file mythpainteropengl.h.

Referenced by ClearCache(), DeleteFormatImagePriv(), and DeleteTextures().

◆ m_textureDeleteLock

QMutex MythOpenGLPainter::m_textureDeleteLock
protected

Definition at line 76 of file mythpainteropengl.h.

Referenced by ClearCache(), DeleteFormatImagePriv(), and DeleteTextures().

◆ m_mappedTextures

QVector<MythGLTexture*> MythOpenGLPainter::m_mappedTextures
protected

Definition at line 78 of file mythpainteropengl.h.

Referenced by DrawImage(), End(), and MythOpenGLPainter().

◆ m_mappedBufferPool

QOpenGLBuffer* MythOpenGLPainter::m_mappedBufferPool[MAX_BUFFER_POOL] { nullptr }
protected

Definition at line 79 of file mythpainteropengl.h.

Referenced by Begin(), DrawImage(), and FreeResources().

◆ m_mappedBufferPoolIdx

int MythOpenGLPainter::m_mappedBufferPoolIdx { 0 }
protected

Definition at line 80 of file mythpainteropengl.h.

Referenced by DrawImage().

◆ m_mappedBufferPoolReady

bool MythOpenGLPainter::m_mappedBufferPoolReady { false }
protected

Definition at line 81 of file mythpainteropengl.h.

Referenced by Begin(), and FreeResources().


The documentation for this class was generated from the following files: