From 4c46bd78a9a83a86d32a521f7342245cad0e475d Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 6 Dec 2011 13:28:35 +0000 Subject: [PATCH] Use new class to fade git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1947 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/df51fb15831f6ae3ebc5b9d299709531f48c8117 Author: [CST] Focus Date: 2011-12-06 (Tue, 06 Dec 2011) ------------------ This commit was generated by Migit --- src/gui/epgplus.cpp | 55 ++++++++++----------------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 4840b4014..f9cc57ec3 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -782,10 +783,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu int res = menu_return::RETURN_REPAINT; + COSDFader fader(g_settings.menu_Content_alpha); do { - bool fadeIn = g_settings.widget_fade && !this->refreshAll;//FIXME ? - - this->refreshAll = false; this->refreshFooterButtons = false; time_t currentTime = time (NULL); tm tmStartTime = *localtime (¤tTime); @@ -806,15 +805,10 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu this->createChannelEntries (selectedChannelIndex); - bool fadeOut = false; - int fadeValue = g_settings.menu_Content_alpha; - uint32_t fadeTimer = 0; - if ( fadeIn ) { - fadeValue = 100; - frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha - frameBuffer->setBlendLevel(fadeValue, fadeValue); - fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); - } + if(!this->refreshAll) + fader.StartFadeIn(); + + this->refreshAll = false; this->header->paint(this->channelList->getName()); @@ -831,36 +825,13 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]); - if((msg == NeutrinoMessages::EVT_TIMER) && (data == fadeTimer)) { - if (fadeOut) { // disappear - fadeValue += FADE_STEP; - if (fadeValue >= 100) { - fadeValue = g_settings.menu_Content_alpha; - g_RCInput->killTimer (fadeTimer); - loop = false; - } else - frameBuffer->setBlendLevel(fadeValue, fadeValue); - } else { // appears - fadeValue -= FADE_STEP; - if (fadeValue <= g_settings.menu_Content_alpha) { - fadeValue = g_settings.menu_Content_alpha; - g_RCInput->killTimer (fadeTimer); - fadeIn = false; - frameBuffer->setBlendMode(1); // Set back to per pixel alpha - } else - frameBuffer->setBlendLevel(fadeValue, fadeValue); - } + if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetTimer())) { + if(fader.Fade()) + loop = false; } else if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t) g_settings.key_channelList_cancel)) { - if ( fadeIn ) { - g_RCInput->killTimer(fadeTimer); - fadeIn = false; - } - if ((!fadeOut) && g_settings.widget_fade) { - fadeOut = true; - fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); + if(fader.StartFadeOut()) { timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); - frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha msg = 0; } else loop = false; @@ -1180,10 +1151,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu } this->hide(); - if ( fadeIn || fadeOut ) { - g_RCInput->killTimer(fadeTimer); - frameBuffer->setBlendMode(1); // Set back to per pixel alpha - } + + fader.Stop(); #if 0 for (TChannelEntries::iterator It = this->displayedChannelEntries.begin(); It != this->displayedChannelEntries.end(); It++) {