00001 #include "interactivescreen.h" 00002 00003 InteractiveScreen::InteractiveScreen(MythPlayer *player, 00004 const QString &name) : 00005 MythScreenType((MythScreenType*)NULL, name), 00006 m_player(player), m_safeArea(QRect()) 00007 { 00008 UpdateArea(); 00009 } 00010 00011 InteractiveScreen::~InteractiveScreen(void) 00012 { 00013 } 00014 00015 void InteractiveScreen::Close(void) 00016 { 00017 if (m_player && m_player->GetVideoOutput()) 00018 m_player->GetVideoOutput()->SetVideoResize(QRect()); 00019 } 00020 00021 void InteractiveScreen::UpdateArea(void) 00022 { 00023 if (m_ChildrenList.isEmpty()) 00024 { 00025 m_safeArea = QRect(); 00026 } 00027 else if (m_player && m_player->GetVideoOutput()) 00028 { 00029 float tmp = 0.0; 00030 QRect dummy; 00031 m_player->GetVideoOutput()->GetOSDBounds(dummy, m_safeArea, tmp, tmp, tmp); 00032 } 00033 SetArea(MythRect(m_safeArea)); 00034 } 00035 00036 void InteractiveScreen::OptimiseDisplayedArea(void) 00037 { 00038 UpdateArea(); 00039 00040 QRegion visible; 00041 QListIterator<MythUIType *> i(m_ChildrenList); 00042 while (i.hasNext()) 00043 { 00044 MythUIType *img = i.next(); 00045 visible = visible.united(img->GetArea()); 00046 } 00047 00048 if (visible.isEmpty()) 00049 return; 00050 00051 QRect bounding = visible.boundingRect(); 00052 bounding = bounding.translated(m_safeArea.topLeft()); 00053 bounding = m_safeArea.intersected(bounding); 00054 int left = m_safeArea.left() - bounding.left(); 00055 int top = m_safeArea.top() - bounding.top(); 00056 SetArea(MythRect(bounding)); 00057 00058 i.toFront();; 00059 while (i.hasNext()) 00060 { 00061 MythUIType *img = i.next(); 00062 img->SetArea(img->GetArea().translated(left, top)); 00063 } 00064 }
1.6.3