mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
CComponents: Reworked paint the shadows
- Paint rounded corners only where it is required
- Skip paint frame/paint shadow, if not defined
Origin commit data
------------------
Branch: ni/coolstream
Commit: 4da83b546c
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2013-05-24 (Fri, 24 May 2013)
Origin message was:
------------------
* CComponents: Reworked paint the shadows
- Paint rounded corners only where it is required
- Skip paint frame/paint shadow, if not defined
------------------
This commit was generated by Migit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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_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
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user