1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Run code formatter

This commit is contained in:
Gabor Kiss-Vamosi 2020-06-16 13:47:04 +02:00
parent 2d0480c03d
commit 41e65d9df1
16 changed files with 130 additions and 120 deletions

View File

@ -205,7 +205,8 @@ void _lv_disp_refr_task(lv_task_t * task)
if(lv_disp_is_true_double_buf(disp_refr)) {
if(disp_refr->driver.set_px_cb) {
LV_LOG_WARN("Can't handle 2 screen sized buffers with set_px_cb. Display is not refreshed.");
} else {
}
else {
lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr);
/*Flush the content of the VDB*/
@ -217,11 +218,11 @@ void _lv_disp_refr_task(lv_task_t * task)
while(vdb->flushing);
lv_color_t * copy_buf = NULL;
#if LV_USE_GPU_STM32_DMA2D
#if LV_USE_GPU_STM32_DMA2D
LV_UNUSED(copy_buf);
#else
#else
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
#endif
#endif
uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;
@ -232,12 +233,12 @@ void _lv_disp_refr_task(lv_task_t * task)
if(disp_refr->inv_area_joined[a] == 0) {
uint32_t start_offs =
(hres * disp_refr->inv_areas[a].y1 + disp_refr->inv_areas[a].x1) * sizeof(lv_color_t);
#if LV_USE_GPU_STM32_DMA2D
#if LV_USE_GPU_STM32_DMA2D
lv_gpu_stm32_dma2d_copy((lv_color_t *)(buf_act + start_offs), disp_refr->driver.hor_res,
(lv_color_t *)(buf_ina + start_offs), disp_refr->driver.hor_res,
lv_area_get_width(&disp_refr->inv_areas[a]),
lv_area_get_height(&disp_refr->inv_areas[a]));
#else
#else
lv_coord_t y;
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
@ -249,7 +250,7 @@ void _lv_disp_refr_task(lv_task_t * task)
_lv_memcpy(buf_act + start_offs, copy_buf, line_length);
start_offs += hres * sizeof(lv_color_t);
}
#endif
#endif
}
}

View File

@ -758,7 +758,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
}
/*Go to the next column*/
if(col_bit < (int32_t) (8 - bpp)) {
if(col_bit < (int32_t)(8 - bpp)) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}

View File

@ -456,9 +456,12 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_co
lv_color_t ret;
#if LV_COLOR_DEPTH != 1
/*LV_COLOR_DEPTH == 8, 16 or 32*/
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) *
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
LV_COLOR_SET_A(ret, 0xFF);
#else
/*LV_COLOR_DEPTH == 1*/

View File

