From dd5f370fcc027663d1c0d7370ad46e6e20eafa52 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 22 Aug 2016 16:13:46 +0200 Subject: [PATCH] analogclock: Save background for using transparent clock images Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5d04ea65f49a170e7c146e7e2eed6243ab7192a2 Author: Michael Liebmann Date: 2016-08-22 (Mon, 22 Aug 2016) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/infoviewer.cpp | 27 +++++++++++++++++++++++---- src/gui/infoviewer.h | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index e5ef87f82..ae4aba522 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -130,6 +130,7 @@ CInfoViewer::CInfoViewer () lasttime = 0; aspectRatio = 0; ChanInfoX = 0; + analogclock_buf = NULL; //NI Init(); infoViewerBB->Init(); oldinfo.current_uniqueKey = 0; @@ -177,6 +178,12 @@ void CInfoViewer::Init() _livestreamInfo1.clear(); _livestreamInfo2.clear(); + + //NI + if (analogclock_buf) { + delete analogclock_buf; + analogclock_buf = NULL; + } } /* @@ -2461,11 +2468,17 @@ void CInfoViewer::showAnalogClock(int posx,int posy,int dia) hx = int((dia * 0.6 * cos(hAngleInRad))); hy = int((dia * 0.6 * sin(hAngleInRad))); - std::string clock_face = ICONSDIR_VAR "/clock_face.png"; - if (access(clock_face.c_str(), F_OK) != 0) - clock_face = ICONSDIR "/clock_face.png"; + if (analogclock_buf == NULL) { + std::string clock_face = ICONSDIR_VAR "/clock_face.png"; + if (access(clock_face.c_str(), F_OK) != 0) + clock_face = ICONSDIR "/clock_face.png"; + g_PicViewer->DisplayImage(clock_face, posx-dia, posy-dia, 2*dia, 2*dia); - g_PicViewer->DisplayImage(clock_face, posx-dia, posy-dia, 2*dia, 2*dia); + analogclock_buf = new fb_pixel_t[2*dia * 2*dia]; + frameBuffer->SaveScreen(posx-dia, posy-dia, 2*dia, 2*dia, analogclock_buf); + } + else + frameBuffer->RestoreScreen(posx-dia, posy-dia, 2*dia, 2*dia, analogclock_buf); frameBuffer->paintLine(posx,posy,posx+hx,posy+hy,COL_MENUHEAD_TEXT); frameBuffer->paintLine(posx,posy,posx+mx,posy+my,COL_MENUHEAD_TEXT); @@ -2510,6 +2523,12 @@ void CInfoViewer::ResetModules() ResetPB(); delete rec; rec = NULL; infoViewerBB->ResetModules(); + + //NI + if (analogclock_buf) { + delete analogclock_buf; + analogclock_buf = NULL; + } } //NI diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index 56fac8917..b8ffeb794 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -84,6 +84,7 @@ class CInfoViewer int numbox_offset; int analogclock_size; //NI int analogclock_offset; //NI + fb_pixel_t* analogclock_buf; //NI CSectionsdClient::CurrentNextInfo info_CurrentNext; CSectionsdClient::CurrentNextInfo oldinfo;