From ef4467b6da8206c0e97364d1820364b59bf34abc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 16 Jun 2017 11:42:21 +0200 Subject: [PATCH] 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. --- src/gui/components/cc_draw.cpp | 54 ++++++++++++++++-------------- src/gui/components/cc_draw.h | 2 +- src/gui/components/cc_frm_header.h | 2 +- src/gui/components/cc_item.h | 2 +- src/gui/components/cc_types.h | 2 +- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index c28144444..39ca711d8 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -729,14 +729,21 @@ void CCDraw::hide() //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*/) { + int layers = fblayer_type; + + if (fblayer_type & ~CC_FBDATA_TYPES) + layers = CC_FBDATA_TYPES; + for(size_t i =0; i< v_fbdata.size() ;i++){ - if (fblayer_type == CC_FBDATA_TYPES || v_fbdata[i].fbdata_type & fblayer_type){ -#if 0 - if (bg_color != COL_BACKGROUND_PLUS_0) -#endif - int r = v_fbdata[i].r; - if (corner_radius > -1) - r = corner_radius; + if (v_fbdata[i].fbdata_type & layers){ + + int r = 0; + + if (corner_radius > -1){ + r = v_fbdata[i].r; + if (corner_radius != v_fbdata[i].r) + r = corner_radius; + } if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){ frameBuffer->paintBoxRel(v_fbdata[i].x, @@ -745,31 +752,28 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in v_fbdata[i].dy, bg_color, r, - corner_type); + v_fbdata[i].rtype); + + if (v_fbdata[i].fbdata_type & CC_FBDATA_TYPE_FRAME){ + if (v_fbdata[i].frame_thickness) + frameBuffer->paintBoxFrame(v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy, + v_fbdata[i].frame_thickness, + bg_color, + v_fbdata[i].r, + 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].frame_thickness) - frameBuffer->paintBoxFrame(v_fbdata[i].x, - v_fbdata[i].y, - v_fbdata[i].dx, - v_fbdata[i].dy, - v_fbdata[i].frame_thickness, - bg_color, - r, - corner_type); 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; - is_painted = false; - } + firstPaint = true; + is_painted = false; } void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius) diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 0f23e7eb4..ab7400ca8 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -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. * */ - 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. * This is similar with the kill() member, but shadow will be handled only. diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 29f8b8315..e1dd05f66 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -315,7 +315,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT ///hides item, arg: no_restore see hideCCItem() void hide(){disableClock(); CComponentsForm::hide();} ///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 virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1); diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index 9d633ad62..d168c3832 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -100,7 +100,7 @@ class CComponentsItem : public CComponents * gui/color.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 virtual int getItemType(); diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index e24f5cc03..d73bd1549 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -100,7 +100,7 @@ typedef enum CC_FBDATA_TYPE_FRAME = 8, 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; //fb color gradient types