BigW Consortium Gitlab

Commit ea1532e6 by Gabor

Add lv_objs_t to every lv_obj derivated styles

parent 124eb4bb
...@@ -52,9 +52,9 @@ static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color ...@@ -52,9 +52,9 @@ static void (*map_fp)(const area_t * cords_p, const area_t * mask_p, const color
static lv_rects_t lv_img_no_pic_rects = { static lv_rects_t lv_img_no_pic_rects = {
.mcolor = COLOR_BLACK, .gcolor = COLOR_BLACK, .objs.color = COLOR_BLACK, .gcolor = COLOR_BLACK,
.bcolor = COLOR_RED, .bwidth = 2 * LV_STYLE_MULT, .bopa = 100, .bcolor = COLOR_RED, .bwidth = 2 * LV_STYLE_MULT, .bopa = 100,
.round = 0, .empty = 0 .round = 0, .objs.empty = 0
}; };
static lv_labels_t lv_img_no_pic_labels = { static lv_labels_t lv_img_no_pic_labels = {
...@@ -80,8 +80,7 @@ static lv_labels_t lv_img_no_pic_labels = { ...@@ -80,8 +80,7 @@ static lv_labels_t lv_img_no_pic_labels = {
void lv_draw_rect(const area_t * cords_p, const area_t * mask_p, void lv_draw_rect(const area_t * cords_p, const area_t * mask_p,
const lv_rects_t * rects_p, opa_t opa) const lv_rects_t * rects_p, opa_t opa)
{ {
if(rects_p->empty == 0){ if(rects_p->objs.empty == 0){
lv_draw_rect_main_mid(cords_p, mask_p, rects_p, opa); lv_draw_rect_main_mid(cords_p, mask_p, rects_p, opa);
if(rects_p->round != 0) { if(rects_p->round != 0) {
...@@ -456,7 +455,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -456,7 +455,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = max(act_area.x1, act_area.x2); draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2); draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2); draw_area.y2 = max(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->color, opa); fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
} }
if (hor == false && last_x != act_point.x) { if (hor == false && last_x != act_point.x) {
area_t act_area; area_t act_area;
...@@ -472,7 +471,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -472,7 +471,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = max(act_area.x1, act_area.x2); draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2); draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2); draw_area.y2 = max(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->color, opa); fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
} }
/*Calc. the next point of the line*/ /*Calc. the next point of the line*/
...@@ -500,7 +499,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -500,7 +499,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = max(act_area.x1, act_area.x2); draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2); draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2); draw_area.y2 = max(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->color, opa); fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
} }
if (hor == false) { if (hor == false) {
area_t act_area; area_t act_area;
...@@ -514,7 +513,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p, ...@@ -514,7 +513,7 @@ void lv_draw_line(const point_t * p1, const point_t * p2, const area_t * mask_p,
draw_area.x2 = max(act_area.x1, act_area.x2); draw_area.x2 = max(act_area.x1, act_area.x2);
draw_area.y1 = min(act_area.y1, act_area.y2); draw_area.y1 = min(act_area.y1, act_area.y2);
draw_area.y2 = max(act_area.y1, act_area.y2); draw_area.y2 = max(act_area.y1, act_area.y2);
fill_fp(&draw_area, mask_p, lines_p->color, opa); fill_fp(&draw_area, mask_p, lines_p->objs.color, opa);
} }
} }
...@@ -533,7 +532,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p, ...@@ -533,7 +532,7 @@ static void lv_draw_rect_main_mid(const area_t * cords_p, const area_t * mask_p,
{ {
uint16_t radius = rects_p->round; uint16_t radius = rects_p->round;
color_t main_color = rects_p->mcolor; color_t main_color = rects_p->objs.color;
color_t grad_color = rects_p->gcolor; color_t grad_color = rects_p->gcolor;
uint8_t mix; uint8_t mix;
cord_t height = area_get_height(cords_p); cord_t height = area_get_height(cords_p);
...@@ -583,7 +582,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask ...@@ -583,7 +582,7 @@ static void lv_draw_rect_main_corner(const area_t * cords_p, const area_t * mask
{ {
uint16_t radius = rects_p->round; uint16_t radius = rects_p->round;
color_t main_color = rects_p->mcolor; color_t main_color = rects_p->objs.color;
color_t grad_color = rects_p->gcolor; color_t grad_color = rects_p->gcolor;
color_t act_color; color_t act_color;
uint8_t mix; uint8_t mix;
......
...@@ -56,19 +56,19 @@ static lv_btns_t lv_btns_def = ...@@ -56,19 +56,19 @@ static lv_btns_t lv_btns_def =
.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY, .gcolor[LV_BTN_STATE_INA] = COLOR_GRAY,
.bcolor[LV_BTN_STATE_INA] = COLOR_WHITE, .bcolor[LV_BTN_STATE_INA] = COLOR_WHITE,
.bwidth = 2 * LV_STYLE_MULT, .rects.bwidth = 2 * LV_STYLE_MULT,
.bopa = 50, .rects.bopa = 50,
.empty = 0, .rects.objs.empty = 0,
.round = 4 * LV_STYLE_MULT, .rects.round = 4 * LV_STYLE_MULT,
.hpad = 10 * LV_STYLE_MULT, .rects.hpad = 10 * LV_STYLE_MULT,
.vpad = 15 * LV_STYLE_MULT, .rects.vpad = 15 * LV_STYLE_MULT,
}; };
static lv_btns_t lv_btns_transp = static lv_btns_t lv_btns_transp =
{ {
.bwidth = 0, .rects.bwidth = 0,
.empty = 1, .rects.objs.empty = 1,
.hpad = 10 * LV_STYLE_MULT, .rects.hpad = 10 * LV_STYLE_MULT,
.vpad = 15 * LV_STYLE_MULT, .rects.vpad = 15 * LV_STYLE_MULT,
}; };
static lv_btns_t lv_btns_border = static lv_btns_t lv_btns_border =
...@@ -78,12 +78,12 @@ static lv_btns_t lv_btns_border = ...@@ -78,12 +78,12 @@ static lv_btns_t lv_btns_border =
.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_BLACK, .bcolor[LV_BTN_STATE_TGL_REL] = COLOR_BLACK,
.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_BLACK, .bcolor[LV_BTN_STATE_TGL_PR] = COLOR_BLACK,
.bcolor[LV_BTN_STATE_INA] = COLOR_GRAY, .bcolor[LV_BTN_STATE_INA] = COLOR_GRAY,
.bwidth = 2 * LV_STYLE_MULT, .rects.bwidth = 2 * LV_STYLE_MULT,
.empty = 1, .rects.objs.empty = 1,
.bopa = 50, .rects.bopa = 50,
.round = 4 * LV_STYLE_MULT, .rects.round = 4 * LV_STYLE_MULT,
.hpad = 10 * LV_STYLE_MULT, .rects.hpad = 10 * LV_STYLE_MULT,
.vpad = 15 * LV_STYLE_MULT, .rects.vpad = 15 * LV_STYLE_MULT,
}; };
/********************** /**********************
...@@ -417,17 +417,12 @@ static void lv_btn_style_load(lv_obj_t * obj_dp) ...@@ -417,17 +417,12 @@ static void lv_btn_style_load(lv_obj_t * obj_dp)
{ {
lv_btn_state_t state = lv_btn_get_state(obj_dp); lv_btn_state_t state = lv_btn_get_state(obj_dp);
lv_btns_t * btns_p = lv_obj_get_style(obj_dp); lv_btns_t * btns_p = lv_obj_get_style(obj_dp);
/*Init the style*/ /*Init the style*/
lv_rects_get(LV_RECTS_DEF, &btns_p->rects); lv_rects_get(LV_RECTS_DEF, &btns_p->rects);
btns_p->rects.mcolor = btns_p->mcolor[state]; btns_p->rects.objs.color = btns_p->mcolor[state];
btns_p->rects.gcolor = btns_p->gcolor[state]; btns_p->rects.gcolor = btns_p->gcolor[state];
btns_p->rects.bcolor = btns_p->bcolor[state]; btns_p->rects.bcolor = btns_p->bcolor[state];
btns_p->rects.bwidth = btns_p->bwidth;
btns_p->rects.bopa = btns_p->bopa;
btns_p->rects.round = btns_p->round;
btns_p->rects.empty = btns_p->empty;
btns_p->rects.hpad= btns_p->hpad;
btns_p->rects.vpad= btns_p->vpad;
} }
#endif #endif
...@@ -39,12 +39,6 @@ typedef struct ...@@ -39,12 +39,6 @@ typedef struct
color_t mcolor[LV_BTN_STATE_NUM]; color_t mcolor[LV_BTN_STATE_NUM];
color_t gcolor[LV_BTN_STATE_NUM]; color_t gcolor[LV_BTN_STATE_NUM];
color_t bcolor[LV_BTN_STATE_NUM]; color_t bcolor[LV_BTN_STATE_NUM];
cord_t bwidth;
cord_t round;
opa_t bopa;
uint8_t empty;
cord_t hpad;
cord_t vpad;
}lv_btns_t; }lv_btns_t;
typedef enum typedef enum
......
...@@ -67,7 +67,6 @@ lv_obj_t* lv_img_create(lv_obj_t* par_dp, lv_obj_t * copy_dp) ...@@ -67,7 +67,6 @@ lv_obj_t* lv_img_create(lv_obj_t* par_dp, lv_obj_t * copy_dp)
lv_img_ext_t * img_ext_dp = lv_obj_get_ext(new_obj_dp); lv_img_ext_t * img_ext_dp = lv_obj_get_ext(new_obj_dp);
if(copy_dp == NULL) { if(copy_dp == NULL) {
img_ext_dp->fn_dp = NULL; img_ext_dp->fn_dp = NULL;
img_ext_dp->w = lv_obj_get_width(new_obj_dp); img_ext_dp->w = lv_obj_get_width(new_obj_dp);
img_ext_dp->h = lv_obj_get_height(new_obj_dp); img_ext_dp->h = lv_obj_get_height(new_obj_dp);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
**********************/ **********************/
typedef struct typedef struct
{ {
lv_objs_t objs;
uint8_t transp_en :1; uint8_t transp_en :1;
}lv_imgs_t; }lv_imgs_t;
......
...@@ -38,13 +38,13 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -38,13 +38,13 @@ static bool lv_line_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_lines_t lv_lines_def = { .width = 2 * LV_STYLE_MULT, .color = COLOR_RED, static lv_lines_t lv_lines_def = { .width = 2 * LV_STYLE_MULT, .objs.color = COLOR_RED,
.bg_color = COLOR_BLACK, .bg_opa = 0}; .bg_color = COLOR_BLACK, .bg_opa = 0};
static lv_lines_t lv_lines_decor = { .width = 1 * LV_STYLE_MULT, .color = COLOR_GRAY, static lv_lines_t lv_lines_decor = { .width = 1 * LV_STYLE_MULT, .objs.color = COLOR_GRAY,
.bg_color = COLOR_BLACK, .bg_opa = 0}; .bg_color = COLOR_BLACK, .bg_opa = 0};
static lv_lines_t lv_lines_chart = { .width = 3 * LV_STYLE_MULT, .color = COLOR_BLUE, static lv_lines_t lv_lines_chart = { .width = 3 * LV_STYLE_MULT, .objs.color = COLOR_BLUE,
.bg_color = COLOR_BLACK, .bg_opa = 0}; .bg_color = COLOR_BLACK, .bg_opa = 0};
/********************** /**********************
......
...@@ -32,7 +32,7 @@ typedef struct ...@@ -32,7 +32,7 @@ typedef struct
typedef struct typedef struct
{ {
color_t color; lv_objs_t objs;
color_t bg_color; color_t bg_color;
uint16_t width; uint16_t width;
opa_t bg_opa; opa_t bg_opa;
......
...@@ -32,23 +32,23 @@ static void lv_page_sb_refresh(lv_obj_t* main_dp); ...@@ -32,23 +32,23 @@ static void lv_page_sb_refresh(lv_obj_t* main_dp);
**********************/ **********************/
static lv_pages_t lv_pages_def = static lv_pages_t lv_pages_def =
{ {
.bg_rects.mcolor = COLOR_WHITE, .bg_rects.objs.color = COLOR_WHITE,
.bg_rects.gcolor = COLOR_SILVER, .bg_rects.gcolor = COLOR_SILVER,
.bg_rects.bcolor = COLOR_GRAY, .bg_rects.bcolor = COLOR_GRAY,
.bg_rects.bopa = 50, .bg_rects.bopa = 50,
.bg_rects.bwidth = 0 * LV_STYLE_MULT, .bg_rects.bwidth = 0 * LV_STYLE_MULT,
.bg_rects.round = 2 * LV_STYLE_MULT, .bg_rects.round = 2 * LV_STYLE_MULT,
.bg_rects.empty = 0, .bg_rects.objs.empty = 0,
.bg_rects.hpad = 10, .bg_rects.hpad = 10,
.bg_rects.vpad = 10, .bg_rects.vpad = 10,
.sb_rects.mcolor = COLOR_BLACK, .sb_rects.objs.color = COLOR_BLACK,
.sb_rects.gcolor = COLOR_BLACK, .sb_rects.gcolor = COLOR_BLACK,
.sb_rects.bcolor = COLOR_WHITE, .sb_rects.bcolor = COLOR_WHITE,
.sb_rects.bopa = 50, .sb_rects.bopa = 50,
.sb_rects.bwidth = 1 * LV_STYLE_MULT, .sb_rects.bwidth = 1 * LV_STYLE_MULT,
.sb_rects.round = 5 * LV_STYLE_MULT, .sb_rects.round = 5 * LV_STYLE_MULT,
.sb_rects.empty = 0, .sb_rects.objs.empty = 0,
.sb_width= 8 * LV_STYLE_MULT, .sb_width= 8 * LV_STYLE_MULT,
.sb_opa=50, .sb_opa=50,
...@@ -63,23 +63,23 @@ static lv_pages_t lv_pages_def = ...@@ -63,23 +63,23 @@ static lv_pages_t lv_pages_def =
static lv_pages_t lv_pages_paper = static lv_pages_t lv_pages_paper =
{ {
.bg_rects.mcolor = COLOR_WHITE, .bg_rects.objs.color = COLOR_WHITE,
.bg_rects.gcolor = COLOR_WHITE, .bg_rects.gcolor = COLOR_WHITE,
.bg_rects.bcolor = COLOR_GRAY, .bg_rects.bcolor = COLOR_GRAY,
.bg_rects.bopa = 100, .bg_rects.bopa = 100,
.bg_rects.bwidth = 2 * LV_STYLE_MULT, .bg_rects.bwidth = 2 * LV_STYLE_MULT,
.bg_rects.round = 0 * LV_STYLE_MULT, .bg_rects.round = 0 * LV_STYLE_MULT,
.bg_rects.empty = 0, .bg_rects.objs.empty = 0,
.bg_rects.hpad = 20 * LV_STYLE_MULT, .bg_rects.hpad = 20 * LV_STYLE_MULT,
.bg_rects.vpad = 20 * LV_STYLE_MULT, .bg_rects.vpad = 20 * LV_STYLE_MULT,
.sb_rects.mcolor = COLOR_BLACK, .sb_rects.objs.color = COLOR_BLACK,
.sb_rects.gcolor = COLOR_BLACK, .sb_rects.gcolor = COLOR_BLACK,
.sb_rects.bcolor = COLOR_SILVER, .sb_rects.bcolor = COLOR_SILVER,
.sb_rects.bopa = 100, .sb_rects.bopa = 100,
.sb_rects.bwidth = 1 * LV_STYLE_MULT, .sb_rects.bwidth = 1 * LV_STYLE_MULT,
.sb_rects.round = 5 * LV_STYLE_MULT, .sb_rects.round = 5 * LV_STYLE_MULT,
.sb_rects.empty = 0, .sb_rects.objs.empty = 0,
.sb_width = 10 * LV_STYLE_MULT, .sb_width = 10 * LV_STYLE_MULT,
.sb_opa=50, .sb_opa=50,
...@@ -93,17 +93,17 @@ static lv_pages_t lv_pages_paper = ...@@ -93,17 +93,17 @@ static lv_pages_t lv_pages_paper =
static lv_pages_t lv_pages_transp = static lv_pages_t lv_pages_transp =
{ {
.bg_rects.empty = 1, .bg_rects.objs.empty = 1,
.bg_rects.hpad = 1, .bg_rects.hpad = 1,
.bg_rects.vpad = 1, .bg_rects.vpad = 1,
.sb_rects.mcolor = COLOR_BLACK, .sb_rects.objs.color = COLOR_BLACK,
.sb_rects.gcolor = COLOR_BLACK, .sb_rects.gcolor = COLOR_BLACK,
.sb_rects.bcolor = COLOR_WHITE, .sb_rects.bcolor = COLOR_WHITE,
.sb_rects.bopa = 0, .sb_rects.bopa = 0,
.sb_rects.bwidth = 1 * LV_STYLE_MULT, .sb_rects.bwidth = 1 * LV_STYLE_MULT,
.sb_rects.round = 5 * LV_STYLE_MULT, .sb_rects.round = 5 * LV_STYLE_MULT,
.sb_rects.empty = 0, .sb_rects.objs.empty = 0,
.sb_width = 8 * LV_STYLE_MULT, .sb_width = 8 * LV_STYLE_MULT,
.sb_opa = 50, .sb_opa = 50,
......
...@@ -31,18 +31,18 @@ static bool lv_rect_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -31,18 +31,18 @@ static bool lv_rect_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_rects_t lv_rects_def = static lv_rects_t lv_rects_def =
{ .mcolor = COLOR_MAKE(0x50, 0x70, 0x90), .gcolor = COLOR_MAKE(0x20, 0x40, 0x60), { .objs.color = COLOR_MAKE(0x50, 0x70, 0x90), .gcolor = COLOR_MAKE(0x20, 0x40, 0x60),
.bcolor = COLOR_WHITE, .bwidth = 2 * LV_STYLE_MULT, .bopa = 50, .bcolor = COLOR_WHITE, .bwidth = 2 * LV_STYLE_MULT, .bopa = 50,
.round = 4 * LV_STYLE_MULT, .empty = 0, .round = 4 * LV_STYLE_MULT, .objs.empty = 0,
.hpad = 0, .vpad = 0 }; .hpad = 0, .vpad = 0 };
static lv_rects_t lv_rects_transp = static lv_rects_t lv_rects_transp =
{ .bwidth = 0, .empty = 0, { .bwidth = 0, .objs.empty = 0,
.hpad = 0, .vpad = 0 }; .hpad = 0, .vpad = 0 };
static lv_rects_t lv_rects_border = static lv_rects_t lv_rects_border =
{ .bcolor = COLOR_BLACK, .bwidth = 2 * LV_STYLE_MULT, .bopa = 100, { .bcolor = COLOR_BLACK, .bwidth = 2 * LV_STYLE_MULT, .bopa = 100,
.round = 4 * LV_STYLE_MULT, .empty = 1, .round = 4 * LV_STYLE_MULT, .objs.empty = 1,
.hpad = 0, .vpad = 0}; .hpad = 0, .vpad = 0};
/********************** /**********************
...@@ -265,7 +265,7 @@ static bool lv_rect_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo ...@@ -265,7 +265,7 @@ static bool lv_rect_design(lv_obj_t* obj_dp, const area_t * mask_p, lv_design_mo
{ {
/* Because of the radius it is not sure the area is covered*/ /* Because of the radius it is not sure the area is covered*/
if(mode == LV_DESIGN_COVER_CHK) { if(mode == LV_DESIGN_COVER_CHK) {
if(LV_SA(obj_dp, lv_rects_t)->empty != 0) return false; if(LV_SA(obj_dp, lv_rects_t)->objs.empty != 0) return false;
uint16_t r = LV_SA(obj_dp, lv_rects_t)->round; uint16_t r = LV_SA(obj_dp, lv_rects_t)->round;
area_t area_tmp; area_t area_tmp;
......
...@@ -25,14 +25,13 @@ ...@@ -25,14 +25,13 @@
typedef struct typedef struct
{ {
color_t mcolor; lv_objs_t objs;
color_t gcolor; color_t gcolor;
color_t bcolor; color_t bcolor;
uint16_t bwidth; uint16_t bwidth;
cord_t hpad; cord_t hpad;
cord_t vpad; cord_t vpad;
uint8_t bopa; uint8_t bopa;
uint8_t empty :1;
uint16_t round; uint16_t round;
}lv_rects_t; }lv_rects_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment