refactor(rename): LV_IMG_ZOOM_NONE to LV_ZOOM_NONE (#3957)

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
Carlos Diaz
2023-02-04 10:20:42 -06:00
committed by GitHub
parent aaa1b3880e
commit 76547db1d7
27 changed files with 57 additions and 56 deletions

View File

@@ -278,7 +278,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, album_img_obj); lv_anim_set_var(&a, album_img_obj);
lv_anim_set_time(&a, 1000); lv_anim_set_time(&a, 1000);
lv_anim_set_delay(&a, INTRO_TIME + 1000); lv_anim_set_delay(&a, INTRO_TIME + 1000);
lv_anim_set_values(&a, 1, LV_IMG_ZOOM_NONE); lv_anim_set_values(&a, 1, LV_ZOOM_NONE);
lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -302,7 +302,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, logo); lv_anim_set_var(&a, logo);
lv_anim_set_time(&a, 400); lv_anim_set_time(&a, 400);
lv_anim_set_delay(&a, INTRO_TIME + 800); lv_anim_set_delay(&a, INTRO_TIME + 800);
lv_anim_set_values(&a, LV_IMG_ZOOM_NONE, 10); lv_anim_set_values(&a, LV_ZOOM_NONE, 10);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb); lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_start(&a); lv_anim_start(&a);
@@ -370,7 +370,7 @@ void _lv_demo_music_pause(void)
spectrum_i = 0; spectrum_i = 0;
lv_anim_del(spectrum_obj, spectrum_anim_cb); lv_anim_del(spectrum_obj, spectrum_anim_cb);
lv_obj_invalidate(spectrum_obj); lv_obj_invalidate(spectrum_obj);
lv_img_set_zoom(album_img_obj, LV_IMG_ZOOM_NONE); lv_img_set_zoom(album_img_obj, LV_ZOOM_NONE);
lv_timer_pause(sec_counter_timer); lv_timer_pause(sec_counter_timer);
lv_obj_clear_state(play_obj, LV_STATE_CHECKED); lv_obj_clear_state(play_obj, LV_STATE_CHECKED);
} }
@@ -721,7 +721,7 @@ static void track_load(uint32_t id)
lv_anim_set_path_cb(&a, lv_anim_path_linear); lv_anim_set_path_cb(&a, lv_anim_path_linear);
lv_anim_set_var(&a, album_img_obj); lv_anim_set_var(&a, album_img_obj);
lv_anim_set_time(&a, 500); lv_anim_set_time(&a, 500);
lv_anim_set_values(&a, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE / 2); lv_anim_set_values(&a, LV_ZOOM_NONE, LV_ZOOM_NONE / 2);
lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -732,7 +732,7 @@ static void track_load(uint32_t id)
lv_anim_set_var(&a, album_img_obj); lv_anim_set_var(&a, album_img_obj);
lv_anim_set_time(&a, 500); lv_anim_set_time(&a, 500);
lv_anim_set_delay(&a, 100); lv_anim_set_delay(&a, 100);
lv_anim_set_values(&a, LV_IMG_ZOOM_NONE / 4, LV_IMG_ZOOM_NONE); lv_anim_set_values(&a, LV_ZOOM_NONE / 4, LV_ZOOM_NONE);
lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _img_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -915,7 +915,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
} }
if(spectrum[spectrum_i][0] < 4) bar_rot += dir; if(spectrum[spectrum_i][0] < 4) bar_rot += dir;
lv_img_set_zoom(album_img_obj, LV_IMG_ZOOM_NONE + spectrum[spectrum_i][0]); lv_img_set_zoom(album_img_obj, LV_ZOOM_NONE + spectrum[spectrum_i][0]);
} }
static void start_anim_cb(void * a, int32_t v) static void start_anim_cb(void * a, int32_t v)

View File

