Changed the size and location of the channel logos to better fit in place

This leads to a better positioning of the channel logos if they are
displayed in the EPG grid
This commit is contained in:
kamel5 2021-12-23 13:49:58 +01:00
parent 936db4a087
commit e2d67769dc
3 changed files with 10 additions and 7 deletions

View File

@ -56,7 +56,8 @@ void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
cImage *logo = imgCache.GetLogo(channel);
if (logo) {
const int logoheight = logo->Height();
pixmapLogo->DrawImage(cPoint(logoX, (Height() - logoheight) / 2), *logo);
const int logowidth = logo->Width();
pixmapLogo->DrawImage(cPoint(logoX + ((logoWidth - logowidth) / 2), (Height() - logoheight) / 2), *logo);
logoFound = true;
}
}
@ -81,7 +82,6 @@ void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
// Draw Channel vertical view
void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
int logoWidth = geoManager.logoWidth;
int logoHeight = geoManager.logoHeight;
cTextWrapper tw;
cString headerText = cString::sprintf("%d - %s", channel->Number(), channel->Name());
@ -93,8 +93,10 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
if (!config.hideChannelLogos) {
cImage *logo = imgCache.GetLogo(channel);
if (logo) {
pixmapLogo->DrawImage(cPoint((Width() - logoWidth) / 2, 6), *logo);
logoFound = true;
const int logoheight = logo->Height();
const int logowidth = logo->Width();
pixmapLogo->DrawImage(cPoint((Width() - logowidth) / 2, (logoHeight - logoheight) / 2), *logo);
logoFound = true;
}
}
bool drawText = false;

View File

@ -357,7 +357,7 @@ cImage *cImageCache::GetLogo(const cChannel *channel) {
delete tempStaticLogo;
tempStaticLogo = NULL;
}
tempStaticLogo = CreateImage(geoManager.logoWidth, geoManager.logoHeight);
tempStaticLogo = CreateImage(geoManager.logoWidth * 0.8, geoManager.logoHeight * 0.8);
return tempStaticLogo;
} else {
//add requested logo to cache
@ -609,7 +609,7 @@ bool cImageCache::LoadLogo(const cChannel *channel) {
}
void cImageCache::InsertIntoLogoCache(std::string channelID) {
cImage *image = CreateImage(geoManager.logoWidth, geoManager.logoHeight);
cImage *image = CreateImage(geoManager.logoWidth * 0.8, geoManager.logoHeight * 0.8);
logoCache.insert(std::pair<std::string, cImage*>(channelID, image));
}

3
view.c
View File

@ -108,7 +108,8 @@ void cView::DrawHeader(void) {
if (imgLoader.LoadLogo(channel, logoWidth, logoHeight)) {
cImage logo = imgLoader.GetImage();
const int logoheight = logo.Height();
pixmapHeaderLogo->DrawImage(cPoint(border / 2, ((headerHeight - logoHeight) / 2 + (logoHeight - logoheight) / 2)), logo);
const int logowidth = logo.Width();
pixmapHeaderLogo->DrawImage(cPoint(xText + ((logoWidth - logowidth) / 2), ((headerHeight - logoheight) / 2)), logo);
xText += logoWidth + border / 2;
}
}