1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

chore(array): use array_front and use it like an array (#5448)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu 2024-01-24 20:55:04 +08:00 committed by GitHub
parent 326afb3f76
commit 6fa79e945f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 15 deletions

View File

@ -206,9 +206,10 @@ void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point)
void lv_matrix_transform_path(const lv_matrix_t * matrix, lv_vector_path_t * path)
{
for(uint32_t i = 0; i < path->points.size; i++) {
lv_fpoint_t * pt = lv_array_at(&path->points, i);
lv_matrix_transform_point(matrix, pt);
lv_fpoint_t * pt = lv_array_front(&path->points);
uint32_t size = lv_array_size(&path->points);
for(uint32_t i = 0; i < size; i++) {
lv_matrix_transform_point(matrix, &pt[i]);
}
}
@ -315,7 +316,7 @@ void lv_vector_path_close(lv_vector_path_t * path)
void lv_vector_path_get_bounding(const lv_vector_path_t * path, lv_area_t * area)
{
uint32_t len = lv_array_size(&path->points);
lv_fpoint_t * p = lv_array_at(&path->points, 0);
lv_fpoint_t * p = lv_array_front(&path->points);
float x1 = p[0].x;
float x2 = p[0].x;
float y1 = p[0].y;

View File

@ -86,9 +86,10 @@ static void _set_paint_matrix(Tvg_Paint * obj, const Tvg_Matrix * m)
static void _set_paint_shape(Tvg_Paint * obj, const lv_vector_path_t * p)
{
uint32_t pidx = 0;
for(uint32_t i = 0; i < p->ops.size; i++) {
lv_vector_path_op_t * op = lv_array_at(&p->ops, i);
switch(*op) {
lv_vector_path_op_t * op = lv_array_front(&p->ops);
uint32_t size = lv_array_size(&p->ops);
for(uint32_t i = 0; i < size; i++) {
switch(op[i]) {
case LV_VECTOR_PATH_OP_MOVE_TO: {
lv_fpoint_t * pt = lv_array_at(&p->points, pidx);
tvg_shape_move_to(obj, pt->x, pt->y);
@ -243,7 +244,7 @@ static void _set_paint_stroke(Tvg_Paint * obj, const lv_vector_stroke_dsc_t * ds
tvg_shape_set_stroke_join(obj, _lv_stroke_join_to_tvg(dsc->join));
if(!lv_array_is_empty(&dsc->dash_pattern)) {
float * dash_array = lv_array_at(&dsc->dash_pattern, 0);
float * dash_array = lv_array_front(&dsc->dash_pattern);
tvg_shape_set_stroke_dash(obj, dash_array, dsc->dash_pattern.size);
}
}

View File

@ -249,9 +249,10 @@ static void lv_path_to_vg(lv_vg_lite_path_t * dest, const lv_vector_path_t * src
} while(0)
uint32_t pidx = 0;
for(uint32_t i = 0; i < src->ops.size; i++) {
lv_vector_path_op_t * op = lv_array_at(&src->ops, i);
switch(*op) {
lv_vector_path_op_t * op = lv_array_front(&src->ops);
uint32_t size = lv_array_size(&src->ops);
for(uint32_t i = 0; i < size; i++) {
switch(op[i]) {
case LV_VECTOR_PATH_OP_MOVE_TO: {
const lv_fpoint_t * pt = lv_array_at(&src->points, pidx);
CMP_BOUNDS(pt);

View File

@ -609,9 +609,9 @@ void lv_vg_lite_clear_image_decoder_dsc(lv_draw_unit_t * draw_unit)
}
/* Close all pending image decoder dsc */
lv_image_decoder_dsc_t * img_dsc = lv_array_front(arr);
for(uint32_t i = 0; i < size; i++) {
lv_image_decoder_dsc_t * img_dsc = lv_array_at(arr, i);
lv_image_decoder_close(img_dsc);
lv_image_decoder_close(&img_dsc[i]);
}
lv_array_clear(arr);
}

View File

@ -65,8 +65,9 @@ lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preproces
if(list == NULL) return LV_RESULT_OK;
uint32_t i = 0;
lv_event_dsc_t * dsc = lv_array_at(list, 0);
for(i = 0; i < lv_array_size(list); i++) {
lv_event_dsc_t * dsc = lv_array_front(list);
uint32_t size = lv_array_size(list);
for(i = 0; i < size; i++) {
if(dsc[i].cb == NULL) continue;
bool is_preprocessed = (dsc[i].filter & LV_EVENT_PREPROCESS) != 0;
if(is_preprocessed != preprocess) continue;