From f8b5a38dc9df46a5c02ff9fd58d1112cc41196bb Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 20 Sep 2023 21:21:08 +0200 Subject: [PATCH] ESP32 LVGL library from v8.3.9 to v8.3.10 (no functional change) (#19557) * ESP32 LVGL library from v8.3.9 to v8.3.10 (no functional change) * Update mapping --- CHANGELOG.md | 1 + .../generate/be_lv_c_mapping.h | 5 ++ .../generate/be_lvgl_module.c | 1 + .../generate/be_lvgl_widgets_lib.c | 5 ++ .../lv_binding_berry/mapping/lv_enum.h | 1 + .../lv_binding_berry/mapping/lv_funcs.h | 5 ++ lib/libesp32_lvgl/lvgl/library.json | 2 +- lib/libesp32_lvgl/lvgl/library.properties | 2 +- lib/libesp32_lvgl/lvgl/lvgl.h | 2 +- lib/libesp32_lvgl/lvgl/src/core/lv_obj.c | 7 +- lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c | 85 ++++++++---------- .../lvgl/src/core/lv_obj_style.c | 37 +++++++- .../lvgl/src/core/lv_obj_style.h | 17 +++- .../lvgl/src/core/lv_obj_style_gen.c | 14 ++- .../lvgl/src/core/lv_obj_style_gen.h | 34 +++++-- lib/libesp32_lvgl/lvgl/src/core/lv_refr.c | 90 ++++++++++++++++++- .../src/draw/nxp/vglite/lv_draw_vglite_arc.c | 2 + .../lvgl/src/draw/sdl/lv_draw_sdl_composite.c | 3 +- lib/libesp32_lvgl/lvgl/src/extra/lv_extra.mk | 2 +- .../lvgl/src/extra/widgets/meter/lv_meter.c | 4 +- .../lvgl/src/extra/widgets/span/lv_span.c | 2 +- lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.c | 3 + lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.h | 4 + lib/libesp32_lvgl/lvgl/src/misc/lv_area.c | 72 +++++++++++++++ lib/libesp32_lvgl/lvgl/src/misc/lv_area.h | 9 ++ lib/libesp32_lvgl/lvgl/src/misc/lv_style.c | 4 +- lib/libesp32_lvgl/lvgl/src/misc/lv_style.h | 33 +++---- .../lvgl/src/misc/lv_style_gen.c | 8 ++ .../lvgl/src/misc/lv_style_gen.h | 6 ++ .../lvgl/src/widgets/lv_btnmatrix.c | 1 + .../lvgl/src/widgets/lv_dropdown.c | 4 + 31 files changed, 377 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc8a5995f..ad365fbc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ### Changed - ESP32 Framework (Arduino Core) from v2.0.12 to v2.0.13 +- ESP32 LVGL library from v8.3.9 to v8.3.10 (no functional change) ### Fixed - ESP32 DS18x20 driver support extended over GPIO33 diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h index 425bb7da1..ea0556f2c 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lv_c_mapping.h @@ -80,6 +80,7 @@ const be_ntv_func_def_t lv_style_func[] = { { "set_min_height", { (const void*) &lv_style_set_min_height, "", "(lv.lv_style)i" } }, { "set_min_width", { (const void*) &lv_style_set_min_width, "", "(lv.lv_style)i" } }, { "set_opa", { (const void*) &lv_style_set_opa, "", "(lv.lv_style)i" } }, + { "set_opa_layered", { (const void*) &lv_style_set_opa_layered, "", "(lv.lv_style)i" } }, { "set_outline_color", { (const void*) &lv_style_set_outline_color, "", "(lv.lv_style)(lv.lv_color)" } }, { "set_outline_opa", { (const void*) &lv_style_set_outline_opa, "", "(lv.lv_style)i" } }, { "set_outline_pad", { (const void*) &lv_style_set_outline_pad, "", "(lv.lv_style)i" } }, @@ -306,6 +307,8 @@ const be_ntv_func_def_t lv_obj_func[] = { { "get_style_min_height", { (const void*) &lv_obj_get_style_min_height, "i", "(lv.lv_obj)i" } }, { "get_style_min_width", { (const void*) &lv_obj_get_style_min_width, "i", "(lv.lv_obj)i" } }, { "get_style_opa", { (const void*) &lv_obj_get_style_opa, "i", "(lv.lv_obj)i" } }, + { "get_style_opa_layered", { (const void*) &lv_obj_get_style_opa_layered, "i", "(lv.lv_obj)i" } }, + { "get_style_opa_recursive", { (const void*) &lv_obj_get_style_opa_recursive, "i", "(lv.lv_obj)i" } }, { "get_style_outline_color", { (const void*) &lv_obj_get_style_outline_color, "lv.lv_color", "(lv.lv_obj)i" } }, { "get_style_outline_color_filtered", { (const void*) &lv_obj_get_style_outline_color_filtered, "lv.lv_color", "(lv.lv_obj)i" } }, { "get_style_outline_opa", { (const void*) &lv_obj_get_style_outline_opa, "i", "(lv.lv_obj)i" } }, @@ -340,6 +343,7 @@ const be_ntv_func_def_t lv_obj_func[] = { { "get_style_transform_pivot_y", { (const void*) &lv_obj_get_style_transform_pivot_y, "i", "(lv.lv_obj)i" } }, { "get_style_transform_width", { (const void*) &lv_obj_get_style_transform_width, "i", "(lv.lv_obj)i" } }, { "get_style_transform_zoom", { (const void*) &lv_obj_get_style_transform_zoom, "i", "(lv.lv_obj)i" } }, + { "get_style_transform_zoom_safe", { (const void*) &lv_obj_get_style_transform_zoom_safe, "i", "(lv.lv_obj)i" } }, { "get_style_transition", { (const void*) &lv_obj_get_style_transition, "lv.lv_style_transition_dsc", "(lv.lv_obj)i" } }, { "get_style_translate_x", { (const void*) &lv_obj_get_style_translate_x, "i", "(lv.lv_obj)i" } }, { "get_style_translate_y", { (const void*) &lv_obj_get_style_translate_y, "i", "(lv.lv_obj)i" } }, @@ -483,6 +487,7 @@ const be_ntv_func_def_t lv_obj_func[] = { { "set_style_min_height", { (const void*) &lv_obj_set_style_min_height, "", "(lv.lv_obj)ii" } }, { "set_style_min_width", { (const void*) &lv_obj_set_style_min_width, "", "(lv.lv_obj)ii" } }, { "set_style_opa", { (const void*) &lv_obj_set_style_opa, "", "(lv.lv_obj)ii" } }, + { "set_style_opa_layered", { (const void*) &lv_obj_set_style_opa_layered, "", "(lv.lv_obj)ii" } }, { "set_style_outline_color", { (const void*) &lv_obj_set_style_outline_color, "", "(lv.lv_obj)(lv.lv_color)i" } }, { "set_style_outline_opa", { (const void*) &lv_obj_set_style_outline_opa, "", "(lv.lv_obj)ii" } }, { "set_style_outline_pad", { (const void*) &lv_obj_set_style_outline_pad, "", "(lv.lv_obj)ii" } }, diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_module.c b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_module.c index f628ac3a9..db62ac304 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_module.c +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_module.c @@ -716,6 +716,7 @@ const be_const_member_t lv0_constants[] = { { "STYLE_MIN_HEIGHT", be_cconst_int(LV_STYLE_MIN_HEIGHT) }, { "STYLE_MIN_WIDTH", be_cconst_int(LV_STYLE_MIN_WIDTH) }, { "STYLE_OPA", be_cconst_int(LV_STYLE_OPA) }, + { "STYLE_OPA_LAYERED", be_cconst_int(LV_STYLE_OPA_LAYERED) }, { "STYLE_OUTLINE_COLOR", be_cconst_int(LV_STYLE_OUTLINE_COLOR) }, { "STYLE_OUTLINE_OPA", be_cconst_int(LV_STYLE_OUTLINE_OPA) }, { "STYLE_OUTLINE_PAD", be_cconst_int(LV_STYLE_OUTLINE_PAD) }, diff --git a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c index 37b9ef174..3df0ce70b 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c +++ b/lib/libesp32_lvgl/lv_binding_berry/generate/be_lvgl_widgets_lib.c @@ -132,6 +132,7 @@ extern int lvbe_style_set_text_align(bvm *vm); extern int lvbe_style_set_radius(bvm *vm); extern int lvbe_style_set_clip_corner(bvm *vm); extern int lvbe_style_set_opa(bvm *vm); +extern int lvbe_style_set_opa_layered(bvm *vm); extern int lvbe_style_set_color_filter_dsc(bvm *vm); extern int lvbe_style_set_color_filter_opa(bvm *vm); extern int lvbe_style_set_anim(bvm *vm); @@ -308,6 +309,8 @@ extern int lvbe_obj_set_style_pad_ver(bvm *vm); extern int lvbe_obj_set_style_pad_gap(bvm *vm); extern int lvbe_obj_set_style_size(bvm *vm); extern int lvbe_obj_calculate_style_text_align(bvm *vm); +extern int lvbe_obj_get_style_transform_zoom_safe(bvm *vm); +extern int lvbe_obj_get_style_opa_recursive(bvm *vm); extern int lvbe_obj_get_style_width(bvm *vm); extern int lvbe_obj_get_style_min_width(bvm *vm); extern int lvbe_obj_get_style_max_width(bvm *vm); @@ -393,6 +396,7 @@ extern int lvbe_obj_get_style_text_align(bvm *vm); extern int lvbe_obj_get_style_radius(bvm *vm); extern int lvbe_obj_get_style_clip_corner(bvm *vm); extern int lvbe_obj_get_style_opa(bvm *vm); +extern int lvbe_obj_get_style_opa_layered(bvm *vm); extern int lvbe_obj_get_style_color_filter_dsc(bvm *vm); extern int lvbe_obj_get_style_color_filter_opa(bvm *vm); extern int lvbe_obj_get_style_anim(bvm *vm); @@ -477,6 +481,7 @@ extern int lvbe_obj_set_style_text_align(bvm *vm); extern int lvbe_obj_set_style_radius(bvm *vm); extern int lvbe_obj_set_style_clip_corner(bvm *vm); extern int lvbe_obj_set_style_opa(bvm *vm); +extern int lvbe_obj_set_style_opa_layered(bvm *vm); extern int lvbe_obj_set_style_color_filter_dsc(bvm *vm); extern int lvbe_obj_set_style_color_filter_opa(bvm *vm); extern int lvbe_obj_set_style_anim(bvm *vm); diff --git a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_enum.h b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_enum.h index dd05cec1b..e2c60d4e4 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_enum.h +++ b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_enum.h @@ -708,6 +708,7 @@ LV_STYLE_TEXT_LINE_SPACE LV_STYLE_TEXT_DECOR LV_STYLE_TEXT_ALIGN LV_STYLE_OPA +LV_STYLE_OPA_LAYERED LV_STYLE_COLOR_FILTER_DSC LV_STYLE_COLOR_FILTER_OPA LV_STYLE_ANIM diff --git a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h index 125384800..39fbddc61 100644 --- a/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h +++ b/lib/libesp32_lvgl/lv_binding_berry/mapping/lv_funcs.h @@ -254,6 +254,8 @@ static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t v static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt) +static inline lv_coord_t lv_obj_get_style_transform_zoom_safe(const struct _lv_obj_t * obj, uint32_t part) +lv_opa_t lv_obj_get_style_opa_recursive(const struct _lv_obj_t * obj, lv_part_t part) // ../../lvgl/src/core/lv_obj_style_gen.h static inline lv_coord_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part) @@ -341,6 +343,7 @@ static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part) static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part) static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_opa_layered(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) static inline lv_opa_t lv_obj_get_style_color_filter_opa(const struct _lv_obj_t * obj, uint32_t part) static inline const lv_anim_t * lv_obj_get_style_anim(const struct _lv_obj_t * obj, uint32_t part) @@ -425,6 +428,7 @@ 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_opa_layered(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_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector) void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector) @@ -908,6 +912,7 @@ void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value) void lv_style_set_radius(lv_style_t * style, lv_coord_t value) void lv_style_set_clip_corner(lv_style_t * style, bool value) void lv_style_set_opa(lv_style_t * style, lv_opa_t value) +void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value) void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value) void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value) void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value) diff --git a/lib/libesp32_lvgl/lvgl/library.json b/lib/libesp32_lvgl/lvgl/library.json index dc0e86c4f..5a1f9d7be 100644 --- a/lib/libesp32_lvgl/lvgl/library.json +++ b/lib/libesp32_lvgl/lvgl/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "8.3.9", + "version": "8.3.10", "keywords": "graphics, gui, embedded, tft, lvgl", "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", "repository": { diff --git a/lib/libesp32_lvgl/lvgl/library.properties b/lib/libesp32_lvgl/lvgl/library.properties index 2fe2dd2ba..87e1cbc89 100644 --- a/lib/libesp32_lvgl/lvgl/library.properties +++ b/lib/libesp32_lvgl/lvgl/library.properties @@ -1,5 +1,5 @@ name=lvgl -version=8.3.9 +version=8.3.10 author=kisvegabor maintainer=kisvegabor,embeddedt,pete-pjb sentence=Full-featured Graphics Library for Embedded Systems diff --git a/lib/libesp32_lvgl/lvgl/lvgl.h b/lib/libesp32_lvgl/lvgl/lvgl.h index 99ce263d2..c37b2ee8d 100644 --- a/lib/libesp32_lvgl/lvgl/lvgl.h +++ b/lib/libesp32_lvgl/lvgl/lvgl.h @@ -15,7 +15,7 @@ extern "C" { ***************************/ #define LVGL_VERSION_MAJOR 8 #define LVGL_VERSION_MINOR 3 -#define LVGL_VERSION_PATCH 9 +#define LVGL_VERSION_PATCH 10 #define LVGL_VERSION_INFO "" /********************* diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c index 209ef8100..8d814d1ab 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj.c @@ -513,6 +513,11 @@ static void lv_obj_draw(lv_event_t * e) return; } + if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) { + info->res = LV_COVER_RES_NOT_COVER; + return; + } + info->res = LV_COVER_RES_COVER; } @@ -697,7 +702,7 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc } } - lv_opa_t opa = lv_obj_get_style_opa(obj, LV_PART_SCROLLBAR); + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, LV_PART_SCROLLBAR); if(opa < LV_OPA_MAX) { dsc->bg_opa = (dsc->bg_opa * opa) >> 8; dsc->border_opa = (dsc->bg_opa * opa) >> 8; diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c index f2428cddf..e0b95c523 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_draw.c @@ -38,9 +38,8 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc) { - lv_opa_t opa = LV_OPA_COVER; + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part); if(part != LV_PART_MAIN) { - opa = lv_obj_get_style_opa(obj, part); if(opa <= LV_OPA_MIN) { draw_dsc->bg_opa = LV_OPA_TRANSP; draw_dsc->bg_img_opa = LV_OPA_TRANSP; @@ -181,14 +180,12 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t } #endif - if(part != LV_PART_MAIN) { - if(opa < LV_OPA_MAX) { - draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8; - draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8; - } + if(opa < LV_OPA_MAX) { + draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8; + draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8; + draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8; + draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8; + draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8; } } @@ -197,16 +194,15 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc draw_dsc->opa = lv_obj_get_style_text_opa(obj, part); if(draw_dsc->opa <= LV_OPA_MIN) return; - if(part != LV_PART_MAIN) { - lv_opa_t opa = lv_obj_get_style_opa(obj, part); - if(opa <= LV_OPA_MIN) { - draw_dsc->opa = LV_OPA_TRANSP; - return; - } - if(opa < LV_OPA_MAX) { - draw_dsc->opa = (opa * draw_dsc->opa) >> 8; - } + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part); + if(opa <= LV_OPA_MIN) { + draw_dsc->opa = LV_OPA_TRANSP; + return; } + if(opa < LV_OPA_MAX) { + draw_dsc->opa = (opa * draw_dsc->opa) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; draw_dsc->color = lv_obj_get_style_text_color_filtered(obj, part); draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part); @@ -230,16 +226,15 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc->opa = lv_obj_get_style_img_opa(obj, part); if(draw_dsc->opa <= LV_OPA_MIN) return; - if(part != LV_PART_MAIN) { - lv_opa_t opa = lv_obj_get_style_opa(obj, part); - if(opa <= LV_OPA_MIN) { - draw_dsc->opa = LV_OPA_TRANSP; - return; - } - if(opa < LV_OPA_MAX) { - draw_dsc->opa = (opa * draw_dsc->opa) >> 8; - } + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part); + if(opa <= LV_OPA_MIN) { + draw_dsc->opa = LV_OPA_TRANSP; + return; } + if(opa < LV_OPA_MAX) { + draw_dsc->opa = (opa * draw_dsc->opa) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; draw_dsc->angle = 0; draw_dsc->zoom = LV_IMG_ZOOM_NONE; @@ -260,16 +255,15 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t draw_dsc->opa = lv_obj_get_style_line_opa(obj, part); if(draw_dsc->opa <= LV_OPA_MIN) return; - if(part != LV_PART_MAIN) { - lv_opa_t opa = lv_obj_get_style_opa(obj, part); - if(opa <= LV_OPA_MIN) { - draw_dsc->opa = LV_OPA_TRANSP; - return; - } - if(opa < LV_OPA_MAX) { - draw_dsc->opa = (opa * draw_dsc->opa) >> 8; - } + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part); + if(opa <= LV_OPA_MIN) { + draw_dsc->opa = LV_OPA_TRANSP; + return; } + if(opa < LV_OPA_MAX) { + draw_dsc->opa = (opa * draw_dsc->opa) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; draw_dsc->width = lv_obj_get_style_line_width(obj, part); if(draw_dsc->width == 0) return; @@ -297,16 +291,15 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc->opa = lv_obj_get_style_arc_opa(obj, part); if(draw_dsc->opa <= LV_OPA_MIN) return; - if(part != LV_PART_MAIN) { - lv_opa_t opa = lv_obj_get_style_opa(obj, part); - if(opa <= LV_OPA_MIN) { - draw_dsc->opa = LV_OPA_TRANSP; - return; - } - if(opa < LV_OPA_MAX) { - draw_dsc->opa = (opa * draw_dsc->opa) >> 8; - } + lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part); + if(opa <= LV_OPA_MIN) { + draw_dsc->opa = LV_OPA_TRANSP; + return; } + if(opa < LV_OPA_MAX) { + draw_dsc->opa = (opa * draw_dsc->opa) >> 8; + } + if(draw_dsc->opa <= LV_OPA_MIN) return; draw_dsc->color = lv_obj_get_style_arc_color_filtered(obj, part); draw_dsc->img_src = lv_obj_get_style_arc_img_src(obj, part); diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.c index c71c9f951..ecffca921 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.c @@ -496,6 +496,40 @@ lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, return align; } +lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part) +{ + + lv_opa_t opa_obj = lv_obj_get_style_opa(obj, part); + if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP; + + lv_opa_t opa_final = LV_OPA_COVER; + if(opa_obj < LV_OPA_MAX) { + opa_final = ((uint32_t)opa_final * opa_obj) >> 8; + } + + if(part != LV_PART_MAIN) { + part = LV_PART_MAIN; + } + else { + obj = lv_obj_get_parent(obj); + } + + while(obj) { + opa_obj = lv_obj_get_style_opa(obj, part); + if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP; + if(opa_obj < LV_OPA_MAX) { + opa_final = ((uint32_t)opa_final * opa_obj) >> 8; + } + + obj = lv_obj_get_parent(obj); + } + + if(opa_final <= LV_OPA_MIN) return LV_OPA_TRANSP; + if(opa_final >= LV_OPA_MAX) return LV_OPA_COVER; + return opa_final; +} + + /********************** * STATIC FUNCTIONS **********************/ @@ -846,8 +880,7 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj) { if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM; if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM; - if(lv_obj_get_style_opa(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE; - + if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE; #if LV_DRAW_COMPLEX if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE; #endif diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.h b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.h index 250fa1aec..ecc24db7e 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.h +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style.h @@ -91,7 +91,7 @@ void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_se */ static inline void lv_obj_remove_style_all(struct _lv_obj_t * obj) { - lv_obj_remove_style(obj, NULL, (uint32_t)LV_PART_ANY | (uint32_t)LV_STATE_ANY); + lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); } /** @@ -236,6 +236,21 @@ static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t valu lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt); +static inline lv_coord_t lv_obj_get_style_transform_zoom_safe(const struct _lv_obj_t * obj, uint32_t part) +{ + int16_t zoom = lv_obj_get_style_transform_zoom(obj, part); + return zoom != 0 ? zoom : 1; +} + + +/** + * Get the `opa` style property from all parents and multiply and `>> 8` them. + * @param obj the object whose opacity should be get + * @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of teh MAIN part too + * @return the final opacity considering the parents' opacity too + */ +lv_opa_t lv_obj_get_style_opa_recursive(const struct _lv_obj_t * obj, lv_part_t part); + /********************** * MACROS diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c index 64a0bb28c..a9635f473 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.c @@ -600,7 +600,16 @@ 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_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_obj_set_local_style_prop(obj, LV_STYLE_OPA_LAYERED, 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) { lv_style_value_t v = { .ptr = value @@ -640,7 +649,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 diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h index 576927d9a..51d43aefc 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_obj_style_gen.h @@ -162,7 +162,8 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BG_GRAD_COLOR)); return v.color; } @@ -216,7 +217,8 @@ static inline lv_color_t lv_obj_get_style_bg_img_recolor(const struct _lv_obj_t static inline lv_color_t lv_obj_get_style_bg_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMG_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BG_IMG_RECOLOR)); return v.color; } @@ -240,7 +242,8 @@ static inline lv_color_t lv_obj_get_style_border_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_border_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BORDER_COLOR)); return v.color; } @@ -282,7 +285,8 @@ static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_OUTLINE_COLOR)); return v.color; } @@ -330,7 +334,8 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_SHADOW_COLOR)); return v.color; } @@ -354,7 +359,8 @@ static inline lv_color_t lv_obj_get_style_img_recolor(const struct _lv_obj_t * o static inline lv_color_t lv_obj_get_style_img_recolor_filtered(const struct _lv_obj_t * obj, uint32_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMG_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_IMG_RECOLOR)); return v.color; } @@ -508,7 +514,14 @@ 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 lv_opa_t lv_obj_get_style_opa_layered(const struct _lv_obj_t * obj, uint32_t part) +{ + lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED); + 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) { 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; @@ -637,12 +650,15 @@ 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_opa_layered(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_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_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); diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_refr.c b/lib/libesp32_lvgl/lvgl/src/core/lv_refr.c index ec83e0f09..bfd27487a 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_refr.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_refr.c @@ -53,6 +53,7 @@ typedef struct { **********************/ static void lv_refr_join_area(void); static void refr_invalid_areas(void); +static void refr_sync_areas(void); static void refr_area(const lv_area_t * area_p); static void refr_area_part(lv_draw_ctx_t * draw_ctx); static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj); @@ -320,12 +321,25 @@ void _lv_disp_refr_timer(lv_timer_t * tmr) } lv_refr_join_area(); - + refr_sync_areas(); refr_invalid_areas(); /*If refresh happened ...*/ if(disp_refr->inv_p != 0) { + /*Copy invalid areas for sync next refresh in double buffered direct mode*/ + if(disp_refr->driver->direct_mode && disp_refr->driver->draw_buf->buf2) { + + uint16_t i; + for(i = 0; i < disp_refr->inv_p; i++) { + if(disp_refr->inv_area_joined[i]) + continue; + + lv_area_t * sync_area = _lv_ll_ins_tail(&disp_refr->sync_areas); + *sync_area = disp_refr->inv_areas[i]; + } + } + /*Clean up*/ lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas)); lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined)); @@ -495,6 +509,78 @@ static void lv_refr_join_area(void) } } +/** + * Refresh the sync areas + */ +static void refr_sync_areas(void) +{ + /*Do not sync if not direct mode*/ + if(!disp_refr->driver->direct_mode) return; + + /*Do not sync if not double buffered*/ + if(disp_refr->driver->draw_buf->buf2 == NULL) return; + + /*Do not sync if no sync areas*/ + if(_lv_ll_is_empty(&disp_refr->sync_areas)) return; + + /*The buffers are already swapped. + *So the active buffer is the off screen buffer where LVGL will render*/ + void * buf_off_screen = disp_refr->driver->draw_buf->buf_act; + void * buf_on_screen = disp_refr->driver->draw_buf->buf_act == disp_refr->driver->draw_buf->buf1 + ? disp_refr->driver->draw_buf->buf2 + : disp_refr->driver->draw_buf->buf1; + + /*Get stride for buffer copy*/ + lv_coord_t stride = lv_disp_get_hor_res(disp_refr); + + /*Iterate through invalidated areas to see if sync area should be copied*/ + lv_area_t res[4] = {0}; + int8_t res_c, j; + uint32_t i; + lv_area_t * sync_area, *new_area, *next_area; + for(i = 0; i < disp_refr->inv_p; i++) { + /*Skip joined areas*/ + if(disp_refr->inv_area_joined[i]) continue; + + /*Iterate over sync areas*/ + sync_area = _lv_ll_get_head(&disp_refr->sync_areas); + while(sync_area != NULL) { + /*Get next sync area*/ + next_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area); + + /*Remove intersect of redraw area from sync area and get remaining areas*/ + res_c = _lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]); + + /*New sub areas created after removing intersect*/ + if(res_c != -1) { + /*Replace old sync area with new areas*/ + for(j = 0; j < res_c; j++) { + new_area = _lv_ll_ins_prev(&disp_refr->sync_areas, sync_area); + *new_area = res[j]; + } + _lv_ll_remove(&disp_refr->sync_areas, sync_area); + lv_mem_free(sync_area); + } + + /*Move on to next sync area*/ + sync_area = next_area; + } + } + + /*Copy sync areas (if any remaining)*/ + for(sync_area = _lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL; + sync_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area)) { + disp_refr->driver->draw_ctx->buffer_copy( + disp_refr->driver->draw_ctx, + buf_off_screen, stride, sync_area, + buf_on_screen, stride, sync_area + ); + } + + /*Clear sync areas*/ + _lv_ll_clear(&disp_refr->sync_areas); +} + /** * Refresh the joined areas */ @@ -888,7 +974,7 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj) lv_obj_redraw(draw_ctx, obj); } else { - lv_opa_t opa = lv_obj_get_style_opa(obj, 0); + lv_opa_t opa = lv_obj_get_style_opa_layered(obj, 0); if(opa < LV_OPA_MIN) return; lv_area_t layer_area_full; diff --git a/lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c b/lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c index 39470527d..ef6d25a42 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/nxp/vglite/lv_draw_vglite_arc.c @@ -595,6 +595,8 @@ static void add_split_arc_path(int32_t * arc_path, int * pidx, vg_arc * q_arc, c static void add_arc_path(int32_t * arc_path, int * pidx, int32_t radius, int32_t start_angle, int32_t end_angle, const lv_point_t * center, bool cw) { + if(end_angle < start_angle) end_angle += 360; + /* set number of arcs to draw */ vg_arc q_arc; int32_t start_arc_angle = start_angle % 90; diff --git a/lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_composite.c b/lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_composite.c index e155570d8..9bf6385e5 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_composite.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/sdl/lv_draw_sdl_composite.c @@ -101,7 +101,8 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor SDL_RenderFillRect(ctx->renderer, NULL); SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND); #if LV_GPU_SDL_CUSTOM_BLEND_MODE - internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h); + internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h, + &internals->composition_cached); dump_masks(internals->mask, apply_area); #endif } diff --git a/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.mk b/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.mk index 1afcc7b7f..8d418adb0 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.mk +++ b/lib/libesp32_lvgl/lvgl/src/extra/lv_extra.mk @@ -1 +1 @@ -CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra -name \*.c) +CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/extra -name "*.c") diff --git a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c index 1e651b572..89e9e5433 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/widgets/meter/lv_meter.c @@ -336,7 +336,7 @@ static void draw_arcs(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area_t scale_center.x = scale_area->x1 + r_out; scale_center.y = scale_area->y1 + r_out; - lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN); + lv_opa_t opa_main = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN); lv_meter_indicator_t * indic; lv_obj_draw_part_dsc_t part_draw_dsc; @@ -563,7 +563,7 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area lv_draw_img_dsc_t img_dsc; lv_draw_img_dsc_init(&img_dsc); lv_obj_init_draw_img_dsc(obj, LV_PART_ITEMS, &img_dsc); - lv_opa_t opa_main = lv_obj_get_style_opa(obj, LV_PART_MAIN); + lv_opa_t opa_main = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN); lv_obj_draw_part_dsc_t part_draw_dsc; lv_obj_draw_dsc_init(&part_draw_dsc, draw_ctx); diff --git a/lib/libesp32_lvgl/lvgl/src/extra/widgets/span/lv_span.c b/lib/libesp32_lvgl/lvgl/src/extra/widgets/span/lv_span.c index 96f044760..6f970c54e 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/widgets/span/lv_span.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/widgets/span/lv_span.c @@ -779,7 +779,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx) lv_coord_t max_width = lv_area_get_width(&coords); lv_coord_t indent = convert_indent_pct(obj, max_width); lv_coord_t max_w = max_width - indent; /* first line need minus indent */ - lv_opa_t obj_opa = lv_obj_get_style_opa(obj, LV_PART_MAIN); + lv_opa_t obj_opa = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN); /* coords of draw span-txt */ lv_point_t txt_pos; diff --git a/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.c b/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.c index 087882915..6f1c9626d 100644 --- a/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.c +++ b/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.c @@ -186,6 +186,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver) disp->inv_en_cnt = 1; + _lv_ll_init(&disp->sync_areas, sizeof(lv_area_t)); + lv_disp_t * disp_def_tmp = disp_def; disp_def = disp; /*Temporarily change the default screen to create the default screens on the new display*/ @@ -316,6 +318,7 @@ void lv_disp_remove(lv_disp_t * disp) } _lv_ll_remove(&LV_GC_ROOT(_lv_disp_ll), disp); + _lv_ll_clear(&disp->sync_areas); if(disp->refr_timer) lv_timer_del(disp->refr_timer); lv_mem_free(disp); diff --git a/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.h b/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.h index 93a6b4614..d5203a0b1 100644 --- a/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.h +++ b/lib/libesp32_lvgl/lvgl/src/hal/lv_hal_disp.h @@ -23,6 +23,7 @@ extern "C" { #include "../misc/lv_area.h" #include "../misc/lv_ll.h" #include "../misc/lv_timer.h" +#include "../misc/lv_ll.h" /********************* * DEFINES @@ -187,6 +188,9 @@ typedef struct _lv_disp_t { uint16_t inv_p; int32_t inv_en_cnt; + /** Double buffer sync areas */ + lv_ll_t sync_areas; + /*Miscellaneous data*/ uint32_t last_activity_time; /**< Last time when there was activity on this display*/ } lv_disp_t; diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_area.c b/lib/libesp32_lvgl/lvgl/src/misc/lv_area.c index c0221f7ed..493b70880 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_area.c +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_area.c @@ -143,6 +143,78 @@ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area return union_ok; } +/** + * Get resulting sub areas after removing the common parts of two areas from the first area + * @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here + * @param a1_p pointer to the first area + * @param a2_p pointer to the second area + * @return number of results or -1 if no intersect + */ +int8_t _lv_area_diff(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) +{ + /*Areas have no common parts*/ + if(!_lv_area_is_on(a1_p, a2_p)) return -1; + + /*No remaining areas after removing common parts*/ + if(_lv_area_is_in(a1_p, a2_p, 0)) return 0; + + /*Result counter*/ + int8_t res_c = 0; + + /*Get required information*/ + lv_area_t n; + lv_coord_t a1_w = lv_area_get_width(a1_p) - 1; + lv_coord_t a1_h = lv_area_get_height(a1_p) - 1; + + /*Compute top rectangle*/ + lv_coord_t th = a2_p->y1 - a1_p->y1; + if(th > 0) { + n.x1 = a1_p->x1; + n.y1 = a1_p->y1; + n.x2 = a1_p->x2; + n.y2 = a1_p->y1 + th; + res_p[res_c++] = n; + } + + /*Compute the bottom rectangle*/ + lv_coord_t bh = a1_h - (a2_p->y2 - a1_p->y1); + if(bh > 0 && a2_p->y2 < a1_p->y2) { + n.x1 = a1_p->x1; + n.y1 = a2_p->y2; + n.x2 = a1_p->x2; + n.y2 = a2_p->y2 + bh; + res_p[res_c++] = n; + } + + /*Compute side height*/ + lv_coord_t y1 = a2_p->y1 > a1_p->y1 ? a2_p->y1 : a1_p->y1; + lv_coord_t y2 = a2_p->y2 < a1_p->y2 ? a2_p->y2 : a1_p->y2; + lv_coord_t sh = y2 - y1; + + /*Compute the left rectangle*/ + lv_coord_t lw = a2_p->x1 - a1_p->x1; + if(lw > 0 && sh > 0) { + n.x1 = a1_p->x1; + n.y1 = y1; + n.x2 = a1_p->x1 + lw; + n.y2 = y1 + sh; + res_p[res_c++] = n; + } + + /*Compute the right rectangle*/ + lv_coord_t rw = a1_w - (a2_p->x2 - a1_p->x1); + if(rw > 0) { + n.x1 = a2_p->x2; + n.y1 = y1; + n.x2 = a2_p->x2 + rw; + n.y2 = y1 + sh; + res_p[res_c++] = n; + } + + //Return number of results + return res_c; +} + /** * Join two areas into a third which involves the other two * @param res_p pointer to an area, the result will be stored here diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_area.h b/lib/libesp32_lvgl/lvgl/src/misc/lv_area.h index 137931a29..48dc80744 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_area.h +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_area.h @@ -177,6 +177,15 @@ void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); */ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); +/** + * Get resulting sub areas after removing the common parts of two areas from the first area + * @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here + * @param a1_p pointer to the first area + * @param a2_p pointer to the second area + * @return number of results (max 4) or -1 if no intersect + */ +int8_t _lv_area_diff(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); + /** * Join two areas into a third which involves the other two * @param res_p pointer to an area, the result will be stored here diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_style.c b/lib/libesp32_lvgl/lvgl/src/misc/lv_style.c index 419c29e48..994be8126 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_style.c +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_style.c @@ -119,7 +119,8 @@ const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PR [LV_STYLE_RADIUS] = 0, [LV_STYLE_CLIP_CORNER] = 0, - [LV_STYLE_OPA] = LV_STYLE_PROP_LAYER_REFR, + [LV_STYLE_OPA] = 0, + [LV_STYLE_OPA_LAYERED] = LV_STYLE_PROP_LAYER_REFR, [LV_STYLE_COLOR_FILTER_DSC] = LV_STYLE_PROP_INHERIT, [LV_STYLE_COLOR_FILTER_OPA] = LV_STYLE_PROP_INHERIT, [LV_STYLE_ANIM_TIME] = 0, @@ -330,6 +331,7 @@ lv_style_value_t lv_style_prop_get_default(lv_style_prop_t prop) value.color = lv_color_black(); break; case LV_STYLE_OPA: + case LV_STYLE_OPA_LAYERED: case LV_STYLE_BORDER_OPA: case LV_STYLE_TEXT_OPA: case LV_STYLE_IMG_OPA: diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_style.h b/lib/libesp32_lvgl/lvgl/src/misc/lv_style.h index 5cf0b19c1..77bf28362 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_style.h +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_style.h @@ -260,23 +260,24 @@ typedef enum { /*Group 6*/ LV_STYLE_OPA = 96, - LV_STYLE_COLOR_FILTER_DSC = 97, - LV_STYLE_COLOR_FILTER_OPA = 98, - LV_STYLE_ANIM = 99, - LV_STYLE_ANIM_TIME = 100, - LV_STYLE_ANIM_SPEED = 101, - LV_STYLE_TRANSITION = 102, - LV_STYLE_BLEND_MODE = 103, - LV_STYLE_TRANSFORM_WIDTH = 104, - LV_STYLE_TRANSFORM_HEIGHT = 105, - LV_STYLE_TRANSLATE_X = 106, - LV_STYLE_TRANSLATE_Y = 107, - LV_STYLE_TRANSFORM_ZOOM = 108, - LV_STYLE_TRANSFORM_ANGLE = 109, - LV_STYLE_TRANSFORM_PIVOT_X = 110, - LV_STYLE_TRANSFORM_PIVOT_Y = 111, + LV_STYLE_OPA_LAYERED = 97, + LV_STYLE_COLOR_FILTER_DSC = 98, + LV_STYLE_COLOR_FILTER_OPA = 99, + LV_STYLE_ANIM = 100, + LV_STYLE_ANIM_TIME = 101, + LV_STYLE_ANIM_SPEED = 102, + LV_STYLE_TRANSITION = 103, + LV_STYLE_BLEND_MODE = 104, + LV_STYLE_TRANSFORM_WIDTH = 105, + LV_STYLE_TRANSFORM_HEIGHT = 106, + LV_STYLE_TRANSLATE_X = 107, + LV_STYLE_TRANSLATE_Y = 108, + LV_STYLE_TRANSFORM_ZOOM = 109, + LV_STYLE_TRANSFORM_ANGLE = 110, + LV_STYLE_TRANSFORM_PIVOT_X = 111, + LV_STYLE_TRANSFORM_PIVOT_Y = 112, - _LV_STYLE_LAST_BUILT_IN_PROP = 111, + _LV_STYLE_LAST_BUILT_IN_PROP = 112, _LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1, LV_STYLE_PROP_ANY = 0xFFFF, diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.c b/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.c index 13d85607a..0b8479d29 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.c +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.c @@ -600,6 +600,14 @@ void lv_style_set_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OPA, v); } +void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value) +{ + lv_style_value_t v = { + .num = (int32_t)value + }; + lv_style_set_prop(style, LV_STYLE_OPA_LAYERED, v); +} + void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value) { lv_style_value_t v = { diff --git a/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.h b/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.h index 8bf3b68f4..66ba068c8 100644 --- a/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.h +++ b/lib/libesp32_lvgl/lvgl/src/misc/lv_style_gen.h @@ -73,6 +73,7 @@ void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value); void lv_style_set_radius(lv_style_t * style, lv_coord_t value); void lv_style_set_clip_corner(lv_style_t * style, bool value); void lv_style_set_opa(lv_style_t * style, lv_opa_t value); +void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value); void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value); void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value); void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value); @@ -458,6 +459,11 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value); .prop = LV_STYLE_OPA, .value = { .num = (int32_t)val } \ } +#define LV_STYLE_CONST_OPA_LAYERED(val) \ + { \ + .prop = LV_STYLE_OPA_LAYERED, .value = { .num = (int32_t)val } \ + } + #define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \ { \ .prop = LV_STYLE_COLOR_FILTER_DSC, .value = { .ptr = val } \ diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c index 1d2df0d8c..b0dc8df3f 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_btnmatrix.c @@ -440,6 +440,7 @@ static void lv_btnmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_indev_get_point(param, &p); btn_pr = get_button_from_point(obj, &p); /*Handle the case where there is no button there*/ + btnm->btn_id_sel = LV_BTNMATRIX_BTN_NONE; if(btn_pr != LV_BTNMATRIX_BTN_NONE) { if(button_is_inactive(btnm->ctrl_bits[btn_pr]) == false && button_is_hidden(btnm->ctrl_bits[btn_pr]) == false) { diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c index 241d17776..974435b2d 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_dropdown.c @@ -285,6 +285,10 @@ void lv_dropdown_set_selected(lv_obj_t * obj, uint16_t sel_opt) dropdown->sel_opt_id = sel_opt < dropdown->option_cnt ? sel_opt : dropdown->option_cnt - 1; dropdown->sel_opt_id_orig = dropdown->sel_opt_id; + if(dropdown->list) { + position_to_selected(obj); + } + lv_obj_invalidate(obj); }