diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 41b2c1802..1140fbcd5 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -71,6 +71,8 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) cc_body_gradient_saturation = 0xC0; cc_body_gradient_direction = cc_body_gradient_direction_old = CFrameBuffer::gradientVertical; + gradientBgCleanUp = false; + v_fbdata.clear(); } @@ -591,6 +593,8 @@ void CCDraw::paintFbItems(bool do_save_bg) } // if found empty gradient buffer, create it, otherwise paint from cache + if (gradientBgCleanUp) + frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.r, fbdata.rtype); if (fbdata.gradient_data->boxBuf == NULL){ dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], paint new gradient)...\033[0m\n", __func__, __LINE__); fbdata.gradient_data->boxBuf = frameBuffer->paintBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, 0, fbdata.gradient_data, fbdata.r, fbdata.rtype); @@ -616,8 +620,6 @@ void CCDraw::paintFbItems(bool do_save_bg) OnAfterPaintLayers(); } - - void CCDraw::hide() { //restore saved screen background of item if available diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 152a6359b..f1d3d4092 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -142,6 +142,8 @@ class CCDraw : public COSDFader, public CComponentsSignals ///sub: get gradient data evaluted with current parameters gradientData_t* getGradientData(); + bool gradientBgCleanUp; + ///rendering of framebuffer elements at once, ///elements are contained in v_fbdata, presumes added frambuffer elements with paintInit(), ///parameter do_save_bg=true, saves background of element to pixel buffer, this can be restore with hide() @@ -315,6 +317,9 @@ class CCDraw : public COSDFader, public CComponentsSignals ///erase or paint over rendered objects without restore of background, it's similar to paintBackgroundBoxRel() known ///from CFrameBuffer but with possiblity to define color, default color is COL_BACKGROUND_PLUS_0 (empty background) virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1); + + virtual void enableGradientBgCleanUp(bool enable = true) { gradientBgCleanUp = enable; }; + virtual void disableGradientBgCleanUp(){ enableGradientBgCleanUp(false); }; }; #endif