MythTV master
mythbdoverlayscreen.cpp
Go to the documentation of this file.
1// Qt
2#include <QPainter>
3
4// MythTV
7
10
11#define LOC QString("BDScreen: ")
12
14 : MythScreenType(static_cast<MythScreenType*>(nullptr), Name),
15 m_player(Player)
16{
17 m_painter = Painter;
18}
19
21{
22 if (!Overlay || !m_player)
23 return;
24
25 MythRect rect(Overlay->m_x, Overlay->m_y, Overlay->m_image.width(), Overlay->m_image.height());
26 SetArea(rect);
28
30 if (!vo)
31 return;
32
33 QImage& img = Overlay->m_image;
34
35 // add to screen
36 QRect scaled = vo->GetImageRect(rect);
37 if (scaled.size() != rect.size())
38 img = img.scaled(scaled.width(), scaled.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
39
41 if (image)
42 {
43 image->Assign(img);
44 auto *uiimage = new MythUIImage(this, "bdoverlay");
45 if (uiimage)
46 {
47 uiimage->SetImage(image);
48 uiimage->SetArea(MythRect(scaled));
49 }
50 image->DecrRef();
51 }
52
53 SetRedraw();
54 delete Overlay;
55}
void DisplayBDOverlay(MythBDOverlay *Overlay)
MythBDOverlayScreen(MythPlayerUI *Player, MythPainter *Painter, const QString &Name)
void Assign(const QImage &img)
Definition: mythimage.cpp:77
int DecrRef(void) override
Decrements reference count and deletes on 0.
Definition: mythimage.cpp:52
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
MythVideoOutput * GetVideoOutput(void)
Definition: mythplayer.h:164
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:18
Screen in which all other widgets are contained and rendered.
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:98
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:610
void SetRedraw(void)
Definition: mythuitype.cpp:313
void DeleteAllChildren(void)
Delete all child widgets.
Definition: mythuitype.cpp:222
MythPainter * m_painter
Definition: mythuitype.h:298
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space