@@ -121,7 +121,7 @@ Move the object with this value in Y direction. Applied after layouts, aligns an
</ul> </ul>
### transform_zoom ### transform_zoom
Zoom an objects. The value 256 (or `LV_IMG_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -217,7 +217,7 @@ Sets the padding between the columns. Used by the layouts.
Properties to describe spacing around an object. Very similar to the margin properties in HTML. Properties to describe spacing around an object. Very similar to the margin properties in HTML.
### margin_top ### margin_top
Sets the margin on the top. It makes the object area bigger in this direction. Sets the margin on the top. The object will keep this space from its siblings in layouts.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -226,7 +226,7 @@ Sets the margin on the top. It makes the object area bigger in this direction.
</ul> </ul>
### margin_bottom ### margin_bottom
Sets the margin on the bottom. It makes the object area bigger in this direction. Sets the margin on the bottom. The object will keep this space from its siblings in layouts.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -235,7 +235,7 @@ Sets the margin on the bottom. It makes the object area bigger in this direction
</ul> </ul>
### margin_left ### margin_left
Sets the margin on the left. It makes the object area bigger in this direction. Sets the margin on the left. The object will keep this space from its siblings in layouts.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -244,7 +244,7 @@ Sets the margin on the left. It makes the object area bigger in this direction.
</ul> </ul>
### margin_right ### margin_right
Sets the margin on the right. It makes the object area bigger in this direction. Sets the margin on the right. The object will keep this space from its siblings in layouts.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>

View File

@@ -71,7 +71,7 @@ Using the offset parameter a [Texture atlas](https://en.wikipedia.org/wiki/Textu
## Transformations ## Transformations
Using the `lv_img_set_zoom(img, factor)` the images will be zoomed. Set `factor` to `256` or `LV_IMG_ZOOM_NONE` to disable zooming. Using the `lv_img_set_zoom(img, factor)` the images will be zoomed. Set `factor` to `256` or `LV_ZOOM_NONE` to disable zooming.
A larger value enlarges the images (e.g. `512` double size), a smaller value shrinks it (e.g. `128` half size). A larger value enlarges the images (e.g. `512` double size), a smaller value shrinks it (e.g. `128` half size).
Fractional scale works as well. E.g. `281` for 10% enlargement. Fractional scale works as well. E.g. `281` for 10% enlargement.

View File

@@ -47,7 +47,7 @@ void lv_example_canvas_1(void)
img.header.h = CANVAS_HEIGHT; img.header.h = CANVAS_HEIGHT;
lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER); lv_canvas_fill_bg(canvas, lv_palette_lighten(LV_PALETTE_GREY, 3), LV_OPA_COVER);
lv_canvas_transform(canvas, &img, 120, LV_IMG_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true); lv_canvas_transform(canvas, &img, 120, LV_ZOOM_NONE, 0, 0, CANVAS_WIDTH / 2, CANVAS_HEIGHT / 2, true);
} }
#endif #endif

View File

@@ -1,6 +1,6 @@
_CANVAS_WIDTH = 200 _CANVAS_WIDTH = 200
_CANVAS_HEIGHT = 150 _CANVAS_HEIGHT = 150
LV_IMG_ZOOM_NONE = 256 LV_ZOOM_NONE = 256
rect_dsc = lv.draw_rect_dsc_t() rect_dsc = lv.draw_rect_dsc_t()
rect_dsc.init() rect_dsc.init()
@@ -40,4 +40,4 @@ img.header.w = _CANVAS_WIDTH
img.header.h = _CANVAS_HEIGHT img.header.h = _CANVAS_HEIGHT
canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER) canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
canvas.transform(img, 30, LV_IMG_ZOOM_NONE, 0, 0, _CANVAS_WIDTH // 2, _CANVAS_HEIGHT // 2, True) canvas.transform(img, 30, LV_ZOOM_NONE, 0, 0, _CANVAS_WIDTH // 2, _CANVAS_HEIGHT // 2, True)

View File

@@ -84,13 +84,13 @@ void lv_example_chart_5(void)
lv_obj_t * slider; lv_obj_t * slider;
slider = lv_slider_create(lv_scr_act()); slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10);
lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event_cb(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 200, 10); lv_obj_set_size(slider, 200, 10);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
slider = lv_slider_create(lv_scr_act()); slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_IMG_ZOOM_NONE, LV_IMG_ZOOM_NONE * 10); lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10);
lv_obj_add_event_cb(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event_cb(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 10, 150); lv_obj_set_size(slider, 10, 150);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0);

View File

@@ -76,13 +76,13 @@ chart.set_point_count(pcnt)
chart.set_ext_y_array(ser, ecg_sample) chart.set_ext_y_array(ser, ecg_sample)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10) slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10)
slider.add_event_cb(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event_cb(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(200,10) slider.set_size(200,10)
slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20) slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.IMG_ZOOM_NONE, lv.IMG_ZOOM_NONE * 10) slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10)
slider.add_event_cb(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event_cb(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(10, 150) slider.set_size(10, 150)
slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0) slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0)

View File

@@ -60,7 +60,7 @@ props = [
{'name': 'TRANSFORM_ZOOM', {'name': 'TRANSFORM_ZOOM',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1, 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Zoom an objects. The value 256 (or `LV_IMG_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on" }, 'dsc': "Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on" },
{'name': 'TRANSFORM_ANGLE', {'name': 'TRANSFORM_ANGLE',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1, 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,

View File

@@ -1003,7 +1003,7 @@ static void indev_proc_release(_lv_indev_proc_t * proc)
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) { if(angle != 0 || zoom != LV_ZOOM_NONE) {
angle = -angle; angle = -angle;
zoom = (256 * 256) / zoom; zoom = (256 * 256) / zoom;
lv_point_transform(&proc->types.pointer.scroll_throw_vect, angle, zoom, &pivot); lv_point_transform(&proc->types.pointer.scroll_throw_vect, angle, zoom, &pivot);

View File

@@ -71,7 +71,7 @@ void _lv_indev_scroll_handler(_lv_indev_proc_t * proc)
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) { if(angle != 0 || zoom != LV_ZOOM_NONE) {
angle = -angle; angle = -angle;
zoom = (256 * 256) / zoom; zoom = (256 * 256) / zoom;
lv_point_t pivot = { 0, 0 }; lv_point_t pivot = { 0, 0 };
@@ -299,7 +299,7 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
} }
lv_point_t obj_scroll_sum = proc->types.pointer.scroll_sum; lv_point_t obj_scroll_sum = proc->types.pointer.scroll_sum;
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) { if(angle != 0 || zoom != LV_ZOOM_NONE) {
angle = -angle; angle = -angle;
zoom = (256 * 256) / zoom; zoom = (256 * 256) / zoom;
lv_point_transform(&obj_scroll_sum, angle, zoom, &pivot); lv_point_transform(&obj_scroll_sum, angle, zoom, &pivot);

View File

@@ -240,7 +240,7 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t *
} }
draw_dsc->angle = 0; draw_dsc->angle = 0;
draw_dsc->zoom = LV_IMG_ZOOM_NONE; draw_dsc->zoom = LV_ZOOM_NONE;
draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2; draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2;
draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2; draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;

View File

@@ -1143,7 +1143,7 @@ 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 angle = lv_obj_get_style_transform_angle(obj, 0);
int16_t zoom = lv_obj_get_style_transform_zoom(obj, 0); int16_t zoom = lv_obj_get_style_transform_zoom(obj, 0);
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) return; if(angle == 0 && zoom == LV_ZOOM_NONE) return;
lv_point_t pivot = { lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0), .x = lv_obj_get_style_transform_pivot_x(obj, 0),

View File

@@ -898,7 +898,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
const uint8_t * src_buf_org = src_buf; const uint8_t * src_buf_org = src_buf;
bool mask_any = lv_draw_mask_is_any(&draw_area); bool mask_any = lv_draw_mask_is_any(&draw_area);
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false; bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_ZOOM_NONE ? true : false;
lv_area_t blend_area; lv_area_t blend_area;
lv_draw_sw_blend_dsc_t blend_dsc; lv_draw_sw_blend_dsc_t blend_dsc;
@@ -986,7 +986,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
blend_area.y2 = blend_area.y1 + buf_h - 1; blend_area.y2 = blend_area.y1 + buf_h - 1;
lv_draw_mask_res_t mask_res_def = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle || lv_draw_mask_res_t mask_res_def = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle ||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? draw_dsc->zoom != LV_ZOOM_NONE) ?
LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER; LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
blend_dsc.mask_res = mask_res_def; blend_dsc.mask_res = mask_res_def;

