From 2c134ac53a4fa894b23f87659b0e549d71979411 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 2 Aug 2016 10:28:49 +0200 Subject: [PATCH 1/2] epgview: rename bool 'cover' to 'has_cover' Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a4ffdcd41322b3a50685a26ac4888f78b6ed1306 Author: vanhofen Date: 2016-08-02 (Tue, 02 Aug 2016) Origin message was: ------------------ - epgview: rename bool 'cover' to 'has_cover' --- src/gui/epgview.cpp | 6 +++--- src/gui/epgview.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index d5ef21e6e..8f8ca8792 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -229,7 +229,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove addTextToArray( aktLine + aktWord, screening ); } -void CEpgData::showText(int startPos, int ypos, bool cover, bool fullClear) +void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) { // recalculate medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight(); @@ -237,7 +237,7 @@ void CEpgData::showText(int startPos, int ypos, bool cover, bool fullClear) int cover_height = std::min(sb-10,513); int cover_width = std::min((sb-10)*342/513,342); - int cover_offset = cover ? cover_width+3 : 0; + int cover_offset = has_cover ? cover_width+3 : 0; int textSize = epgText.size(); int y=ypos; const char tok = ' '; @@ -253,7 +253,7 @@ void CEpgData::showText(int startPos, int ypos, bool cover, bool fullClear) int offs = fullClear ? 0 : cover_offset; frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box - if (cover) { + if (has_cover) { if (!g_PicViewer->DisplayImage("/tmp/tmdb.jpg",sx+3,y+3+((sb-cover_height)/2),cover_width,cover_height, CFrameBuffer::TM_NONE)) { cover_offset = 0; frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box diff --git a/src/gui/epgview.h b/src/gui/epgview.h index d436802de..bfed0261c 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -89,7 +89,7 @@ class CEpgData void GetPrevNextEPGData( uint64_t id, time_t* startzeit ); void addTextToArray( const std::string & text, int screening ); void processTextToArray(std::string text, int screening = 0, bool has_cover = false); - void showText( int startPos, int ypos, bool cover=false, bool fullClear=true ); + void showText(int startPos, int ypos, bool has_cover = false, bool fullClear = true); bool hasFollowScreenings(const t_channel_id channel_id, const std::string & title); int FollowScreenings(const t_channel_id channel_id, const std::string & title); void showTimerEventBar(bool show, bool adzap = false, bool mp_info = false); From 5cb90f64d2320e259b32a3b8f1e95243c39cd7aa Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 2 Aug 2016 11:19:38 +0200 Subject: [PATCH 2/2] epgview: scale tmdb-cover; smoother view (use a larger offset) Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d3cdf8d250d552d3efb860dcc45c82c80455237b Author: vanhofen Date: 2016-08-02 (Tue, 02 Aug 2016) Origin message was: ------------------ - epgview: scale tmdb-cover; smoother view (use a larger offset) --- src/gui/epgview.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 8f8ca8792..a557b743e 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -235,9 +235,23 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight(); medlinecount = sb / medlineheight; - int cover_height = std::min(sb-10,513); - int cover_width = std::min((sb-10)*342/513,342); - int cover_offset = has_cover ? cover_width+3 : 0; + std::string cover = "/tmp/tmdb.jpg"; //todo: maybe add a getCover()-function to tmdb class + int cover_max_width = ox/4; //25% + int cover_max_height = sb-(2*10); + int cover_width = 0; + int cover_height = 0; + int cover_offset = 0; + + if (has_cover) + { + g_PicViewer->getSize(cover.c_str(), &cover_width, &cover_height); + if (cover_width && cover_height) + { + g_PicViewer->rescaleImageDimensions(&cover_width, &cover_height, cover_max_width, cover_max_height); + cover_offset = cover_width + 10; + } + } + int textSize = epgText.size(); int y=ypos; const char tok = ' '; @@ -254,7 +268,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box if (has_cover) { - if (!g_PicViewer->DisplayImage("/tmp/tmdb.jpg",sx+3,y+3+((sb-cover_height)/2),cover_width,cover_height, CFrameBuffer::TM_NONE)) { + if (!g_PicViewer->DisplayImage(cover ,sx+10 ,y+10+((sb-cover_height)/2), cover_width, cover_height, CFrameBuffer::TM_NONE)) { cover_offset = 0; frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box } @@ -263,16 +277,16 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) if (tmdbtoggle && startPos == 0) { int icon_w,icon_h; frameBuffer->getIconSize(NEUTRINO_ICON_TMDB, &icon_w, &icon_h); - frameBuffer->paintIcon(NEUTRINO_ICON_TMDB, sx+10+cover_offset, ypos+5); + frameBuffer->paintIcon(NEUTRINO_ICON_TMDB, sx+10+cover_offset, ypos+10); logo_offset = icon_w + 10; } if (stars > 0 && startPos == 0) { int icon_w,icon_h; frameBuffer->getIconSize(NEUTRINO_ICON_STAR_OFF, &icon_w, &icon_h); for (int i = 0; i < 10; i++) - frameBuffer->paintIcon(NEUTRINO_ICON_STAR_OFF, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+3); + frameBuffer->paintIcon(NEUTRINO_ICON_STAR_OFF, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+10); for (int i = 0; i < stars; i++) - frameBuffer->paintIcon(NEUTRINO_ICON_STAR_ON, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+3); + frameBuffer->paintIcon(NEUTRINO_ICON_STAR_ON, sx+10+cover_offset+logo_offset + i*(icon_w+3), y+10); } for (int i = startPos; i < textSize && i < startPos + medlinecount; i++, y += medlineheight) { @@ -300,7 +314,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) count = 0; } else{ - g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+10+cover_offset, y+medlineheight, ox- 15- 15, epgText[i].first, COL_MENUCONTENT_TEXT); + g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+10+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); } }