screensaver: add optional colored property

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0f2c73aed3
Author: defans <defans@bluepeercrew.us>
Date: 2016-01-07 (Thu, 07 Jan 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
defans
2016-01-07 20:47:15 +01:00
committed by Thilo Graf
parent adde9cbc2b
commit 291e699330
6 changed files with 37 additions and 4 deletions

View File

@@ -53,6 +53,7 @@ CScreenSaver::CScreenSaver()
index = 0;
status_mute = CAudioMute::getInstance()->getStatus();
scr_clock = NULL;
clr.i_color = COL_DARK_GRAY;
}
CScreenSaver::~CScreenSaver()
@@ -250,7 +251,6 @@ void CScreenSaver::paint()
if (!scr_clock){
scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H.%M:%S", "%H.%M %S", true);
scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]);
scr_clock->setTextColor(COL_DARK_GRAY);
scr_clock->enableSaveBg();
scr_clock->doPaintBg(false);
}
@@ -258,7 +258,26 @@ void CScreenSaver::paint()
scr_clock->Stop();
scr_clock->kill();
scr_clock->setTextColor(clr.i_color);
scr_clock->setPosP(rand() % 80, rand() % 90);
scr_clock->Start();
if (g_settings.screensaver_mode == SCR_MODE_CLOCK_COLOR) {
srand (time(NULL));
uint32_t brightness;
// sorcery, no darkness
do {
clr.i_color = rand();
brightness = (unsigned int)clr.uc_color.r * 19595 + (unsigned int)clr.uc_color.g * 38469 + (unsigned int)clr.uc_color.b * 7471;
//printf("[%s] %s: brightness: %d\n", __FILE__, __FUNCTION__, brightness>> 16);
}
while(brightness >> 16 < 80);
clr.i_color &= 0x00FFFFFF;
//printf("[%s] %s: clr.i_color: r %02x g %02x b %02x a %02x\n", __FILE__, __FUNCTION__, clr.uc_color.r, clr.uc_color.g, clr.uc_color.b, clr.uc_color.a);
}
else
clr.i_color = COL_DARK_GRAY;
}
}