mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
CInfoViewer: reduce flicker effects for infobar text
This commit is contained in:
@@ -1945,8 +1945,8 @@ void CInfoViewer::killInfobarText()
|
|||||||
if (infobar_txt->isPainted())
|
if (infobar_txt->isPainted())
|
||||||
infobar_txt->kill();
|
infobar_txt->kill();
|
||||||
delete infobar_txt;
|
delete infobar_txt;
|
||||||
|
infobar_txt = NULL;
|
||||||
}
|
}
|
||||||
infobar_txt = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1975,12 +1975,22 @@ void CInfoViewer::showInfoFile()
|
|||||||
const int height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 2;
|
const int height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight() + 2;
|
||||||
|
|
||||||
//create info object
|
//create info object
|
||||||
if (infobar_txt == NULL)
|
if (infobar_txt == NULL){
|
||||||
infobar_txt = new CComponentsInfoBox();
|
infobar_txt = new CComponentsInfoBox();
|
||||||
|
//set some properties for info object
|
||||||
|
infobar_txt->setCorner(RADIUS_SMALL);
|
||||||
|
infobar_txt->enableShadow(CC_SHADOW_ON, SHADOW_OFFSET/2);
|
||||||
|
infobar_txt->setTextColor(COL_INFOBAR_TEXT);
|
||||||
|
infobar_txt->setColorBody(COL_INFOBAR_PLUS_0);
|
||||||
|
infobar_txt->doPaintTextBoxBg(false);
|
||||||
|
infobar_txt->enableColBodyGradient(g_settings.theme.infobar_gradient_top, g_settings.theme.infobar_gradient_top ? COL_INFOBAR_PLUS_0 : header->getColorBody(), g_settings.theme.infobar_gradient_top_direction);
|
||||||
|
}
|
||||||
|
|
||||||
//get text from file and set it to info object, exit and delete object if failed
|
//get text from file and set it to info object, exit and delete object if failed
|
||||||
bool new_text = infobar_txt->setTextFromFile(infobar_file, CTextBox::CENTER, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]);
|
string old_txt = infobar_txt->getText();
|
||||||
if (!new_text){
|
string new_txt = infobar_txt->getTextFromFile(infobar_file);
|
||||||
|
bool has_text = infobar_txt->setText(new_txt, CTextBox::CENTER, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]);
|
||||||
|
if (new_txt.empty()){
|
||||||
killInfobarText();
|
killInfobarText();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1989,20 +1999,14 @@ void CInfoViewer::showInfoFile()
|
|||||||
if (infobar_txt->getWidth() != width)
|
if (infobar_txt->getWidth() != width)
|
||||||
infobar_txt->kill();
|
infobar_txt->kill();
|
||||||
|
|
||||||
//set some properties for info object
|
//consider possible size change
|
||||||
infobar_txt->setDimensionsAll(xStart, yStart, width, height);
|
infobar_txt->setDimensionsAll(xStart, yStart, width, height);
|
||||||
infobar_txt->setCorner(RADIUS_SMALL);
|
|
||||||
infobar_txt->enableShadow(CC_SHADOW_ON, SHADOW_OFFSET/2);
|
|
||||||
infobar_txt->setTextColor(COL_INFOBAR_TEXT);
|
|
||||||
infobar_txt->setColorBody(COL_INFOBAR_PLUS_0);
|
|
||||||
infobar_txt->doPaintTextBoxBg(false);
|
|
||||||
infobar_txt->enableColBodyGradient(g_settings.theme.infobar_gradient_top, g_settings.theme.infobar_gradient_top ? COL_INFOBAR_PLUS_0 : header->getColorBody(), g_settings.theme.infobar_gradient_top_direction);
|
|
||||||
|
|
||||||
//paint info, don't save background, if already painted, global hide is also done by killTitle()
|
|
||||||
bool save_bg = !infobar_txt->isPainted();
|
|
||||||
if (new_text || (zap_mode & IV_MODE_VIRTUAL_ZAP))
|
|
||||||
infobar_txt->paint(save_bg);
|
|
||||||
|
|
||||||
|
//paint info if not painted or text has changed
|
||||||
|
if (has_text || (zap_mode & IV_MODE_VIRTUAL_ZAP)){
|
||||||
|
if ((old_txt != new_txt) || !infobar_txt->isPainted())
|
||||||
|
infobar_txt->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoViewer::killTitle()
|
void CInfoViewer::killTitle()
|
||||||
@@ -2024,9 +2028,12 @@ void CInfoViewer::killTitle()
|
|||||||
rec->kill();
|
rec->kill();
|
||||||
//printf("killTitle(%d, %d, %d, %d)\n", BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET-BoxStartX, bottom-BoxStartY);
|
//printf("killTitle(%d, %d, %d, %d)\n", BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET-BoxStartX, bottom-BoxStartY);
|
||||||
//frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET, bottom);
|
//frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET, bottom);
|
||||||
if (infobar_txt)
|
if (zap_mode != IV_MODE_VIRTUAL_ZAP){
|
||||||
infobar_txt->kill();
|
if (infobar_txt)
|
||||||
numbox->kill();
|
infobar_txt->kill();
|
||||||
|
numbox->kill();
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 //not really required to kill sigbox, numbox does this
|
#if 0 //not really required to kill sigbox, numbox does this
|
||||||
if (sigbox)
|
if (sigbox)
|
||||||
sigbox->kill();
|
sigbox->kill();
|
||||||
@@ -2058,7 +2065,6 @@ void CInfoViewer::killTitle()
|
|||||||
g_Radiotext->S_RtOsd = g_Radiotext->haveRadiotext() ? 1 : 0;
|
g_Radiotext->S_RtOsd = g_Radiotext->haveRadiotext() ? 1 : 0;
|
||||||
killRadiotext();
|
killRadiotext();
|
||||||
}
|
}
|
||||||
killInfobarText();
|
|
||||||
}
|
}
|
||||||
showButtonBar = false;
|
showButtonBar = false;
|
||||||
InfoClock->getInstance()->enableInfoClock();
|
InfoClock->getInstance()->enableInfoClock();
|
||||||
|
Reference in New Issue
Block a user