Skip to content

Commit

Permalink
chore(format): run code-format.sh (lvgl#2822)
Browse files Browse the repository at this point in the history
* fix(format): run code-format.sh

Signed-off-by: Xiang Xiao <[email protected]>

* fix(astyle): add the 3rd party source file to exclude list

Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 authored Nov 22, 2021
1 parent 77287ca commit 3a0069a
Show file tree
Hide file tree
Showing 49 changed files with 602 additions and 547 deletions.
2 changes: 1 addition & 1 deletion scripts/built_in_font/generate_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 16 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_16.c --force-fast-kern-format")

os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_*.c')
os.system('astyle --options=../code-format.cfg "lv_font_*.c"')
os.system('astyle --ignore-exclude-errors --options=../code-format.cfg "lv_font_*.c"')
os.system('mv lv_font_*.c ../../src/font/')
9 changes: 9 additions & 0 deletions scripts/code-format.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@
--suffix=none
--preserve-date
--formatted
--exclude=../src/extra/libs/gif/gifdec.c
--exclude=../src/extra/libs/gif/gifdec.h
--exclude=../src/extra/libs/png/lodepng.c
--exclude=../src/extra/libs/png/lodepng.h
--exclude=../src/extra/libs/qrcode/qrcodegen.c
--exclude=../src/extra/libs/qrcode/qrcodegen.h
--exclude=../src/extra/libs/sjpg/tjpgd.c
--exclude=../src/extra/libs/sjpg/tjpgd.h
--exclude=../src/extra/libs/sjpg/tjpgdcnf.h
9 changes: 4 additions & 5 deletions src/core/lv_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,10 @@ static lv_res_t event_send_core(lv_event_t * e)
event_dsc = lv_obj_get_event_dsc(e->current_target, i);
}

if(res == LV_RES_OK && e->current_target->parent && event_is_bubbled(e))
{
e->current_target = e->current_target->parent;
res = event_send_core(e);
if(res != LV_RES_OK) return LV_RES_INV;
if(res == LV_RES_OK && e->current_target->parent && event_is_bubbled(e)) {
e->current_target = e->current_target->parent;
res = event_send_core(e);
if(res != LV_RES_OK) return LV_RES_INV;

}

Expand Down
3 changes: 1 addition & 2 deletions src/core/lv_indev.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,7 @@ static void indev_click_focus(_lv_indev_proc_t * proc)
{
/*Handle click focus*/
if(lv_obj_has_flag(indev_obj_act, LV_OBJ_FLAG_CLICK_FOCUSABLE) == false ||
proc->types.pointer.last_pressed == indev_obj_act)
{
proc->types.pointer.last_pressed == indev_obj_act) {
return;
}

Expand Down
44 changes: 24 additions & 20 deletions src/core/lv_obj_pos.c
Original file line number Diff line number Diff line change
Expand Up @@ -966,13 +966,14 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
child_res = LV_MAX(child_res, obj->coords.x2 - child->coords.x1 + 1);
break;
default:
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
}
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
}
}
} else {
}
else {
child_res = LV_MAX(child_res, obj->coords.x2 - child->coords.x1 + 1);
}
}
Expand All @@ -997,13 +998,14 @@ static lv_coord_t calc_content_width(lv_obj_t * obj)
child_res = LV_MAX(child_res, child->coords.x2 - obj->coords.x1 + 1);
break;
default:
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
}
/* Consider other cases only if x=0 and use the width of the object.
* With x!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_width(&child->coords));
}
}
} else {
}
else {
child_res = LV_MAX(child_res, child->coords.x2 - obj->coords.x1 + 1);
}
}
Expand Down Expand Up @@ -1047,22 +1049,24 @@ static lv_coord_t calc_content_height(lv_obj_t * obj)
child_res = LV_MAX(child_res, child->coords.y2 - obj->coords.y1 + 1);
break;
default:
/* Consider other cases only if y=0 and use the height of the object.
* With y!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_height(&child->coords));
}
break;
/* Consider other cases only if y=0 and use the height of the object.
* With y!=0 circular dependency could occur. */
if(lv_obj_get_style_y(child, 0) == 0) {
child_res = LV_MAX(child_res, lv_area_get_height(&child->coords));
}
break;
}
} else {
}
else {
child_res = LV_MAX(child_res, child->coords.y2 - obj->coords.y1 + 1);
}
}

