From b884abae26f3824b27783a85d18ed51e550347c1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 7 Aug 2022 21:09:43 +0200 Subject: [PATCH] =?UTF-8?q?fix(canvas):=20fix=20clip=C3=A9ping=20on=20tran?= =?UTF-8?q?sformation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes: #3545 --- examples/anim/lv_example_anim_3.c | 2 +- src/extra/layouts/flex/lv_flex.h | 6 +++++- src/widgets/lv_canvas.c | 15 ++++++--------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/anim/lv_example_anim_3.c b/examples/anim/lv_example_anim_3.c index 469287881..dedcad99e 100644 --- a/examples/anim/lv_example_anim_3.c +++ b/examples/anim/lv_example_anim_3.c @@ -1,5 +1,5 @@ #include "../lv_examples.h" -#if LV_BUILD_EXAMPLES && LV_USE_SLIDER && LV_USE_CHART && LV_USE_BTN +#if LV_BUILD_EXAMPLES && LV_USE_SLIDER && LV_USE_CHART && LV_USE_BTN && LV_USE_GRID /** * the example show the use of cubic-bezier3 in animation. diff --git a/src/extra/layouts/flex/lv_flex.h b/src/extra/layouts/flex/lv_flex.h index 1499d884f..eaac709d2 100644 --- a/src/extra/layouts/flex/lv_flex.h +++ b/src/extra/layouts/flex/lv_flex.h @@ -139,11 +139,15 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t return (uint8_t)v.num; } - /********************** * MACROS **********************/ +#define LV_STYLE_CONST_FLEX_FLOW(val) \ + { \ + .prop_ptr = &LV_STYLE_FLEX_FLOW, .value = { .num = (lv_flex_flow_t)val } \ + } + #endif /*LV_USE_FLEX*/ #ifdef __cplusplus diff --git a/src/widgets/lv_canvas.c b/src/widgets/lv_canvas.c index 6b37069ab..1f949272e 100644 --- a/src/widgets/lv_canvas.c +++ b/src/widgets/lv_canvas.c @@ -181,10 +181,10 @@ void lv_canvas_transform(lv_obj_t * obj, lv_img_dsc_t * src_img, int16_t angle, draw_dsc.antialias = antialias; lv_area_t dest_area; - dest_area.x1 = 0; - dest_area.x2 = dest_img->header.w - 1; - dest_area.y1 = 0; - dest_area.y2 = 0; + dest_area.x1 = -offset_x; + dest_area.x2 = dest_area.x1 + dest_img->header.w - 1; + dest_area.y1 = -offset_y; + dest_area.y2 = -offset_y; lv_color_t * cbuf = lv_mem_alloc(dest_img->header.w * sizeof(lv_color_t)); lv_opa_t * abuf = lv_mem_alloc(dest_img->header.w * sizeof(lv_opa_t)); @@ -194,15 +194,12 @@ void lv_canvas_transform(lv_obj_t * obj, lv_img_dsc_t * src_img, int16_t angle, &draw_dsc, canvas->dsc.header.cf, cbuf, abuf); for(x = 0; x < dest_img->header.w; x++) { - if(x + offset_x < 0) continue; - if(x + offset_x >= dest_img->header.w) break; if(abuf[x]) { - lv_img_buf_set_px_color(dest_img, x + offset_x, y + offset_y, cbuf[x]); - lv_img_buf_set_px_alpha(dest_img, x + offset_x, y + offset_y, abuf[x]); + lv_img_buf_set_px_color(dest_img, x, y, cbuf[x]); + lv_img_buf_set_px_alpha(dest_img, x, y, abuf[x]); } } - if(y + offset_y >= dest_img->header.h) break; dest_area.y1++; dest_area.y2++; }