MythTV  master
mythpainter_ogl.h
Go to the documentation of this file.
1 #ifndef MYTHPAINTER_OPENGL_H_
2 #define MYTHPAINTER_OPENGL_H_
3 
4 #include <QMutex>
5 
6 #include <list>
7 
8 #include "mythpainter.h"
9 #include "mythimage.h"
10 
11 class QWidget;
12 class MythRenderOpenGL;
13 
15 {
16  friend class VideoOutputOpenGL;
17  public:
18  MythOpenGLPainter(MythRenderOpenGL *render = nullptr, QWidget *parent = nullptr);
20 
21  void SetTarget(int new_target) { target = new_target; }
22  void SetSwapControl(bool swap) { swapControl = swap; }
23  QString GetName(void) override // MythPainter
24  { return QString("OpenGL"); }
25  bool SupportsAnimation(void) override // MythPainter
26  { return true; }
27  bool SupportsAlpha(void) override // MythPainter
28  { return true; }
29  bool SupportsClipping(void) override // MythPainter
30  { return false; }
31  void FreeResources(void) override; // MythPainter
32  void Begin(QPaintDevice *parent) override; // MythPainter
33  void End() override; // MythPainter
34 
35  void DrawImage(const QRect &r, MythImage *im, const QRect &src,
36  int alpha) override; // MythPainter
37  void DrawRect(const QRect &area, const QBrush &fillBrush,
38  const QPen &linePen, int alpha) override; // MythPainter
39  void DrawRoundRect(const QRect &area, int cornerRadius,
40  const QBrush &fillBrush, const QPen &linePen,
41  int alpha) override; // MythPainter
42 
43  void PushTransformation(const UIEffects &fx, QPointF center = QPointF()) override; // MythPainter
44  void PopTransformation(void) override; // MythPainter
45  void DeleteTextures(void);
46 
47  protected:
48  MythImage* GetFormatImagePriv(void) override // MythPainter
49  { return new MythImage(this); }
50  void DeleteFormatImagePriv(MythImage *im) override; // MythPainter
51 
52  void ClearCache(void);
53  int GetTextureFromCache(MythImage *im);
54 
55  QWidget *realParent {nullptr};
56  MythRenderOpenGL *realRender {nullptr};
57  int target {0};
58  bool swapControl {true};
59 
60  QMap<MythImage *, uint> m_ImageIntMap;
61  std::list<MythImage *> m_ImageExpireList;
62  std::list<uint> m_textureDeleteList;
64 };
65 
66 #endif
static int swap(VideoFrame *frame, int datasize, int offset, int shift)
Definition: filter_vflip.c:24
void SetSwapControl(bool swap)
std::list< uint > m_textureDeleteList
virtual void DrawRoundRect(const QRect &area, int cornerRadius, const QBrush &fillBrush, const QPen &linePen, int alpha)
bool SupportsClipping(void) override
void SetTarget(int new_target)
unsigned char r
Definition: ParseText.cpp:329
virtual void End()
Definition: mythpainter.h:51
bool SupportsAnimation(void) override
std::list< MythImage * > m_ImageExpireList
virtual void FreeResources(void)
Definition: mythpainter.h:49
virtual void PushTransformation(const UIEffects &zoom, QPointF center=QPointF())
virtual void DrawRect(const QRect &area, const QBrush &fillBrush, const QPen &linePen, int alpha)
virtual void DeleteFormatImagePriv(MythImage *im)=0
virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, int alpha)=0
#define MUI_PUBLIC
Definition: mythuiexp.h:9
QString GetName(void) override
bool SupportsAlpha(void) override
MythImage * GetFormatImagePriv(void) override
Creates a reference counted image, call DecrRef() to delete.
virtual void Begin(QPaintDevice *parent)
Definition: mythpainter.h:50
QMap< MythImage *, uint > m_ImageIntMap
virtual void PopTransformation(void)
Definition: mythpainter.h:82