if(child_res != LV_COORD_MIN) {
child_res += pad_bottom;
return LV_MAX(child_res, self_h);
} else {
}
else {
return self_h;
}

Expand Down
6 changes: 4 additions & 2 deletions src/core/lv_obj_style_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selec
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA, v, selector);
}

void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
Expand Down Expand Up @@ -680,7 +681,8 @@ void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_styl
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector);
}

void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
Expand Down
9 changes: 6 additions & 3 deletions src/core/lv_obj_style_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32
return (lv_opa_t)v.num;
}

static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj,
uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
return (const lv_color_filter_dsc_t *)v.ptr;
Expand Down Expand Up @@ -613,11 +614,13 @@ void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value,
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
lv_style_selector_t selector);
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
lv_style_selector_t selector);
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
3 changes: 2 additions & 1 deletion src/core/lv_refr.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ static void lv_refr_area_part(const lv_area_t * area_p)
if(top_act_scr == NULL && top_prev_scr == NULL) {
if(disp_refr->bg_fn) {
disp_refr->bg_fn(&start_mask);
} else if(disp_refr->bg_img) {
}
else if(disp_refr->bg_img) {
lv_draw_img_dsc_t dsc;
lv_draw_img_dsc_init(&dsc);
dsc.opa = disp_refr->bg_opa;
Expand Down
2 changes: 1 addition & 1 deletion src/draw/lv_draw_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_are
return;
}

if (g.resolved_font) {
if(g.resolved_font) {
font_p = g.resolved_font;
}
const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter);
Expand Down
8 changes: 4 additions & 4 deletions src/draw/lv_draw_mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
*/
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
lv_coord_t len, const int16_t *ids, int16_t ids_count)
lv_coord_t len, const int16_t * ids, int16_t ids_count)
{
bool changed = false;
_lv_draw_mask_common_dsc_t * dsc;

for (int i = 0; i < ids_count; i++) {
for(int i = 0; i < ids_count; i++) {
int16_t id = ids[i];
if (id == LV_MASK_ID_INV) continue;
if(id == LV_MASK_ID_INV) continue;
dsc = LV_GC_ROOT(_lv_draw_mask_list[id]).param;
if (!dsc) continue;
if(!dsc) continue;
lv_draw_mask_res_t res = LV_DRAW_MASK_RES_FULL_COVER;
res = dsc->cb(mask_buf, abs_x, abs_y, len, dsc);
if(res == LV_DRAW_MASK_RES_TRANSP) return LV_DRAW_MASK_RES_TRANSP;
Expand Down
2 changes: 1 addition & 1 deletion src/draw/lv_draw_mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
*/
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
lv_coord_t len, const int16_t *ids, int16_t ids_count);
lv_coord_t len, const int16_t * ids, int16_t ids_count);

//! @endcond

Expand Down
10 changes: 5 additions & 5 deletions src/extra/libs/bmp/lv_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static lv_res_t decoder_open(lv_img_decoder_t * dec, lv_img_decoder_dsc_t * dsc)


static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc,
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf);
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf);

static void decoder_close(lv_img_decoder_t * dec, lv_img_decoder_dsc_t * dsc);

Expand Down Expand Up @@ -140,7 +140,7 @@ static lv_res_t decoder_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t *
uint8_t header[54];
lv_fs_read(&b.f, header, 54, NULL);

