CComponentsHeader: optimize logo size/position handling

Prevent oversized paint with stupid screen and/or font size settings
This commit is contained in:
2017-05-03 21:29:41 +02:00
parent cb02d6253d
commit 18fb99688c

View File

@@ -277,10 +277,13 @@ void CComponentsHeader::initLogo()
int h_logo = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; int h_logo = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max;
if(!cch_logo_obj) if(!cch_logo_obj)
cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); cch_logo_obj = new CComponentsChannelLogoScalable(1, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this);
else else
cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name);
// use value 1 as initial value for logo width, ensures downscale with stupid available logo space
cch_logo_obj->setHeight(1, true);
//ensure logo is not larger than original size if in auto mode //ensure logo is not larger than original size if in auto mode
if (cch_logo.dy_max == -1){ if (cch_logo.dy_max == -1){
int dx_orig = 0, dy_orig = 0 ; int dx_orig = 0, dy_orig = 0 ;
@@ -289,6 +292,7 @@ void CComponentsHeader::initLogo()
h_logo = dy_orig; h_logo = dy_orig;
} }
//cch_logo_obj->setWidth(1, true);
if (cch_logo_obj->hasLogo()){ if (cch_logo_obj->hasLogo()){
cch_logo_obj->setHeight(h_logo, true); cch_logo_obj->setHeight(h_logo, true);
@@ -533,7 +537,7 @@ void CComponentsHeader::initCaption()
cch_btn_obj->setXPos(width - buttons_w); cch_btn_obj->setXPos(width - buttons_w);
//set required width of caption object //set required width of caption object
cc_text_w -= (buttons_w + cch_offset); cc_text_w -= buttons_w;
} }
//clock //clock
@@ -548,7 +552,7 @@ void CComponentsHeader::initCaption()
cch_cl_obj->setXPos(width - buttons_w - clock_w); cch_cl_obj->setXPos(width - buttons_w - clock_w);
//set required width of caption object //set required width of caption object
cc_text_w -= (clock_w + cch_offset); cc_text_w -= clock_w;
//stop clock if disabled or option run is disabled and clock is running //stop clock if disabled or option run is disabled and clock is running
if (cch_cl_enable){ if (cch_cl_enable){