diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 8e0d7a5da..dd584b836 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -133,6 +133,25 @@ void CComponents::paintFbItems(bool do_save_bg) } else if (fbtype == CC_FBDATA_TYPE_BACKGROUND) frameBuffer->paintBackgroundBoxRel(x, y, v_fbdata[i].dx, v_fbdata[i].dy); + else if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX) { + if (shadow) { + int sw = shadow_w; + int sw_cur = sw; + int x_sh = v_fbdata[i].x + v_fbdata[i].dx - sw; + int y_sh = v_fbdata[i].y + v_fbdata[i].dy - sw; + if (corner_type && v_fbdata[i].r) { + //calculate positon of shadow areas + x_sh += sw - 2*v_fbdata[i].r; + y_sh += sw - 2*v_fbdata[i].r; + //calculate current shadow width depends of current corner_rad + sw_cur = max(2*v_fbdata[i].r, sw); + } + // shadow right + frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT); + // shadow bottom + frameBuffer->paintBoxRel(v_fbdata[i].x, y_sh, v_fbdata[i].dx, sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_BOTTOM); + } + } else frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); } diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index d621b0cae..36adc78a1 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -78,33 +78,21 @@ void CComponentsItem::paintInit(bool do_save_bg) //calculate current needed corner radius for body box, depends of frame thickness int rad = (corner_rad>th) ? corner_rad-th : corner_rad; - - int sw = 0, sw_cur = 0; - int x_sh = x + width; - int y_sh = y + height; - if (shadow) { - sw = shadow_w; - sw_cur = sw; - if (corner_type && corner_rad) { - //calculate positon of shadow areas - x_sh += sw - 2*corner_rad; - y_sh += sw - 2*corner_rad; - //calculate current shadow width depends of current corner_rad - sw_cur = max(2*corner_rad, sw); - } - } - + int sw = (shadow) ? shadow_w : 0; comp_fbdata_t fbdata[] = { - {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_BOX, x_sh, y+sw, sw_cur, height, col_shadow, corner_rad, 0, NULL, NULL},//shadow right - {CC_FBDATA_TYPE_BOX, x+sw, y_sh, width, sw_cur, col_shadow, corner_rad, 0, NULL, NULL},//shadow bottom - {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame_cur, corner_rad, th, NULL, NULL},//frame + {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_SHADOW_BOX, x+sw, y+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL},//shadow + {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame_cur, corner_rad, th, NULL, NULL},//frame {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, rad, 0, NULL, NULL},//body }; - for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) { + if (((fbdata[i].fbdata_type == CC_FBDATA_TYPE_SHADOW_BOX) && !shadow) || + ((fbdata[i].fbdata_type == CC_FBDATA_TYPE_FRAME) && !fr_thickness)) + continue; v_fbdata.push_back(fbdata[i]); + } #ifdef DEBUG_CC printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __FUNCTION__, cc_item_type, cc_item_index, height, width); #endif diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index bcc5b9ad3..60a842ab4 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -74,6 +74,7 @@ typedef enum { CC_FBDATA_TYPE_BGSCREEN, CC_FBDATA_TYPE_BOX, + CC_FBDATA_TYPE_SHADOW_BOX, CC_FBDATA_TYPE_FRAME, CC_FBDATA_TYPE_LINE, CC_FBDATA_TYPE_BACKGROUND,