@ -26,7 +26,7 @@
**********************/
typedef struct {
lv_style_t opa_cover;
}theme_styles_t;
} theme_styles_t;
/**********************
* STATIC PROTOTYPES

View File

@ -73,8 +73,7 @@
/**********************
* TYPEDEFS
**********************/
typedef struct
{
typedef struct {
lv_style_t scr;
lv_style_t bg;
lv_style_t bg_click;
@ -83,96 +82,96 @@ typedef struct
lv_style_t pad_inner;
lv_style_t pad_small;
#if LV_USE_ARC
#if LV_USE_ARC
lv_style_t arc_indic;
lv_style_t arc_bg;
#endif
#endif
#if LV_USE_BAR
#if LV_USE_BAR
lv_style_t bar_bg;
lv_style_t bar_indic;
#endif
#endif
#if LV_USE_CALENDAR
#if LV_USE_CALENDAR
lv_style_t calendar_date_nums, calendar_header, calendar_daynames;
#endif
#endif
#if LV_USE_CPICKER
#if LV_USE_CPICKER
lv_style_t cpicker_bg, cpicker_indic;
#endif
#endif
#if LV_USE_CHART
#if LV_USE_CHART
lv_style_t chart_bg, chart_series_bg, chart_series;
#endif
#endif
#if LV_USE_CHECKBOX
#if LV_USE_CHECKBOX
lv_style_t cb_bg, cb_bullet;
#endif
#endif
#if LV_USE_DROPDOWN
#if LV_USE_DROPDOWN
lv_style_t ddlist_page, ddlist_sel;
#endif
#endif
#if LV_USE_GAUGE
#if LV_USE_GAUGE
lv_style_t gauge_main, gauge_strong, gauge_needle;
#endif
#endif
#if LV_USE_KEYBOARD
#if LV_USE_KEYBOARD
lv_style_t kb_bg;
#endif
#endif
#if LV_USE_LED
#if LV_USE_LED
lv_style_t led;
#endif
#endif
#if LV_USE_LINEMETER
#if LV_USE_LINEMETER
lv_style_t lmeter;
#endif
#endif
#if LV_USE_LIST
#if LV_USE_LIST
lv_style_t list_bg, list_btn;
#endif
#endif
#if LV_USE_MSGBOX
#if LV_USE_MSGBOX
lv_style_t mbox_bg;
#endif
#endif
#if LV_USE_PAGE
#if LV_USE_PAGE
lv_style_t sb;
#if LV_USE_ANIMATION
#if LV_USE_ANIMATION
lv_style_t edge_flash;
#endif
#endif
#endif
#endif
#if LV_USE_ROLLER
#if LV_USE_ROLLER
lv_style_t roller_bg, roller_sel;
#endif
#endif
#if LV_USE_SLIDER
#if LV_USE_SLIDER
lv_style_t slider_knob, slider_bg;
#endif
#endif
#if LV_USE_SPINBOX
#if LV_USE_SPINBOX
lv_style_t spinbox_cursor;
#endif
#endif
#if LV_USE_SWITCH
#if LV_USE_SWITCH
lv_style_t sw_knob;
#endif
#endif
#if LV_USE_TABLE
#if LV_USE_TABLE
lv_style_t table_cell;
#endif
#endif
#if LV_USE_TABVIEW || LV_USE_WIN
#if LV_USE_TABVIEW || LV_USE_WIN
lv_style_t tabview_btns, tabview_btns_bg, tabview_indic, tabview_page_scrl;
#endif
#endif
#if LV_USE_TEXTAREA
#if LV_USE_TEXTAREA
lv_style_t ta_cursor, ta_placeholder;
#endif
#endif
}theme_styles_t;
} theme_styles_t;
/**********************
* STATIC PROTOTYPES
@ -546,21 +545,24 @@ static void calendar_init(void)
lv_style_set_text_color(&styles->calendar_header, LV_STATE_PRESSED, IS_LIGHT ? lv_color_hex(0x888888) : LV_COLOR_WHITE);
style_init_reset(&styles->calendar_daynames);
lv_style_set_text_color(&styles->calendar_daynames, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
lv_style_set_text_color(&styles->calendar_daynames, LV_STATE_DEFAULT,
IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
lv_style_set_pad_left(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_right(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
lv_style_set_pad_bottom(&styles->calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
style_init_reset(&styles->calendar_date_nums);
lv_style_set_radius(&styles->calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_CHECKED,
IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20);
lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER);
lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT,
IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE);
lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
lv_style_set_border_width(&styles->calendar_date_nums, LV_STATE_CHECKED, 2);
lv_style_set_border_side(&styles->calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
@ -684,7 +686,8 @@ static void textarea_init(void)
lv_style_set_border_side(&styles->ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT);
style_init_reset(&styles->ta_placeholder);
lv_style_set_text_color(&styles->ta_placeholder, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd));
lv_style_set_text_color(&styles->ta_placeholder, LV_STATE_DEFAULT,
IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd));
#endif
}

View File

@ -24,21 +24,20 @@
* TYPEDEFS
**********************/
typedef struct
{
lv_style_t scr;
lv_style_t bg;
lv_style_t clip_corner;
lv_style_t btn;
lv_style_t round;
lv_style_t no_radius;
lv_style_t fg_color;
lv_style_t border_none;
lv_style_t big_line_space; /*In roller or dropdownlist*/
lv_style_t pad_none;
lv_style_t pad_normal;
lv_style_t pad_small;
lv_style_t pad_inner;
typedef struct {
lv_style_t scr;
lv_style_t bg;
lv_style_t clip_corner;
lv_style_t btn;
lv_style_t round;
lv_style_t no_radius;
lv_style_t fg_color;
lv_style_t border_none;
lv_style_t big_line_space; /*In roller or dropdownlist*/
lv_style_t pad_none;
lv_style_t pad_normal;
lv_style_t pad_small;
lv_style_t pad_inner;
#if LV_USE_ARC
lv_style_t arc_bg, arc_indic;
@ -79,7 +78,7 @@ lv_style_t pad_inner;
#if LV_USE_TABVIEW
lv_style_t tab_bg;
#endif
}theme_styles_t;
} theme_styles_t;
/**********************
* STATIC PROTOTYPES

View File

@ -80,7 +80,8 @@ static void basic_init(void)
style_init_reset(&styles->btn);
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_30));
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
LV_OPA_30));
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);

View File

@ -202,7 +202,8 @@ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
if(obj_state & LV_STATE_CHECKED) {
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
else return LV_BTN_STATE_CHECKED_RELEASED;
} else {
}
else {
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
else return LV_BTN_STATE_RELEASED;
}

View File

@ -587,7 +587,8 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
if(zoom_final != LV_IMG_ZOOM_NONE) {
if(_lv_area_is_in(clip_area, &img->coords, 0) == false) return LV_DESIGN_RES_NOT_COVER;
} else {
}
else {
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, lv_obj_get_width(img), lv_obj_get_height(img), 0, zoom_final, &ext->pivot);
a.x1 += img->coords.x1;

View File

@ -785,7 +785,8 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
uint32_t cid = _lv_txt_encoded_get_char_id(bidi_txt, i);
if(txt[line_start + cid] == '\0') {
logical_pos = i;
} else {
}
else {
bool is_rtl;
logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL,
txt_len, lv_obj_get_base_dir(label), cid, &is_rtl);