diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index eef38b312..bdf01d2ce 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -624,14 +624,14 @@ void CCDraw::paintFbItems(const bool &do_save_bg) if (!cc_bg_image.empty()){ if (g_PicViewer->DisplayImage(cc_bg_image, v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy, cc_bg_image_tr_mode)){ // catch screen and store into paint cache - v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy); + if (cc_paint_cache) + v_fbdata.at(i).pixbuf = getScreen(v_fbdata.at(i).x, v_fbdata.at(i).y, v_fbdata.at(i).dx, v_fbdata.at(i).dy); v_fbdata.at(i).is_painted = true; }else{ if (v_fbdata.at(i).pixbuf){ delete[] v_fbdata.at(i).pixbuf; v_fbdata.at(i).pixbuf = NULL; } - v_fbdata.at(i).is_painted = false; } // On failed image paint, write this into log and reset image name. @@ -640,11 +640,11 @@ void CCDraw::paintFbItems(const bool &do_save_bg) cc_bg_image = ""; } } - + else + { /* If no background image is defined, we paint default box or box with gradient * This is also possible if any background image is defined but image paint ist failed */ - if (cc_bg_image.empty()){ if (cc_body_gradient_enable != CC_COLGRAD_OFF ){ /* If color gradient enabled we create a gradient_data diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index b1d0f1fd9..ab437000d 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -262,9 +262,24 @@ class CCDraw : public COSDFader, public CComponentsSignals, public CCTypes ///return current schadow width int getShadowWidth(){return shadow_w;} - ///paint caching for body and shadow, see also cc_paint_cache NOTE: has no effect if paint_bg = false + /**Enable paint of body and shadow from cache. + * This should help to paint items if they already painted and have existing instance + * Performance protection would prevent this. + * @return void + * + * @param[in] bool optional, default value = true + * @Note This feature is disabled as default. It’s useful to paint calculated parts, e.g. color gradient or with scaled background images. + * In case of painting with enabled background images with transparency parts, could raise unintended backgrounds (e.g. holes, wrong colors or gradients) on screen. + * In such case, it's not recommended enabling this feature. + * This function is not to be confused with save_bg. Paint_cache has no effect for restore of backgrounds with hide (). + * It has only effect to the fb layer tagged with CC_FBDATA_TYPE_BOX and CC_FBDATA_TYPE_SHADOW_BOX as long as the instance of the item is preserved. + * Of course, there is no effect if paint_bg = false. + * @see cc_paint_cach, disablePaintCache(), clearPaintCache(), clearFbData(), clearScreenBuffer() + */ void enablePaintCache(const bool &enable = true); - ///disable paint caching for body and shadow + /**Disable paint caching for body and shadow + * @see enablePaintCache() + */ void disablePaintCache(){enablePaintCache(false);} ///returns paint mode, true=item was painted