summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c1
-rw-r--r--displayreplay.c30
-rw-r--r--displayreplay.h3
-rw-r--r--setup.c1
4 files changed, 22 insertions, 13 deletions
diff --git a/config.c b/config.c
index 7283e69..b32ec38 100644
--- a/config.c
+++ b/config.c
@@ -184,6 +184,7 @@ void cNopacityConfig::LoadDefaults(void) {
conf.insert(std::pair<std::string, int>("replayBorderVertical", 15));
conf.insert(std::pair<std::string, int>("replayBorderBottom", 15));
conf.insert(std::pair<std::string, int>("replayFadeTime", 300));
+ conf.insert(std::pair<std::string, int>("replayFadeOutTime", 300));
conf.insert(std::pair<std::string, int>("fontReplayHeader", 0));
conf.insert(std::pair<std::string, int>("fontReplay", 0));
//DisplayMessage
diff --git a/displayreplay.c b/displayreplay.c
index 5810ffa..7072fd3 100644
--- a/displayreplay.c
+++ b/displayreplay.c
@@ -5,10 +5,9 @@
cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) : cThread("DisplayReplay") {
initial = true;
+ fadeout = false;
modeOnly = ModeOnly;
lastDate = "";
- FadeTime = config.GetValue("replayFadeTime");
- FrameTime = FadeTime / 10;
createOSD();
CreatePixmaps();
DrawBackground();
@@ -17,9 +16,17 @@ cNopacityDisplayReplay::cNopacityDisplayReplay(bool ModeOnly) : cThread("Display
}
cNopacityDisplayReplay::~cNopacityDisplayReplay() {
- Cancel(-1);
- while (Active())
+ if (config.GetValue("replayFadeOutTime")) {
+ fadeout = true;
+ Start();
+ }
+ int count = 0;
+ while (Active()) {
cCondWait::SleepMs(10);
+ count++;
+ if (count > 150)
+ Cancel(1);
+ }
if (!modeOnly) {
osd->DestroyPixmap(pixmapBackground);
osd->DestroyPixmap(pixmapTop);
@@ -143,9 +150,7 @@ void cNopacityDisplayReplay::CreatePixmaps(void) {
iconSize,
iconSize));
- if (FadeTime) {
- SetAlpha(0);
- } else if (!modeOnly) {
+ if (!modeOnly) {
int alphaBack = (100 - config.GetValue("channelBackgroundTransparency"))*255/100;
pixmapBackground->SetAlpha(alphaBack);
}
@@ -488,15 +493,18 @@ void cNopacityDisplayReplay::Flush(void) {
if (!modeOnly) {
DrawDate();
}
- if (initial) {
- if (FadeTime)
- Start();
+ if (initial && config.GetValue("replayFadeTime")) {
+ SetAlpha(0);
+ Start();
}
initial = false;
osd->Flush();
}
void cNopacityDisplayReplay::Action(void) {
+ int x = (fadeout) ? 255 : 0;
+ int FadeTime = (fadeout) ? config.GetValue("replayFadeOutTime") : config.GetValue("replayFadeTime");
+ int FrameTime = FadeTime / 10;
uint64_t First = cTimeMs::Now();
cPixmap::Lock();
cPixmap::Unlock();
@@ -505,7 +513,7 @@ void cNopacityDisplayReplay::Action(void) {
while (Running()) {
uint64_t Now = cTimeMs::Now();
double t = std::min(double(Now - Start) / FadeTime, 1.0);
- int Alpha = t * ALPHA_OPAQUE;
+ int Alpha = std::abs(x - (int(t * ALPHA_OPAQUE)));
cPixmap::Lock();
SetAlpha(Alpha);
if (Running())
diff --git a/displayreplay.h b/displayreplay.h
index 12e2a4d..58be8cc 100644
--- a/displayreplay.h
+++ b/displayreplay.h
@@ -12,8 +12,7 @@ private:
bool initial;
bool modeOnly;
cString lastDate;
- int FrameTime;
- int FadeTime;
+ bool fadeout;
cPixmap *pixmapBackground;
cPixmap *pixmapTop;
cPixmap *pixmapInfo;
diff --git a/setup.c b/setup.c
index d88343a..d5148bc 100644
--- a/setup.c
+++ b/setup.c
@@ -440,6 +440,7 @@ void cNopacitySetupReplayDisplay::Set(void) {
Clear();
Add(new cMenuEditIntItem(tr("Fade-In Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("replayFadeTime"), 0, 1000));
+ Add(new cMenuEditIntItem(tr("Fade-Out Time in ms (Zero for switching off fading)"), tmpConf->GetValueRef("replayFadeOutTime"), 0, 1000));
Add(new cMenuEditIntItem(tr("Height of Replay Display (Percent of OSD Height)"), tmpConf->GetValueRef("replayHeight"), 15, 80));
Add(new cMenuEditIntItem(tr("Left & Right Border Width"), tmpConf->GetValueRef("replayBorderVertical"), 0, 300));
Add(new cMenuEditIntItem(tr("Bottom Border Height"), tmpConf->GetValueRef("replayBorderBottom"), 0, 300));