- audioplayer: don't scale covers to quadrat-dimensions

Signed-off-by: Thilo Graf <dbt@novatux.de>

# Conflicts:
#	src/gui/audioplayer.cpp
This commit is contained in:
svenhoefer
2017-07-04 12:07:33 +02:00
committed by Thilo Graf
parent 6aa66b84c1
commit dd19314000
2 changed files with 24 additions and 11 deletions

View File

@@ -296,6 +296,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);
@@ -1700,7 +1701,21 @@ void CAudioPlayerGui::paintCover()
cover = meta.cover; cover = meta.cover;
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;
}
}
} }
void CAudioPlayerGui::paintTitleBox() void CAudioPlayerGui::paintTitleBox()
@@ -1742,13 +1757,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);
@@ -1771,9 +1784,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();
@@ -2112,8 +2125,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;