From 9c8e8a2dd6c1414196d4d059252e43cada52eeb7 Mon Sep 17 00:00:00 2001 From: Soeren Moch Date: Fri, 20 May 2022 23:13:32 +0200 Subject: Align channel logo background Use maximum logo space for background. So the logo background image is aligned to the menu background. The channel logo itself is usually smaller than the background due to scaling with preserved aspect ratio. So use separate geometry settings for logo and background. Signed-off-by: Soeren Moch --- displaychannelview.c | 10 +++++----- geometrymanager.c | 23 +++++++++++++---------- geometrymanager.h | 2 ++ imagecache.c | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/displaychannelview.c b/displaychannelview.c index bb726fb..016dbb9 100644 --- a/displaychannelview.c +++ b/displaychannelview.c @@ -77,10 +77,10 @@ void cNopacityDisplayChannelView::CreatePixmaps(void) { geoManager->channelLogoHeight) ); pixmapLogoBackground = osd->CreatePixmap(2, - cRect(geoManager->channelX + geoManager->channelLogoX, - geoManager->channelLogoY, - geoManager->channelLogoWidth, - geoManager->channelLogoHeight) + cRect(geoManager->channelX + geoManager->channelLogoBgX, + geoManager->channelLogoBgY, + geoManager->channelLogoBgWidth, + geoManager->channelLogoBgHeight) ); pixmapChannelName = osd->CreatePixmap(2, cRect(geoManager->channelX + geoManager->channelContentX, @@ -228,7 +228,7 @@ void cNopacityDisplayChannelView::DrawChannelLogo(const cChannel *Channel) { if (config.GetValue("displayType") != dtFlat && config.GetValue("channelUseLogoBackground")) { cImage *imgLogoBack = imgCache->GetSkinElement(seChannelLogoBack); if (imgLogoBack) - pixmapLogoBackground->DrawImage(cPoint(0,0), *imgLogoBack); + pixmapLogoBackground->DrawImage(cPoint((geoManager->channelLogoBgWidth - imgLogoBack->Width()) / 2, (geoManager->channelLogoBgHeight - imgLogoBack->Height()) / 2), *imgLogoBack); } cImage *imgLogo = imgCache->GetLogo(ctLogo, Channel); if (imgLogo) { diff --git a/geometrymanager.c b/geometrymanager.c index aca3007..bc0384e 100644 --- a/geometrymanager.c +++ b/geometrymanager.c @@ -123,17 +123,17 @@ void cGeometryManager::SetGeometry(void) { channelContentHeight = channelHeight - channelHeaderHeight - channelFooterHeight; int logoWidthTotalPercent = 16; - channelLogoWidthTotal = logoWidthTotalPercent * channelWidth /100; - - int logoMaxWidth = channelLogoWidthTotal - 10; - int logoMaxHeight; - if (config.GetValue("displayType") == dtGraphical) { - logoMaxHeight = channelHeight - channelHeaderHeight - 2; - } else { - logoMaxHeight = channelHeight - 2; + channelLogoWidthTotal = logoWidthTotalPercent * channelWidth / 100; + + // 184x130 logo background for 1250x180 graphical display channel window (default theme) + channelLogoBgWidth = channelWidth * 184 / 1250; + channelLogoBgHeight = channelHeight * 130 / 180; + channelLogoBgX = (channelLogoWidthTotal - channelLogoBgWidth) / 2; + if (config.GetValue("displayType") != dtGraphical) { + channelLogoBgHeight += channelHeaderHeight; } - cSize channelLogoSize = ScaleToFit(logoMaxWidth, - logoMaxHeight, + cSize channelLogoSize = ScaleToFit(channelLogoBgWidth, + channelLogoBgHeight, config.GetValue("logoWidthOriginal"), config.GetValue("logoHeightOriginal")); channelLogoWidth = channelLogoSize.Width(); @@ -143,12 +143,15 @@ void cGeometryManager::SetGeometry(void) { switch (config.GetValue("logoVerticalAlignment")) { case lvTop: channelLogoY = channelTop + (channelHeight - channelHeaderHeight - channelLogoHeight)/2; + channelLogoBgY = channelTop + (channelHeight - channelHeaderHeight - channelLogoBgHeight)/2; break; case lvMiddle: channelLogoY = channelTop + (channelHeight - channelLogoHeight)/2; + channelLogoBgY = channelTop + (channelHeight - channelLogoBgHeight)/2; break; case lvBottom: channelLogoY = (channelTop + channelHeaderHeight) + (channelHeight - channelHeaderHeight - channelLogoHeight)/2; + channelLogoBgY = (channelTop + channelHeaderHeight) + (channelHeight - channelHeaderHeight - channelLogoBgHeight)/2; break; } diff --git a/geometrymanager.h b/geometrymanager.h index 4428128..bdf7b49 100644 --- a/geometrymanager.h +++ b/geometrymanager.h @@ -68,6 +68,8 @@ class cGeometryManager { int channelLogoWidthTotal; int channelLogoX, channelLogoY; int channelLogoWidth, channelLogoHeight; + int channelLogoBgX, channelLogoBgY; + int channelLogoBgWidth, channelLogoBgHeight; int channelChannelNameWidth; int channelDateWidth; int channelFooterY; diff --git a/imagecache.c b/imagecache.c index b0b08dc..d336c5e 100644 --- a/imagecache.c +++ b/imagecache.c @@ -598,7 +598,7 @@ void cImageCache::CreateSkinElementsGraphics(void) { std::string imgChannelLogoBack = "skinElements/channellogoback"; success = LoadIcon(ctSkinElement, imgChannelLogoBack); if (success) - InsertIntoSkinElementCache(seChannelLogoBack, geoManager->channelLogoWidth, geoManager->channelLogoHeight); + InsertIntoSkinElementCache(seChannelLogoBack, geoManager->channelLogoBgWidth, geoManager->channelLogoBgHeight); //DisplayReplay Background and Foreground std::string imgReplayBackground = "skinElements/displayreplayback"; -- cgit v1.2.3