MythTV  master
mythbdoverlayscreen.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QPainter>
3 
4 // MythTV
5 #include "mythuiimage.h"
6 #include "mythpainter.h"
7 #include "Bluray/mythbdbuffer.h"
9 
10 #define LOC QString("BDScreen: ")
11 
13  : MythScreenType(static_cast<MythScreenType*>(nullptr), Name),
14  m_player(Player)
15 {
16  m_painter = Painter;
17 }
18 
20 {
21  if (!Overlay || !m_player)
22  return;
23 
24  MythRect rect(Overlay->m_x, Overlay->m_y, Overlay->m_image.width(), Overlay->m_image.height());
25  SetArea(rect);
27 
29  if (!vo)
30  return;
31 
32  QImage& img = Overlay->m_image;
33 
34  // add to screen
35  QRect scaled = vo->GetImageRect(rect);
36  if (scaled.size() != rect.size())
37  img = img.scaled(scaled.width(), scaled.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
38 
40  if (image)
41  {
42  image->Assign(img);
43  auto *uiimage = new MythUIImage(this, "bdoverlay");
44  if (uiimage)
45  {
46  uiimage->SetImage(image);
47  uiimage->SetArea(MythRect(scaled));
48  }
49  image->DecrRef();
50  }
51 
52  SetRedraw();
53  delete Overlay;
54 }
MythPlayer::GetVideoOutput
MythVideoOutput * GetVideoOutput(void)
Definition: mythplayer.h:164
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:32
MythBDOverlay::m_image
QImage m_image
Definition: mythbdoverlay.h:29
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:19
MythBDOverlay
Definition: mythbdoverlay.h:18
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:595
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:44
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:203
MythPlayerUI
Definition: mythplayerui.h:10
MythBDOverlayScreen::MythBDOverlayScreen
MythBDOverlayScreen(MythPlayerUI *Player, MythPainter *Painter, const QString &Name)
Definition: mythbdoverlayscreen.cpp:12
MythVideoOutput::GetImageRect
QRect GetImageRect(QRect Rect, QRect *DisplayRect=nullptr)
translates caption/dvd button rectangle into 'screen' space
Definition: mythvideoout.cpp:319
MythImage::DecrRef
int DecrRef(void) override
Decrements reference count and deletes on 0.
Definition: mythimage.cpp:54
mythpainter.h
MythBDOverlay::m_x
int m_x
Definition: mythbdoverlay.h:31
mythbdbuffer.h
mythbdoverlayscreen.h
MythPainter
Definition: mythpainter.h:32
MythImage
Definition: mythimage.h:36
Name
Definition: channelsettings.cpp:46
MythUIType::m_painter
MythPainter * m_painter
Definition: mythuitype.h:292
Player
Definition: zmliveplayer.h:34
MythImage::Assign
void Assign(const QImage &img)
Definition: mythimage.cpp:79
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:294
MythBDOverlayScreen::m_player
MythPlayer * m_player
Definition: mythbdoverlayscreen.h:20