From 42d24403c31fed813548ec2738b8567ad59bf902 Mon Sep 17 00:00:00 2001 From: Benign X <1341398182@qq.com> Date: Mon, 29 May 2023 16:18:48 +0800 Subject: [PATCH] chore: change `anlge` and `zoom` to `lv_coord` (#4247) --- src/core/lv_obj_pos.c | 4 ++-- src/draw/lv_draw_img.h | 5 ++--- src/draw/lv_img_buf.c | 2 +- src/draw/lv_img_buf.h | 2 +- src/draw/sw/lv_draw_sw_img.c | 2 +- src/widgets/img/lv_img.c | 12 ++++++------ src/widgets/img/lv_img.h | 8 ++++---- 7 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 9efdc0ab0..d8d1bb015 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -1136,8 +1136,8 @@ static void layout_update_core(lv_obj_t * obj) static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv) { - int16_t angle = lv_obj_get_style_transform_angle(obj, 0); - int16_t zoom = lv_obj_get_style_transform_zoom_safe(obj, 0); + lv_coord_t angle = lv_obj_get_style_transform_angle(obj, 0); + lv_coord_t zoom = lv_obj_get_style_transform_zoom_safe(obj, 0); if(angle == 0 && zoom == LV_ZOOM_NONE) return; diff --git a/src/draw/lv_draw_img.h b/src/draw/lv_draw_img.h index 4776c842e..2effbb6d9 100644 --- a/src/draw/lv_draw_img.h +++ b/src/draw/lv_draw_img.h @@ -38,9 +38,8 @@ typedef struct { } lv_draw_img_sup_t; typedef struct { - - int16_t angle; - uint16_t zoom; + lv_coord_t angle; + lv_coord_t zoom; lv_point_t pivot; lv_color_t chroma_key_color; diff --git a/src/draw/lv_img_buf.c b/src/draw/lv_img_buf.c index 5b9c109c8..e3bc3c524 100644 --- a/src/draw/lv_img_buf.c +++ b/src/draw/lv_img_buf.c @@ -58,7 +58,7 @@ void lv_img_buf_free(lv_img_dsc_t * dsc) } } -void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom, +void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom, const lv_point_t * pivot) { #if LV_USE_DRAW_MASKS diff --git a/src/draw/lv_img_buf.h b/src/draw/lv_img_buf.h index 50e166ddc..ae6f36348 100644 --- a/src/draw/lv_img_buf.h +++ b/src/draw/lv_img_buf.h @@ -113,7 +113,7 @@ void lv_img_buf_free(lv_img_dsc_t * dsc); * @param zoom zoom, (256 no zoom) * @param pivot x,y pivot coordinates of rotation */ -void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom, +void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom, const lv_point_t * pivot); /********************** diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index 0b8ffc0e7..18e0035c8 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -191,7 +191,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img_decoded(struct _lv_draw_ctx_t * draw_c /*Blend*/ lv_draw_sw_blend(draw_ctx, &blend_dsc); - /*Go the the next lines*/ + /*Go to the next lines*/ blend_area.y1 = blend_area.y2 + 1; blend_area.y2 = blend_area.y1 + buf_h - 1; if(blend_area.y2 > y_last) blend_area.y2 = y_last; diff --git a/src/widgets/img/lv_img.c b/src/widgets/img/lv_img.c index 62e370fb4..a60f17c8a 100644 --- a/src/widgets/img/lv_img.c +++ b/src/widgets/img/lv_img.c @@ -327,7 +327,7 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * obj) return img->offset.y; } -uint16_t lv_img_get_angle(lv_obj_t * obj) +lv_coord_t lv_img_get_angle(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -345,7 +345,7 @@ void lv_img_get_pivot(lv_obj_t * obj, lv_point_t * pivot) *pivot = img->pivot; } -uint16_t lv_img_get_zoom(lv_obj_t * obj) +lv_coord_t lv_img_get_zoom(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -386,13 +386,13 @@ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) img->cf = LV_COLOR_FORMAT_UNKNOWN; img->w = lv_obj_get_width(obj); img->h = lv_obj_get_height(obj); - img->angle = 0; - img->zoom = LV_ZOOM_NONE; + img->angle = 0; + img->zoom = LV_ZOOM_NONE; img->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; img->offset.x = 0; img->offset.y = 0; - img->pivot.x = 0; - img->pivot.y = 0; + img->pivot.x = 0; + img->pivot.y = 0; img->obj_size_mode = LV_IMG_SIZE_MODE_VIRTUAL; lv_obj_clear_flag(obj, LV_OBJ_FLAG_CLICKABLE); diff --git a/src/widgets/img/lv_img.h b/src/widgets/img/lv_img.h index 6ea00ab05..737482e52 100644 --- a/src/widgets/img/lv_img.h +++ b/src/widgets/img/lv_img.h @@ -43,9 +43,9 @@ typedef struct { lv_point_t offset; lv_coord_t w; /*Width of the image (Handled by the library)*/ lv_coord_t h; /*Height of the image (Handled by the library)*/ - uint16_t angle; /*rotation angle of the image*/ + lv_coord_t angle; /*rotation angle of the image*/ lv_point_t pivot; /*rotation center of the image*/ - uint16_t zoom; /*256 means no zoom, 512 double size, 128 half size*/ + lv_coord_t zoom; /*256 means no zoom, 512 double size, 128 half size*/ uint8_t src_type : 2; /*See: lv_img_src_t*/ uint8_t cf : 5; /*Color format from `lv_color_format_t`*/ uint8_t antialias : 1; /*Apply anti-aliasing in transformations (rotate, zoom)*/ @@ -192,7 +192,7 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * obj); * @param obj pointer to an image object * @return rotation angle in 0.1 degrees (0..3600) */ -uint16_t lv_img_get_angle(lv_obj_t * obj); +lv_coord_t lv_img_get_angle(lv_obj_t * obj); /** * Get the pivot (rotation center) of the image. @@ -206,7 +206,7 @@ void lv_img_get_pivot(lv_obj_t * obj, lv_point_t * pivot); * @param obj pointer to an image object * @return zoom factor (256: no zoom) */ -uint16_t lv_img_get_zoom(lv_obj_t * obj); +lv_coord_t lv_img_get_zoom(lv_obj_t * obj); /** * Get whether the transformations (rotate, zoom) are anti-aliased or not