Use new class to fade

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1947 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-12-06 13:28:35 +00:00
parent e0ef7a0680
commit df51fb1583

View File

@@ -42,6 +42,7 @@
#include <zapit/client/zapittools.h> #include <zapit/client/zapittools.h>
#include <driver/rcinput.h> #include <driver/rcinput.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
#include <driver/fade.h>
#include <zapit/satconfig.h> #include <zapit/satconfig.h>
#include <algorithm> #include <algorithm>
@@ -782,10 +783,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
int res = menu_return::RETURN_REPAINT; int res = menu_return::RETURN_REPAINT;
COSDFader fader(g_settings.menu_Content_alpha);
do { do {
bool fadeIn = g_settings.widget_fade && !this->refreshAll;//FIXME ?
this->refreshAll = false;
this->refreshFooterButtons = false; this->refreshFooterButtons = false;
time_t currentTime = time (NULL); time_t currentTime = time (NULL);
tm tmStartTime = *localtime (&currentTime); tm tmStartTime = *localtime (&currentTime);
@@ -806,15 +805,10 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->createChannelEntries (selectedChannelIndex); this->createChannelEntries (selectedChannelIndex);
bool fadeOut = false; if(!this->refreshAll)
int fadeValue = g_settings.menu_Content_alpha; fader.StartFadeIn();
uint32_t fadeTimer = 0;
if ( fadeIn ) { this->refreshAll = false;
fadeValue = 100;
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
frameBuffer->setBlendLevel(fadeValue, fadeValue);
fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
}
this->header->paint(this->channelList->getName()); 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]); timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]);
if((msg == NeutrinoMessages::EVT_TIMER) && (data == fadeTimer)) { if((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetTimer())) {
if (fadeOut) { // disappear if(fader.Fade())
fadeValue += FADE_STEP;
if (fadeValue >= 100) {
fadeValue = g_settings.menu_Content_alpha;
g_RCInput->killTimer (fadeTimer);
loop = false; 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);
}
} }
else if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t) g_settings.key_channelList_cancel)) { else if ((msg == CRCInput::RC_timeout) || (msg == (neutrino_msg_t) g_settings.key_channelList_cancel)) {
if ( fadeIn ) { if(fader.StartFadeOut()) {
g_RCInput->killTimer(fadeTimer);
fadeIn = false;
}
if ((!fadeOut) && g_settings.widget_fade) {
fadeOut = true;
fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); timeoutEnd = CRCInput::calcTimeoutEnd( 1 );
frameBuffer->setBlendMode(2); // Global alpha multiplied with pixel alpha
msg = 0; msg = 0;
} else } else
loop = false; loop = false;
@@ -1180,10 +1151,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
} }
this->hide(); this->hide();
if ( fadeIn || fadeOut ) {
g_RCInput->killTimer(fadeTimer); fader.Stop();
frameBuffer->setBlendMode(1); // Set back to per pixel alpha
}
#if 0 #if 0
for (TChannelEntries::iterator It = this->displayedChannelEntries.begin(); for (TChannelEntries::iterator It = this->displayedChannelEntries.begin();
It != this->displayedChannelEntries.end(); It++) { It != this->displayedChannelEntries.end(); It++) {