From e2d67769dcb0e235a9b1d501970f6f57958146e5 Mon Sep 17 00:00:00 2001 From: kamel5 Date: Thu, 23 Dec 2021 13:49:58 +0100 Subject: [PATCH] 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 --- headergrid.c | 10 ++++++---- imagecache.c | 4 ++-- view.c | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/headergrid.c b/headergrid.c index 7b158fe..91a069d 100644 --- a/headergrid.c +++ b/headergrid.c @@ -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; diff --git a/imagecache.c b/imagecache.c index 9b5473c..8d3e182 100644 --- a/imagecache.c +++ b/imagecache.c @@ -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(channelID, image)); } diff --git a/view.c b/view.c index d6daf70..63b3045 100644 --- a/view.c +++ b/view.c @@ -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; } }