MythTV  master
mythbdoverlayscreen.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QPainter>
3 
4 // MythTV
7 
8 #include "Bluray/mythbdbuffer.h"
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 }
MythPlayer::GetVideoOutput
MythVideoOutput * GetVideoOutput(void)
Definition: mythplayer.h:166
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MythVideoOutput
Definition: mythvideoout.h:35
MythBDOverlay::m_y
int m_y
Definition: mythbdoverlay.h:30
MythBDOverlay::m_image
QImage m_image
Definition: mythbdoverlay.h:27
MythPainter::GetFormatImage
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
Definition: mythpainter.cpp:540
MythBDOverlayScreen::DisplayBDOverlay
void DisplayBDOverlay(MythBDOverlay *Overlay)
Definition: mythbdoverlayscreen.cpp:20
MythBDOverlay
Definition: mythbdoverlay.h:16
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:609
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
MythRect
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
mythuiimage.h
MythUIType::DeleteAllChildren
void DeleteAllChildren(void)
Delete all child widgets.
Definition: mythuitype.cpp:217
MythPlayerUI
Definition: mythplayerui.h:10
MythBDOverlayScreen::MythBDOverlayScreen
MythBDOverlayScreen(MythPlayerUI *Player, MythPainter *Painter, const QString &Name)
Definition: mythbdoverlayscreen.cpp:13
MythVideoOutput::GetImageRect
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space
Definition: mythvideoout.cpp:322
MythImage::DecrRef
int DecrRef(void) override
Decrements reference count and deletes on 0.
Definition: mythimage.cpp:52
mythpainter.h
MythBDOverlay::m_x
int m_x
Definition: mythbdoverlay.h:29
mythbdbuffer.h
mythbdoverlayscreen.h
MythPainter
Definition: mythpainter.h:34
MythImage
Definition: mythimage.h:36
Name
Definition: channelsettings.cpp:47
MythUIType::m_painter
MythPainter * m_painter
Definition: mythuitype.h:295
Player
Definition: zmliveplayer.h:34
MythImage::Assign
void Assign(const QImage &img)
Definition: mythimage.cpp:77
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:308
MythBDOverlayScreen::m_player
MythPlayer * m_player
Definition: mythbdoverlayscreen.h:20