diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 6cebf6ebd..076f743ab 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -78,12 +78,11 @@ void CComponentsItem::paintInit(bool do_save_bg) if (v_fbdata.empty()){ //calculate current needed corner radius for body box, depends of frame thickness - int rad = (corner_rad>th) ? corner_rad-th : corner_rad; - int sw = (shadow) ? shadow_w : 0; + int rad = (th) ? corner_rad-th : corner_rad; + //and ensure max radius < dimensions + rad = min(min(rad, corner_rad), min(width, height)); - //evaluate shadow mode - bool sh_r = (shadow & CC_SHADOW_ON) || (shadow & CC_SHADOW_RIGHT); - bool sh_b = (shadow & CC_SHADOW_ON) || (shadow & CC_SHADOW_BOTTOM); + int sw = (shadow) ? shadow_w : 0; //if item is bound on a parent form,... int ix = x, iy = y; @@ -103,37 +102,92 @@ void CComponentsItem::paintInit(bool do_save_bg) // sw = 0; // } + //evaluate shadow layer parts + //handle shadow corner dimensions + int sh_cdx = rad+sw, sh_cdy = rad+sw; + + //handle shadow positions + //...corner bottom right + int sh_cbr_x = ix+width-sh_cdx+sw; + int sh_cbr_y = iy+height-sh_cdy+sw; + + //...corner top right + int sh_ctr_x = sh_cbr_x; + int sh_ctr_y = iy+sw; + + //...corner bottom left + int sh_cbl_x = ix+sw; + int sh_cbl_y = sh_cbr_y; + + //...bar bottom + int sh_bx = sh_cbl_x+sh_cdx; + int sh_by = iy+height; + int sh_bdx = width-sh_cdx-sh_cdx; + + //...bar right + int sh_rx = ix+width; + int sh_ry = sh_ctr_y+sh_cdy; + int sh_rdy = height-sh_cdy-sh_cdy; + + //corners + bool sh_ctr = (shadow & CC_SHADOW_CORNER_TOP_RIGHT); + bool sh_cbr = (shadow & CC_SHADOW_CORNER_BOTTOM_RIGHT); + bool sh_cbl = (shadow & CC_SHADOW_CORNER_BOTTOM_LEFT); + + //...bars + bool sh_br = (shadow & CC_SHADOW_RIGHT); + printf("<<<<<<<<<<