View File

@@ -48,7 +48,7 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
lv_memzero(dsc, sizeof(lv_draw_img_dsc_t)); lv_memzero(dsc, sizeof(lv_draw_img_dsc_t));
dsc->recolor = lv_color_black(); dsc->recolor = lv_color_black();
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->zoom = LV_IMG_ZOOM_NONE; dsc->zoom = LV_ZOOM_NONE;
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
} }
@@ -246,7 +246,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
else if(cdsc->dec_dsc.img_data) { else if(cdsc->dec_dsc.img_data) {
lv_area_t map_area_rot; lv_area_t map_area_rot;
lv_area_copy(&map_area_rot, coords); lv_area_copy(&map_area_rot, coords);
if(draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) { if(draw_dsc->angle || draw_dsc->zoom != LV_ZOOM_NONE) {
int32_t w = lv_area_get_width(coords); int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords); int32_t h = lv_area_get_height(coords);

View File

@@ -424,7 +424,7 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
const lv_point_t * pivot) const lv_point_t * pivot)
{ {
#if LV_USE_DRAW_MASKS #if LV_USE_DRAW_MASKS
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) { if(angle == 0 && zoom == LV_ZOOM_NONE) {
res->x1 = 0; res->x1 = 0;
res->y1 = 0; res->y1 = 0;
res->x2 = w - 1; res->x2 = w - 1;

View File

@@ -190,7 +190,7 @@ static void lv_draw_pxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_
lv_coord_t src_height = lv_area_get_height(coords); lv_coord_t src_height = lv_area_get_height(coords);
bool has_mask = lv_draw_mask_is_any(&blend_area); bool has_mask = lv_draw_mask_is_any(&blend_area);
bool has_scale = (dsc->zoom != LV_IMG_ZOOM_NONE); bool has_scale = (dsc->zoom != LV_ZOOM_NONE);
bool has_rotation = (dsc->angle != 0); bool has_rotation = (dsc->angle != 0);
bool unsup_rotation = false; bool unsup_rotation = false;

View File

@@ -543,7 +543,7 @@ static inline void lv_vglite_set_transformation_matrix(const lv_area_t * dest_ar
{ {
lv_vglite_set_translation_matrix(dest_area); lv_vglite_set_translation_matrix(dest_area);
bool has_scale = (dsc->zoom != LV_IMG_ZOOM_NONE); bool has_scale = (dsc->zoom != LV_ZOOM_NONE);
bool has_rotation = (dsc->angle != 0); bool has_rotation = (dsc->angle != 0);
if(has_scale || has_rotation) { if(has_scale || has_rotation) {
@@ -551,7 +551,7 @@ static inline void lv_vglite_set_transformation_matrix(const lv_area_t * dest_ar
if(has_rotation) if(has_rotation)
vg_lite_rotate(dsc->angle / 10.0f, &vgmatrix); /* angle is 1/10 degree */ vg_lite_rotate(dsc->angle / 10.0f, &vgmatrix); /* angle is 1/10 degree */
if(has_scale) { if(has_scale) {
vg_lite_float_t scale = 1.0f * dsc->zoom / LV_IMG_ZOOM_NONE; vg_lite_float_t scale = 1.0f * dsc->zoom / LV_ZOOM_NONE;
vg_lite_scale(scale, scale, &vgmatrix); vg_lite_scale(scale, scale, &vgmatrix);
} }
vg_lite_translate(0.0f - dsc->pivot.x, 0.0f - dsc->pivot.y, &vgmatrix); vg_lite_translate(0.0f - dsc->pivot.x, 0.0f - dsc->pivot.y, &vgmatrix);

View File

@@ -94,7 +94,7 @@ void lv_color_to_sdl_color(const lv_color_t * in, SDL_Color * out)
void lv_area_zoom_to_sdl_rect(const lv_area_t * in, SDL_Rect * out, uint16_t zoom, const lv_point_t * pivot) void lv_area_zoom_to_sdl_rect(const lv_area_t * in, SDL_Rect * out, uint16_t zoom, const lv_point_t * pivot)
{ {
if(zoom == LV_IMG_ZOOM_NONE) { if(zoom == LV_ZOOM_NONE) {
lv_area_to_sdl_rect(in, out); lv_area_to_sdl_rect(in, out);
return; return;
} }

View File

@@ -52,7 +52,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img_decoded(struct _lv_draw_ctx_t * draw_c
lv_area_copy(&draw_area, draw_ctx->clip_area); lv_area_copy(&draw_area, draw_ctx->clip_area);
bool mask_any = lv_draw_mask_is_any(&draw_area); bool mask_any = lv_draw_mask_is_any(&draw_area);
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false; bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_ZOOM_NONE ? true : false;
lv_area_t blend_area; lv_area_t blend_area;
lv_draw_sw_blend_dsc_t blend_dsc; lv_draw_sw_blend_dsc_t blend_dsc;
@@ -138,7 +138,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img_decoded(struct _lv_draw_ctx_t * draw_c
blend_area.y2 = blend_area.y1 + buf_h - 1; blend_area.y2 = blend_area.y1 + buf_h - 1;
lv_draw_mask_res_t mask_res_def = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle || lv_draw_mask_res_t mask_res_def = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle ||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? draw_dsc->zoom != LV_ZOOM_NONE) ?
LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER; LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
blend_dsc.mask_res = mask_res_def; blend_dsc.mask_res = mask_res_def;

View File

@@ -198,7 +198,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_draw_ctx_t * draw_ctx, c
lv_draw_img_dsc_t img_dsc; lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc); lv_draw_img_dsc_init(&img_dsc);
img_dsc.angle = 0; img_dsc.angle = 0;
img_dsc.zoom = LV_IMG_ZOOM_NONE; img_dsc.zoom = LV_ZOOM_NONE;
img_dsc.opa = dsc->opa; img_dsc.opa = dsc->opa;
img_dsc.blend_mode = dsc->blend_mode; img_dsc.blend_mode = dsc->blend_mode;
lv_draw_img(draw_ctx, &img_dsc, &fill_area, map_p); lv_draw_img(draw_ctx, &img_dsc, &fill_area, map_p);

View File

@@ -558,7 +558,7 @@ static void a8_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_co
static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout, static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout,
int32_t * yout) int32_t * yout)
{ {
if(t->angle == 0 && t->zoom == LV_IMG_ZOOM_NONE) { if(t->angle == 0 && t->zoom == LV_ZOOM_NONE) {
*xout = xin * 256; *xout = xin * 256;
*yout = yin * 256; *yout = yin * 256;
return; return;
@@ -571,7 +571,7 @@ static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int
*xout = ((int32_t)(xin * t->zoom)) + (t->pivot_x_256); *xout = ((int32_t)(xin * t->zoom)) + (t->pivot_x_256);
*yout = ((int32_t)(yin * t->zoom)) + (t->pivot_y_256); *yout = ((int32_t)(yin * t->zoom)) + (t->pivot_y_256);
} }
else if(t->zoom == LV_IMG_ZOOM_NONE) { else if(t->zoom == LV_ZOOM_NONE) {
*xout = ((t->cosma * xin - t->sinma * yin) >> 2) + (t->pivot_x_256); *xout = ((t->cosma * xin - t->sinma * yin) >> 2) + (t->pivot_x_256);
*yout = ((t->sinma * xin + t->cosma * yin) >> 2) + (t->pivot_y_256); *yout = ((t->sinma * xin + t->cosma * yin) >> 2) + (t->pivot_y_256);
} }

View File

@@ -23,6 +23,7 @@ extern "C" {
#define LV_INDEV_STATE_REL LV_INDEV_STATE_RELEASED #define LV_INDEV_STATE_REL LV_INDEV_STATE_RELEASED
#define LV_INDEV_STATE_PR LV_INDEV_STATE_PRESSED #define LV_INDEV_STATE_PR LV_INDEV_STATE_PRESSED
#define LV_OBJ_FLAG_SNAPABLE LV_OBJ_FLAG_SNAPPABLE /*Fixed typo*/ #define LV_OBJ_FLAG_SNAPABLE LV_OBJ_FLAG_SNAPPABLE /*Fixed typo*/
#define LV_IMG_ZOOM_NONE LV_ZOOM_NONE
/********************** /**********************
* TYPEDEFS * TYPEDEFS

View File

@@ -320,7 +320,7 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop)
lv_style_value_t value = {0}; lv_style_value_t value = {0};
switch(prop) { switch(prop) {
case LV_STYLE_TRANSFORM_ZOOM: case LV_STYLE_TRANSFORM_ZOOM:
value.num = LV_IMG_ZOOM_NONE; value.num = LV_ZOOM_NONE;
break; break;
case LV_STYLE_BG_COLOR: case LV_STYLE_BG_COLOR:
value.color = lv_color_white(); value.color = lv_color_white();

View File

@@ -46,8 +46,8 @@ extern "C" {
/** /**
* Other constants * Other constants
*/ */
#define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/ #define LV_ZOOM_NONE 256 /*Value for not zooming the image*/
LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE); LV_EXPORT_CONST_INT(LV_ZOOM_NONE);
// *INDENT-OFF* // *INDENT-OFF*
#if LV_USE_ASSERT_STYLE #if LV_USE_ASSERT_STYLE

View File

@@ -666,8 +666,8 @@ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
chart->pressed_point_id = LV_CHART_POINT_NONE; chart->pressed_point_id = LV_CHART_POINT_NONE;
chart->type = LV_CHART_TYPE_LINE; chart->type = LV_CHART_TYPE_LINE;
chart->update_mode = LV_CHART_UPDATE_MODE_SHIFT; chart->update_mode = LV_CHART_UPDATE_MODE_SHIFT;
chart->zoom_x = LV_IMG_ZOOM_NONE; chart->zoom_x = LV_ZOOM_NONE;
chart->zoom_y = LV_IMG_ZOOM_NONE; chart->zoom_y = LV_ZOOM_NONE;
LV_TRACE_OBJ_CREATE("finished"); LV_TRACE_OBJ_CREATE("finished");
} }

View File

@@ -155,7 +155,7 @@ void lv_img_set_src(lv_obj_t * obj, const void * src)
lv_obj_refresh_self_size(obj); lv_obj_refresh_self_size(obj);
/*Provide enough room for the rotated corners*/ /*Provide enough room for the rotated corners*/
if(img->angle || img->zoom != LV_IMG_ZOOM_NONE) lv_obj_refresh_ext_draw_size(obj); if(img->angle || img->zoom != LV_ZOOM_NONE) lv_obj_refresh_ext_draw_size(obj);
lv_obj_invalidate(obj); lv_obj_invalidate(obj);
} }
@@ -399,7 +399,7 @@ static void lv_img_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
img->w = lv_obj_get_width(obj); img->w = lv_obj_get_width(obj);
img->h = lv_obj_get_height(obj); img->h = lv_obj_get_height(obj);
img->angle = 0; img->angle = 0;
img->zoom = LV_IMG_ZOOM_NONE; img->zoom = LV_ZOOM_NONE;
img->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; img->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
img->offset.x = 0; img->offset.x = 0;
img->offset.y = 0; img->offset.y = 0;
@@ -469,7 +469,7 @@ static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_coord_t * s = lv_event_get_param(e); lv_coord_t * s = lv_event_get_param(e);
/*If the image has angle provide enough room for the rotated corners*/ /*If the image has angle provide enough room for the rotated corners*/
if(img->angle || img->zoom != LV_IMG_ZOOM_NONE) { if(img->angle || img->zoom != LV_ZOOM_NONE) {
lv_area_t a; lv_area_t a;
lv_coord_t w = lv_obj_get_width(obj); lv_coord_t w = lv_obj_get_width(obj);
lv_coord_t h = lv_obj_get_height(obj); lv_coord_t h = lv_obj_get_height(obj);
@@ -486,7 +486,7 @@ static void lv_img_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*If the object is exactly image sized (not cropped, not mosaic) and transformed /*If the object is exactly image sized (not cropped, not mosaic) and transformed
*perform hit test on its transformed area*/ *perform hit test on its transformed area*/
if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) && if(img->w == lv_obj_get_width(obj) && img->h == lv_obj_get_height(obj) &&
(img->zoom != LV_IMG_ZOOM_NONE || img->angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { (img->zoom != LV_ZOOM_NONE || img->angle != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) {
lv_coord_t w = lv_obj_get_width(obj); lv_coord_t w = lv_obj_get_width(obj);
lv_coord_t h = lv_obj_get_height(obj); lv_coord_t h = lv_obj_get_height(obj);
@@ -551,7 +551,7 @@ static void draw_img(lv_event_t * e)
} }
const lv_area_t * clip_area = lv_event_get_param(e); const lv_area_t * clip_area = lv_event_get_param(e);
if(img->zoom == LV_IMG_ZOOM_NONE) { if(img->zoom == LV_ZOOM_NONE) {
if(_lv_area_is_in(clip_area, &obj->coords, 0) == false) { if(_lv_area_is_in(clip_area, &obj->coords, 0) == false) {
info->res = LV_COVER_RES_NOT_COVER; info->res = LV_COVER_RES_NOT_COVER;
return; return;

View File

@@ -671,7 +671,7 @@ static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value
scale_center.x -= indic->type_data.needle_img.pivot.x; scale_center.x -= indic->type_data.needle_img.pivot.x;
scale_center.y -= indic->type_data.needle_img.pivot.y; scale_center.y -= indic->type_data.needle_img.pivot.y;
lv_area_t a; lv_area_t a;
_lv_img_buf_get_transformed_area(&a, info.w, info.h, angle, LV_IMG_ZOOM_NONE, &indic->type_data.needle_img.pivot); _lv_img_buf_get_transformed_area(&a, info.w, info.h, angle, LV_ZOOM_NONE, &indic->type_data.needle_img.pivot);
a.x1 += scale_center.x - 2; a.x1 += scale_center.x - 2;
a.y1 += scale_center.y - 2; a.y1 += scale_center.y - 2;
a.x2 += scale_center.x + 2; a.x2 += scale_center.x + 2;