MythTV  master
mythpainter_d3d9.h
Go to the documentation of this file.
1 #ifndef MYTHPAINTER_D3D9_H
2 #define MYTHPAINTER_D3D9_H
3 
4 #include <QMap>
5 
6 #include "mythpainter.h"
7 #include "mythimage.h"
8 #include "mythrender_d3d9.h"
9 #include "mythuiexp.h"
10 
11 class MythRenderD3D9;
12 
14 {
15  friend class VideoOutputD3D;
16  public:
17  explicit MythD3D9Painter(MythRenderD3D9 *render = nullptr);
18  ~MythD3D9Painter();
19 
20  void SetTarget(D3D9Image *target) { m_target = target; }
21  void SetSwapControl(bool swap) { m_swap_control = swap; }
22  QString GetName(void) override // MythPainter
23  { return QString("D3D9"); }
24  bool SupportsAnimation(void) override // MythPainter
25  { return true; }
26  bool SupportsAlpha(void) override // MythPainter
27  { return true; }
28  bool SupportsClipping(void) override // MythPainter
29  { return false; }
30  void FreeResources(void) override; // MythPainter
31  void Begin(QPaintDevice *parent) override; // MythPainter
32  void End() override; // MythPainter
33 
34  void DrawImage(const QRect &dest, MythImage *im, const QRect &src,
35  int alpha) override; // MythPainter
36  void DrawRect(const QRect &area, const QBrush &fillBrush,
37  const QPen &linePen, int alpha) override; // MythPainter
38 
39  protected:
40  MythImage* GetFormatImagePriv(void) override // MythPainter
41  { return new MythImage(this); }
42  void DeleteFormatImagePriv(MythImage *im) override; // MythPainter
43  void Teardown(void) override; // MythPainter
44 
45  bool InitD3D9(QPaintDevice *parent);
46  void ClearCache(void);
47  void DeleteBitmaps(void);
48  D3D9Image* GetImageFromCache(MythImage *im);
49 
51  D3D9Image *m_target {nullptr};
52  bool m_swap_control {true};
53  QMap<MythImage *, D3D9Image*> m_ImageBitmapMap;
54  std::list<MythImage *> m_ImageExpireList;
55  std::list<D3D9Image*> m_bitmapDeleteList;
57 };
58 
59 #endif // MYTHPAINTER_D3D9_H
static int swap(VideoFrame *frame, int datasize, int offset, int shift)
Definition: filter_vflip.c:24
virtual void Teardown(void)
Definition: mythpainter.cpp:29
MythRenderD3D9 * m_render
Definition: videoout_d3d.h:88
MythImage * GetFormatImagePriv(void) override
Creates a reference counted image, call DecrRef() to delete.
bool SupportsAnimation(void) override
QMap< MythImage *, D3D9Image * > m_ImageBitmapMap
virtual void End()
Definition: mythpainter.h:51
void SetSwapControl(bool swap)
virtual void FreeResources(void)
Definition: mythpainter.h:49
bool SupportsAlpha(void) override
virtual void DrawRect(const QRect &area, const QBrush &fillBrush, const QPen &linePen, int alpha)
QString GetName(void) override
virtual void DeleteFormatImagePriv(MythImage *im)=0
virtual void DrawImage(const QRect &dest, MythImage *im, const QRect &src, int alpha)=0
bool SupportsClipping(void) override
std::list< D3D9Image * > m_bitmapDeleteList
#define MUI_PUBLIC
Definition: mythuiexp.h:9
std::list< MythImage * > m_ImageExpireList
virtual void Begin(QPaintDevice *parent)
Definition: mythpainter.h:50
void SetTarget(D3D9Image *target)