audioplayer: don't scale covers to quadrat-dimensions

Origin commit data
------------------
Branch: ni/coolstream
Commit: 99a6c9e1ee
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-07-03 (Mon, 03 Jul 2017)

Origin message was:
------------------
- audioplayer: don't scale covers to quadrat-dimensions

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-07-03 22:02:50 +02:00
parent 019ff0fb3f
commit c53b128e9d
2 changed files with 22 additions and 11 deletions

View File

@@ -306,6 +306,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
m_meta_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); m_meta_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
m_title_height = 3*OFFSET_INNER_SMALL + 2*m_item_height + m_meta_height; m_title_height = 3*OFFSET_INNER_SMALL + 2*m_item_height + m_meta_height;
m_cover_width = 0;
m_info_height = 2*OFFSET_INNER_SMALL + 2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight(); m_info_height = 2*OFFSET_INNER_SMALL + 2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight();
m_button_height = ::paintButtons(AudioPlayerButtons[0], 4, 0, 0, 0, 0, 0, false, NULL, NULL); m_button_height = ::paintButtons(AudioPlayerButtons[0], 4, 0, 0, 0, 0, 0, false, NULL, NULL);
@@ -1790,7 +1791,19 @@ void CAudioPlayerGui::paintCover()
if (access(cover.c_str(), F_OK) == 0) if (access(cover.c_str(), F_OK) == 0)
{ {
g_PicViewer->DisplayImage(cover, m_x + OFFSET_INNER_MID, m_y + OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_frameBuffer->TM_NONE); int cover_x = m_x + OFFSET_INNER_MID;
int cover_y = m_y + OFFSET_INNER_SMALL;
m_cover_width = 0;
CComponentsPicture *cover_object = new CComponentsPicture(cover_x, cover_y, cover);
if (cover_object)
{
cover_object->doPaintBg(false);
cover_object->SetTransparent(CFrameBuffer::TM_BLACK);
cover_object->setHeight(m_title_height - 2*OFFSET_INNER_SMALL, true);
cover_object->paint();
m_cover_width = cover_object->getWidth() + OFFSET_INNER_MID;
}
/* /*
Some guys use this covers for the screensaver. Some guys use this covers for the screensaver.
@@ -1843,13 +1856,11 @@ void CAudioPlayerGui::paintTitleBox()
tmp += sNr ; tmp += sNr ;
} }
// FIXME - there's no cover-check; so we maybe paint over the cover
int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
int xstart = (m_width - w)/2; int xstart = (m_width - w)/2;
if (xstart < OFFSET_INNER_MID) if (xstart < OFFSET_INNER_MID + m_cover_width)
xstart = OFFSET_INNER_MID; xstart = OFFSET_INNER_MID + m_cover_width;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //caption "current track" g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - OFFSET_INNER_MID - xstart, tmp, COL_MENUHEAD_TEXT); //caption "current track"
// second line (Artist/Title...) // second line (Artist/Title...)
GetMetaData(m_curr_audiofile); GetMetaData(m_curr_audiofile);
@@ -1872,9 +1883,9 @@ void CAudioPlayerGui::paintTitleBox()
} }
w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp);
xstart = (m_width - w)/2; xstart = (m_width - w)/2;
if (xstart < OFFSET_INNER_MID) if (xstart < OFFSET_INNER_MID + m_cover_width)
xstart = OFFSET_INNER_MID; xstart = OFFSET_INNER_MID + m_cover_width;
g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //artist - title g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - OFFSET_INNER_MID - xstart, tmp, COL_MENUHEAD_TEXT); //artist - title
// reset so fields get painted always // reset so fields get painted always
m_metainfo.clear(); m_metainfo.clear();
@@ -2224,8 +2235,7 @@ void CAudioPlayerGui::updateMetaData()
if (updateMeta || updateScreen) if (updateMeta || updateScreen)
{ {
int cover_width = m_title_height + 2*OFFSET_INNER_MID; m_frameBuffer->paintBoxRel(m_x + OFFSET_INNER_MID + m_cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - 2*OFFSET_INNER_MID - m_cover_width, m_meta_height, m_titlebox->getColorBody());
m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, m_titlebox->getColorBody());
int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo); int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo);
int xstart = (m_width - w)/2; int xstart = (m_width - w)/2;

View File

@@ -98,6 +98,7 @@ class CAudioPlayerGui : public CMenuTarget
int m_meta_height; int m_meta_height;
int m_button_height; int m_button_height;
int m_title_height; int m_title_height;
int m_cover_width;
int m_info_height; int m_info_height;
int m_key_level; int m_key_level;
bool m_visible; bool m_visible;