CChannelList: fix and simplify paint of custom channellogos

paint was probably broken since 0ca753dbca


Origin commit data
------------------
Branch: ni/coolstream
Commit: 18fa153389
Author: Thilo Graf <dbt@novatux.de>
Date: 2015-07-11 (Sat, 11 Jul 2015)



------------------
This commit was generated by Migit
This commit is contained in:
2015-07-11 22:04:39 +02:00
parent c49301d91f
commit 0053151415

View File

@@ -1664,7 +1664,7 @@ void CChannelList::paintAdditionals(int index)
}
}
void CChannelList::showChannelLogo()
void CChannelList::showChannelLogo() //TODO: move into an own handler, eg. header, channel logo should be paint inside header object
{
if ((*chanlist).empty())
return;
@@ -1680,13 +1680,9 @@ void CChannelList::showChannelLogo()
CChannelLogo = new CComponentsChannelLogoScalable(0, 0, (*chanlist)[selected]->getName(), (*chanlist)[selected]->getChannelID());
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->setWidth(min(CChannelLogo->getWidth(), logo_w_max), true);
if (CChannelLogo->getHeight() > theight) //scale image if required
CChannelLogo->setHeight(theight, true);
CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth());
CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2);
CChannelLogo->paint();