cc_draw: add missing paint cache check for background images

Was always enabled with images.


Origin commit data
------------------
Commit: 537843422c
Author: Thilo Graf <dbt@novatux.de>
Date: 2021-12-02 (Thu, 02 Dec 2021)
This commit is contained in:
2021-12-02 13:50:51 +01:00
committed by vanhofen
parent b37511dd46
commit c25e8b5d57
2 changed files with 21 additions and 6 deletions

View File

@@ -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

View File

@@ -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. Its 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