From fdeda0aab15f891d4ccac7e55830a38ea8d8d2e7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 20 Apr 2013 22:43:24 +0200 Subject: [PATCH] CComponentsItem: don't render shadow as full box Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/48c4142a245f8db5c900d94f2b851267eb2340e6 Author: Thilo Graf Date: 2013-04-20 (Sat, 20 Apr 2013) --- src/gui/components/cc_item.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 7c00d54c5..41d322999 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -81,14 +81,22 @@ 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 rad = (corner_rad>th) ? corner_rad-th : corner_rad; + + //calculate positon of shadow areas + int x_sh = corner_rad>0 ? x+width-2*corner_rad+sw : x+width; //right + int y_sh = corner_rad>0 ? y+height-2*corner_rad+sw : y+height; //bottom + + //calculate current shadow width depends of current corner_rad + int sw_cur = corner_rad>0 ? 2*corner_rad : sw; comp_fbdata_t fbdata[] = { - {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_SHADOW, x+sw, y+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL}, - {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame_cur, corner_rad, th, NULL, NULL}, - {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, rad, 0, NULL, NULL}, + {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_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++)