if (0x42 != header[0] || 0x4d != header[1]) {
if(0x42 != header[0] || 0x4d != header[1]) {
return LV_RES_INV;
}

Expand Down Expand Up @@ -169,7 +169,7 @@ static lv_res_t decoder_open(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t *


static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc,
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf)
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf)
{
LV_UNUSED(decoder);

Expand All @@ -188,7 +188,7 @@ static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc
uint8_t b1 = buf[i * 4 + 1];
uint8_t b2 = buf[i * 4 + 2];
uint8_t b3 = buf[i * 4 + 3];
lv_color32_t *c = (lv_color32_t*)&buf[i*4];
lv_color32_t * c = (lv_color32_t *)&buf[i * 4];
c->ch.red = b2;
c->ch.green = b1;
c->ch.blue = b0;
Expand All @@ -200,7 +200,7 @@ static lv_res_t decoder_read_line(lv_img_decoder_t * decoder, lv_img_decoder_dsc

for(i = len - 1; i >= 0; i--) {
uint8_t * t = &buf[i * 3];
lv_color32_t *c = (lv_color32_t*)&buf[i*4];
lv_color32_t * c = (lv_color32_t *)&buf[i * 4];
c->ch.red = t[2];
c->ch.green = t[1];
c->ch.blue = t[0];
Expand Down
2 changes: 1 addition & 1 deletion src/extra/libs/ffmpeg/lv_ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ static int ffmpeg_get_frame_refr_period(struct ffmpeg_context_s * ffmpeg_ctx)
int avg_frame_rate_num = ffmpeg_ctx->video_stream->avg_frame_rate.num;
if(avg_frame_rate_num > 0) {
int period = 1000 * (int64_t)ffmpeg_ctx->video_stream->avg_frame_rate.den
/ avg_frame_rate_num;
/ avg_frame_rate_num;
return period;
}

Expand Down
10 changes: 6 additions & 4 deletions src/extra/libs/freetype/lv_freetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ static FT_Error font_face_requester(FTC_FaceID face_id,

lv_face_info_t * info = (lv_face_info_t *)face_id;
FT_Error error;
if (info->mem) {
if(info->mem) {
error = FT_New_Memory_Face(library, info->mem, info->size, 0, aface);
} else {
}
else {
error = FT_New_Face(library, info->name, 0, aface);
}
if(error) {
Expand Down Expand Up @@ -423,9 +424,10 @@ static bool lv_ft_font_init_nocache(lv_ft_info_t * info)
goto Fail;
}
FT_Error error;
if (info->mem) {
if(info->mem) {
error = FT_New_Memory_Face(library, info->mem, (FT_Long) info->mem_size, 0, &face);
} else {
}
else {
error = FT_New_Face(library, info->name, 0, &face);
}
if(error) {
Expand Down
27 changes: 14 additions & 13 deletions src/extra/libs/fsdrv/lv_fs_fatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
FRESULT res = f_open(f, path, flags);
if(res == FR_OK) {
return f;
} else {
}
else {
lv_mem_free(f);
return NULL;
}
Expand Down Expand Up @@ -178,18 +179,18 @@ static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf,
static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence)
{
LV_UNUSED(drv);
switch (whence) {
case LV_FS_SEEK_SET:
f_lseek(file_p, pos);
break;
case LV_FS_SEEK_CUR:
f_lseek(file_p, f_tell(file_p) + pos);
break;
case LV_FS_SEEK_END:
f_lseek(file_p, f_size(file_p) + pos);
break;
default:
break;
switch(whence) {
case LV_FS_SEEK_SET:
f_lseek(file_p, pos);
break;
case LV_FS_SEEK_CUR:
f_lseek(file_p, f_tell(file_p) + pos);
break;
case LV_FS_SEEK_END:
f_lseek(file_p, f_size(file_p) + pos);
break;
default:
break;
}
return LV_FS_RES_OK;
}
Expand Down
Loading

0 comments on commit 3a0069a

Please sign in to comment.