mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 08:21:07 +02:00
CChannelList/CNeutrinoEventList/CMovieBrowser: fix logo scale
Downscale was broken.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 1cb885dfe9
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-01-14 (Wed, 14 Jan 2015)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1663,13 +1663,19 @@ void CChannelList::showChannelLogo()
|
||||
CChannelLogo->hide();
|
||||
delete CChannelLogo;
|
||||
}
|
||||
CChannelLogo = new CComponentsChannelLogo(0, 0, logo_w_max, theight,
|
||||
(*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id);
|
||||
if (CChannelLogo->hasLogo()) {
|
||||
CChannelLogo->doScale(theight < CChannelLogo->getHeight());
|
||||
CChannelLogo = new CComponentsChannelLogo(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->channel_id);
|
||||
|
||||
if (CChannelLogo->hasLogo()){
|
||||
int h_logo = CChannelLogo->getHeight();
|
||||
if (h_logo > theight){ //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object
|
||||
uint8_t h_ratio = uint8_t(theight*100/h_logo);
|
||||
CChannelLogo->setHeight(theight);
|
||||
int w_logo = h_ratio*CChannelLogo->getWidth()/100;
|
||||
CChannelLogo->setWidth(min(w_logo, logo_w_max));
|
||||
CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth());
|
||||
CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2);
|
||||
CChannelLogo->paint();
|
||||
}
|
||||
} else {
|
||||
delete CChannelLogo;
|
||||
CChannelLogo = NULL;
|
||||
|
@@ -858,17 +858,30 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe
|
||||
header.setCorner(RADIUS_LARGE, CORNER_TOP);
|
||||
|
||||
int x_off = 10;
|
||||
int mid_width = header.getWidth() * 40 / 100; // 40%
|
||||
int side_width = ((header.getWidth() - mid_width) / 2) - (2 * x_off);
|
||||
int mid_width = full_width * 40 / 100; // 40%
|
||||
int side_width = ((full_width - mid_width) / 2) - (2 * x_off);
|
||||
|
||||
CComponentsChannelLogo* midLogo = new CComponentsChannelLogo(CC_CENTERED, CC_CENTERED, _channelname, _channel_id);
|
||||
//create an logo object
|
||||
CComponentsChannelLogo* midLogo = new CComponentsChannelLogo(0, 0, _channelname, _channel_id, &header);
|
||||
if (midLogo->hasLogo()) {
|
||||
header.addCCItem(midLogo);
|
||||
//if logo object has found a logo and was ititialized, the hand it's size
|
||||
int w_logo = midLogo->getWidth();
|
||||
|
||||
//scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object
|
||||
int h_logo = midLogo->getHeight();
|
||||
if (h_logo > theight){
|
||||
uint8_t h_ratio = uint8_t(theight*100/h_logo);
|
||||
midLogo->setHeight(theight);
|
||||
w_logo = h_ratio*w_logo/100;
|
||||
midLogo->setWidth(w_logo);
|
||||
}
|
||||
midLogo->setPos(CC_CENTERED, CC_CENTERED);
|
||||
|
||||
// recalc widths
|
||||
side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off);
|
||||
side_width = ((full_width - w_logo) / 2) - (4 * x_off);
|
||||
}
|
||||
else {
|
||||
delete midLogo;
|
||||
header.removeCCItem(midLogo); //remove/destroy logo object, if it is not available
|
||||
CComponentsText *midText = new CComponentsText(CC_CENTERED, CC_CENTERED, mid_width, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
||||
midText->doPaintBg(false);
|
||||
}
|
||||
@@ -880,7 +893,7 @@ void CNeutrinoEventList::paintHead(t_channel_id _channel_id, std::string _channe
|
||||
|
||||
if (!_channelname_next.empty()) {
|
||||
int name_w = std::min(g_Font[font_lr]->getRenderWidth(_channelname_next), side_width);
|
||||
int x_pos = header.getWidth() - name_w - x_off;
|
||||
int x_pos = full_width - name_w - x_off;
|
||||
CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, name_w, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], &header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT);
|
||||
rText->doPaintBg(false);
|
||||
}
|
||||
|
@@ -1259,15 +1259,22 @@ void CMovieBrowser::refreshMovieInfo(void)
|
||||
CChannelLogo = NULL;
|
||||
}
|
||||
if (old_EpgId != m_movieSelectionHandler->epgEpgId >>16) {
|
||||
CChannelLogo = new CComponentsChannelLogo(0, 0, logo_w_max, m_cBoxFrameTitleRel.iHeight,
|
||||
m_movieSelectionHandler->epgChannel, m_movieSelectionHandler->epgEpgId >>16);
|
||||
CChannelLogo = new CComponentsChannelLogo(0, 0, m_movieSelectionHandler->epgChannel, m_movieSelectionHandler->epgEpgId >>16);
|
||||
old_EpgId = m_movieSelectionHandler->epgEpgId >>16;
|
||||
}
|
||||
|
||||
if (CChannelLogo && CChannelLogo->hasLogo()) {
|
||||
//scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object
|
||||
int h_logo = CChannelLogo->getHeight();
|
||||
if (h_logo > m_cBoxFrameTitleRel.iHeight){
|
||||
uint8_t ratio = m_cBoxFrameTitleRel.iHeight*100/h_logo;
|
||||
CChannelLogo->setHeight(m_cBoxFrameTitleRel.iHeight);
|
||||
int w_logo = ratio*CChannelLogo->getWidth()/100;
|
||||
CChannelLogo->setWidth(min(w_logo, logo_w_max));
|
||||
}
|
||||
|
||||
lx = m_cBoxFrame.iX+m_cBoxFrameTitleRel.iX+m_cBoxFrameTitleRel.iWidth-CChannelLogo->getWidth()-10;
|
||||
ly = m_cBoxFrameTitleRel.iY+m_cBoxFrame.iY+ (m_cBoxFrameTitleRel.iHeight-CChannelLogo->getHeight())/2;
|
||||
CChannelLogo->doScale(m_cBoxFrameTitleRel.iHeight < CChannelLogo->getHeight());
|
||||
CChannelLogo->setXPos(lx - pb_hdd_offset);
|
||||
CChannelLogo->setYPos(ly);
|
||||
CChannelLogo->paint();
|
||||
|
Reference in New Issue
Block a user