CCDraw: precise function for kill handler

This should fix possible artefacts or holes in some rendered boxes.
Was especially striking at HD1 Hardware.
e.g. was observed while right/left switching on channel list at header
and without rounded corners and at certain footers.
This commit is contained in:
2017-06-16 11:42:21 +02:00
parent f46a174155
commit ef4467b6da
5 changed files with 33 additions and 29 deletions

View File

@@ -729,14 +729,21 @@ void CCDraw::hide()
//erase or paint over rendered objects //erase or paint over rendered objects
void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/) void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/)
{ {
int layers = fblayer_type;
if (fblayer_type & ~CC_FBDATA_TYPES)
layers = CC_FBDATA_TYPES;
for(size_t i =0; i< v_fbdata.size() ;i++){ for(size_t i =0; i< v_fbdata.size() ;i++){
if (fblayer_type == CC_FBDATA_TYPES || v_fbdata[i].fbdata_type & fblayer_type){ if (v_fbdata[i].fbdata_type & layers){
#if 0
if (bg_color != COL_BACKGROUND_PLUS_0) int r = 0;
#endif
int r = v_fbdata[i].r; if (corner_radius > -1){
if (corner_radius > -1) r = v_fbdata[i].r;
if (corner_radius != v_fbdata[i].r)
r = corner_radius; r = corner_radius;
}
if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){ if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){
frameBuffer->paintBoxRel(v_fbdata[i].x, frameBuffer->paintBoxRel(v_fbdata[i].x,
@@ -745,10 +752,9 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in
v_fbdata[i].dy, v_fbdata[i].dy,
bg_color, bg_color,
r, r,
corner_type); v_fbdata[i].rtype);
}else
dprintf(DEBUG_DEBUG, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy );
if (v_fbdata[i].fbdata_type & CC_FBDATA_TYPE_FRAME){
if (v_fbdata[i].frame_thickness) if (v_fbdata[i].frame_thickness)
frameBuffer->paintBoxFrame(v_fbdata[i].x, frameBuffer->paintBoxFrame(v_fbdata[i].x,
v_fbdata[i].y, v_fbdata[i].y,
@@ -756,21 +762,19 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in
v_fbdata[i].dy, v_fbdata[i].dy,
v_fbdata[i].frame_thickness, v_fbdata[i].frame_thickness,
bg_color, bg_color,
r, v_fbdata[i].r,
corner_type); v_fbdata[i].rtype);
}
}else
dprintf(DEBUG_DEBUG, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy );
v_fbdata[i].is_painted = false; v_fbdata[i].is_painted = false;
#if 0
else
frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy);
#endif
} }
} }
if (fblayer_type == CC_FBDATA_TYPES){
firstPaint = true; firstPaint = true;
is_painted = false; is_painted = false;
} }
}
void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius) void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius)
{ {

View File

@@ -396,7 +396,7 @@ class CCDraw : public COSDFader, public CComponentsSignals
* Shadow paint must be reworked, because dimensions of shadow containes not the real defined size. Parts of item are killed too. * Shadow paint must be reworked, because dimensions of shadow containes not the real defined size. Parts of item are killed too.
* *
*/ */
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES); virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES);
/**Erase shadow around rendered item. /**Erase shadow around rendered item.
* This is similar with the kill() member, but shadow will be handled only. * This is similar with the kill() member, but shadow will be handled only.

View File

@@ -315,7 +315,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
///hides item, arg: no_restore see hideCCItem() ///hides item, arg: no_restore see hideCCItem()
void hide(){disableClock(); CComponentsForm::hide();} void hide(){disableClock(); CComponentsForm::hide();}
///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer
void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true); void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES, bool disable_clock = true);
///set color gradient on/off, returns true if gradient mode was changed ///set color gradient on/off, returns true if gradient mode was changed
virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1); virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1);

View File

@@ -100,7 +100,7 @@ class CComponentsItem : public CComponents
* gui/color.h * gui/color.h
* driver/framebuffer.h * driver/framebuffer.h
*/ */
virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = CC_FBDATA_TYPES); virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = ~CC_FBDATA_TYPES);
///get the current item type, see attribute cc_item_type above ///get the current item type, see attribute cc_item_type above
virtual int getItemType(); virtual int getItemType();

View File

@@ -100,7 +100,7 @@ typedef enum
CC_FBDATA_TYPE_FRAME = 8, CC_FBDATA_TYPE_FRAME = 8,
CC_FBDATA_TYPE_BACKGROUND = 16, CC_FBDATA_TYPE_BACKGROUND = 16,
CC_FBDATA_TYPES = 32 CC_FBDATA_TYPES = CC_FBDATA_TYPE_BOX | CC_FBDATA_TYPE_SHADOW_BOX | CC_FBDATA_TYPE_FRAME
}FBDATA_TYPES; }FBDATA_TYPES;
//fb color gradient types //fb color gradient types