diff options
author | Soeren Moch <smoch@web.de> | 2022-05-20 23:13:32 +0200 |
---|---|---|
committer | kamel5 <vdr.kamel5 (at) gmx (dot) net> | 2022-05-21 10:42:34 +0200 |
commit | 9c8e8a2dd6c1414196d4d059252e43cada52eeb7 (patch) | |
tree | 07ff471bc85424b82631818a6366294c8ec0e6f3 | |
parent | 71d2de77510586f92844eec970d2b453cbc8de7e (diff) | |
download | skin-nopacity-9c8e8a2dd6c1414196d4d059252e43cada52eeb7.tar.gz skin-nopacity-9c8e8a2dd6c1414196d4d059252e43cada52eeb7.tar.bz2 |
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 <smoch@web.de>
-rw-r--r-- | displaychannelview.c | 10 | ||||
-rw-r--r-- | geometrymanager.c | 23 | ||||
-rw-r--r-- | geometrymanager.h | 2 | ||||
-rw-r--r-- | 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"; |