Merge pull request #16740 from s-hadinger/lvgl_8_3_2

ESP32 LVGL library from v8.3.0 to v8.3.2
This commit is contained in:
s-hadinger 2022-10-05 22:40:15 +02:00 committed by GitHub
commit af5b25f16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 122 additions and 79 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Support for QMC5883L magnetic induction sensor by Helge Scheunemann (#16714) - Support for QMC5883L magnetic induction sensor by Helge Scheunemann (#16714)
### Changed ### Changed
- ESP32 LVGL library from v8.3.0 to v8.3.2
### Fixed ### Fixed

View File

@ -1,6 +1,6 @@
{ {
"name": "lvgl", "name": "lvgl",
"version": "8.3.0", "version": "8.3.2",
"keywords": "graphics, gui, embedded, tft, lvgl", "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.", "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": { "repository": {

View File

@ -1,5 +1,5 @@
name=lvgl name=lvgl
version=8.3.0 version=8.3.2
author=kisvegabor author=kisvegabor
maintainer=kisvegabor,embeddedt,pete-pjb maintainer=kisvegabor,embeddedt,pete-pjb
sentence=Full-featured Graphics Library for Embedded Systems sentence=Full-featured Graphics Library for Embedded Systems

View File

@ -1,6 +1,6 @@
/** /**
* @file lv_conf.h * @file lv_conf.h
* Configuration file for v8.3.0 * Configuration file for v8.3.2
*/ */
/* /*

View File

@ -15,7 +15,7 @@ extern "C" {
***************************/ ***************************/
#define LVGL_VERSION_MAJOR 8 #define LVGL_VERSION_MAJOR 8
#define LVGL_VERSION_MINOR 3 #define LVGL_VERSION_MINOR 3
#define LVGL_VERSION_PATCH 0 #define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO "" #define LVGL_VERSION_INFO ""
/********************* /*********************

View File

@ -113,6 +113,9 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
LV_LOG_TRACE("begin"); LV_LOG_TRACE("begin");
/*Be sure the object is removed from its current group*/
lv_group_remove_obj(obj);
/*Do not add the object twice*/ /*Do not add the object twice*/
lv_obj_t ** obj_i; lv_obj_t ** obj_i;
_LV_LL_READ(&group->obj_ll, obj_i) { _LV_LL_READ(&group->obj_ll, obj_i) {

View File

@ -314,7 +314,12 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
/*The style is not found*/ /*The style is not found*/
if(i == obj->style_cnt) return false; if(i == obj->style_cnt) return false;
return lv_style_remove_prop(obj->styles[i].style, prop); lv_res_t res = lv_style_remove_prop(obj->styles[i].style, prop);
if(res == LV_RES_OK) {
lv_obj_refresh_style(obj, selector, prop);
}
return res;
} }
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state,

View File

@ -323,15 +323,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
refr_invalid_areas(); refr_invalid_areas();
/*If refresh happened ...*/ /*If refresh happened ...*/
if(disp_refr->inv_p != 0) { if(disp_refr->inv_p != 0) {
if(disp_refr->driver->full_refresh) {
lv_area_t disp_area;
lv_area_set(&disp_area, 0, 0, lv_disp_get_hor_res(disp_refr) - 1, lv_disp_get_ver_res(disp_refr) - 1);
disp_refr->driver->draw_ctx->buf_area = &disp_area;
draw_buf_flush(disp_refr);
}
/*Clean up*/ /*Clean up*/
lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas)); lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
@ -621,8 +614,11 @@ static void refr_area_part(lv_draw_ctx_t * draw_ctx)
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr); lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
/* Below the `area_p` area will be redrawn into the draw buffer. /* Below the `area_p` area will be redrawn into the draw buffer.
* In single buffered mode wait here until the buffer is freed.*/ * In single buffered mode wait here until the buffer is freed.
if(draw_buf->buf1 && !draw_buf->buf2) { * In full double buffered mode wait here while the buffers are swapped and a buffer becomes available*/
bool full_sized = draw_buf->size == (uint32_t)disp_refr->driver->hor_res * disp_refr->driver->ver_res;
if((draw_buf->buf1 && !draw_buf->buf2) ||
(draw_buf->buf1 && draw_buf->buf2 && full_sized)) {
while(draw_buf->flushing) { while(draw_buf->flushing) {
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver); if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
} }
@ -710,12 +706,8 @@ static void refr_area_part(lv_draw_ctx_t * draw_ctx)
refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr)); refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr));
refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr)); refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr));
/*In true double buffered mode flush only once when all areas were rendered.
*In normal mode flush after every area*/
if(disp_refr->driver->full_refresh == false) {
draw_buf_flush(disp_refr); draw_buf_flush(disp_refr);
} }
}
/** /**
* Search the most top object which fully covers an area * Search the most top object which fully covers an area
@ -738,9 +730,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info); lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
if(info.res == LV_COVER_RES_MASKED) return NULL; if(info.res == LV_COVER_RES_MASKED) return NULL;
uint32_t i; int32_t i;
uint32_t child_cnt = lv_obj_get_child_cnt(obj); int32_t child_cnt = lv_obj_get_child_cnt(obj);
for(i = 0; i < child_cnt; i++) { for(i = child_cnt - 1; i >= 0; i--) {
lv_obj_t * child = obj->spec_attr->children[i]; lv_obj_t * child = obj->spec_attr->children[i];
found_p = lv_refr_get_top_obj(area_p, child); found_p = lv_refr_get_top_obj(area_p, child);
@ -1189,24 +1181,13 @@ static void draw_buf_flush(lv_disp_t * disp)
lv_draw_ctx_t * draw_ctx = disp->driver->draw_ctx; lv_draw_ctx_t * draw_ctx = disp->driver->draw_ctx;
if(draw_ctx->wait_for_finish) draw_ctx->wait_for_finish(draw_ctx); if(draw_ctx->wait_for_finish) draw_ctx->wait_for_finish(draw_ctx);
/* In double buffered mode wait until the other buffer is freed /* In partial double buffered mode wait until the other buffer is freed
* and driver is ready to receive the new buffer */ * and driver is ready to receive the new buffer */
if(draw_buf->buf1 && draw_buf->buf2) { bool full_sized = draw_buf->size == (uint32_t)disp_refr->driver->hor_res * disp_refr->driver->ver_res;
if(draw_buf->buf1 && draw_buf->buf2 && !full_sized) {
while(draw_buf->flushing) { while(draw_buf->flushing) {
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver); if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
} }
/*If the screen is transparent initialize it when the flushing is ready*/
#if LV_COLOR_SCREEN_TRANSP
if(disp_refr->driver->screen_transp) {
if(disp_refr->driver->clear_cb) {
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
}
else {
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
}
}
#endif
} }
draw_buf->flushing = 1; draw_buf->flushing = 1;
@ -1225,6 +1206,7 @@ static void draw_buf_flush(lv_disp_t * disp)
call_flush_cb(disp->driver, draw_ctx->buf_area, draw_ctx->buf); call_flush_cb(disp->driver, draw_ctx->buf_area, draw_ctx->buf);
} }
} }
/*If there are 2 buffers swap them. With direct mode swap only on the last area*/ /*If there are 2 buffers swap them. With direct mode swap only on the last area*/
if(draw_buf->buf1 && draw_buf->buf2 && (!disp->driver->direct_mode || flushing_last)) { if(draw_buf->buf1 && draw_buf->buf2 && (!disp->driver->direct_mode || flushing_last)) {
if(draw_buf->buf_act == draw_buf->buf1) if(draw_buf->buf_act == draw_buf->buf1)

View File

@ -144,7 +144,7 @@ void _lv_img_decoder_init(void);
* Get information about an image. * Get information about an image.
* Try the created image decoder one by one. Once one is able to get info that info will be used. * Try the created image decoder one by one. Once one is able to get info that info will be used.
* @param src the image source. Can be * @param src the image source. Can be
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`) * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register()`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable * 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK` * 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param header the image info will be stored here * @param header the image info will be stored here
@ -157,7 +157,7 @@ lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header);
* Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc` * Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc`
* @param dsc describes a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable. * @param dsc describes a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable.
* @param src the image source. Can be * @param src the image source. Can be
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`) * 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable * 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK` * 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param color The color of the image with `LV_IMG_CF_ALPHA_...` * @param color The color of the image with `LV_IMG_CF_ALPHA_...`

View File

@ -95,7 +95,10 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
internals->target_backup = SDL_GetRenderTarget(ctx->renderer); internals->target_backup = SDL_GetRenderTarget(ctx->renderer);
SDL_SetRenderTarget(ctx->renderer, internals->composition); SDL_SetRenderTarget(ctx->renderer, internals->composition);
SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0); SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0);
SDL_RenderClear(ctx->renderer); /* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
SDL_RenderFillRect(ctx->renderer, NULL);
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
#if LV_GPU_SDL_CUSTOM_BLEND_MODE #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);
dump_masks(internals->mask, apply_area); dump_masks(internals->mask, apply_area);

View File

@ -390,7 +390,10 @@ static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Textur
SDL_Texture * old_target = SDL_GetRenderTarget(ctx->renderer); SDL_Texture * old_target = SDL_GetRenderTarget(ctx->renderer);
SDL_SetRenderTarget(ctx->renderer, img_frag); SDL_SetRenderTarget(ctx->renderer, img_frag);
SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, 0); SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, 0);
SDL_RenderClear(ctx->renderer); /* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
SDL_RenderFillRect(ctx->renderer, NULL);
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
lv_area_t coords = {0, 0, w - 1, h - 1}, clip; lv_area_t coords = {0, 0, w - 1, h - 1}, clip;
lv_area_t frag_coords = {0, 0, full_frag_size - 1, full_frag_size - 1}; lv_area_t frag_coords = {0, 0, full_frag_size - 1, full_frag_size - 1};

View File

@ -64,9 +64,17 @@ lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_l
transform_ctx->target_rect.w = target_w; transform_ctx->target_rect.w = target_w;
transform_ctx->target_rect.h = target_h; transform_ctx->target_rect.h = target_h;
layer_ctx->max_row_with_alpha = target_h;
layer_ctx->max_row_with_no_alpha = target_h;
SDL_SetTextureBlendMode(transform_ctx->target, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(transform_ctx->target, SDL_BLENDMODE_BLEND);
SDL_SetRenderTarget(renderer, transform_ctx->target); SDL_SetRenderTarget(renderer, transform_ctx->target);
SDL_RenderClear(renderer);
/* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
SDL_RenderFillRect(renderer, NULL);
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
/* Set proper drawing context for transform layer */ /* Set proper drawing context for transform layer */
ctx->internals->transform_count += 1; ctx->internals->transform_count += 1;
@ -100,6 +108,7 @@ void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * lay
lv_area_to_sdl_rect(layer_ctx->original.clip_area, &clip_rect); lv_area_to_sdl_rect(layer_ctx->original.clip_area, &clip_rect);
SDL_Point center = {.x = draw_dsc->pivot.x, .y = draw_dsc->pivot.y}; SDL_Point center = {.x = draw_dsc->pivot.x, .y = draw_dsc->pivot.y};
SDL_RenderSetClipRect(renderer, &clip_rect); SDL_RenderSetClipRect(renderer, &clip_rect);
SDL_SetTextureAlphaMod(transform_ctx->target, draw_dsc->opa);
SDL_RenderCopyEx(renderer, transform_ctx->target, &transform_ctx->target_rect, &trans_rect, SDL_RenderCopyEx(renderer, transform_ctx->target, &transform_ctx->target_rect, &trans_rect,
draw_dsc->angle, &center, SDL_FLIP_NONE); draw_dsc->angle, &center, SDL_FLIP_NONE);
SDL_RenderSetClipRect(renderer, NULL); SDL_RenderSetClipRect(renderer, NULL);

View File

@ -126,7 +126,10 @@ static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_d
SDL_SetRenderTarget(sdl_ctx->renderer, texture); SDL_SetRenderTarget(sdl_ctx->renderer, texture);
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0x0); SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0x0);
SDL_RenderClear(sdl_ctx->renderer); /* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
SDL_SetRenderDrawBlendMode(sdl_ctx->renderer, SDL_BLENDMODE_NONE);
SDL_RenderFillRect(sdl_ctx->renderer, NULL);
SDL_SetRenderDrawBlendMode(sdl_ctx->renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0xFF); SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_Rect line_rect = {1 + dsc->width / 2, 1, length, dsc->width}; SDL_Rect line_rect = {1 + dsc->width / 2, 1, length, dsc->width};
SDL_RenderFillRect(sdl_ctx->renderer, &line_rect); SDL_RenderFillRect(sdl_ctx->renderer, &line_rect);

View File

@ -123,7 +123,6 @@ void lv_draw_sw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_la
img.header.w = lv_area_get_width(draw_ctx->buf_area); img.header.w = lv_area_get_width(draw_ctx->buf_area);
img.header.h = lv_area_get_height(draw_ctx->buf_area); img.header.h = lv_area_get_height(draw_ctx->buf_area);
img.header.cf = layer_sw_ctx->has_alpha ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR; img.header.cf = layer_sw_ctx->has_alpha ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR;
lv_img_cache_invalidate_src(&img);
/*Restore the original draw_ctx*/ /*Restore the original draw_ctx*/
draw_ctx->buf = layer_ctx->original.buf; draw_ctx->buf = layer_ctx->original.buf;
@ -135,6 +134,7 @@ void lv_draw_sw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_la
/*Blend the layer*/ /*Blend the layer*/
lv_draw_img(draw_ctx, draw_dsc, &layer_ctx->area_act, &img); lv_draw_img(draw_ctx, draw_dsc, &layer_ctx->area_act, &img);
lv_draw_wait_for_finish(draw_ctx); lv_draw_wait_for_finish(draw_ctx);
lv_img_cache_invalidate_src(&img);
} }
void lv_draw_sw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx) void lv_draw_sw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx)

View File

@ -1159,12 +1159,13 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
bool mask_any = lv_draw_mask_is_any(outer_area); bool mask_any = lv_draw_mask_is_any(outer_area);
#if LV_DRAW_COMPLEX
if(!mask_any && rout == 0 && rin == 0) { if(!mask_any && rout == 0 && rin == 0) {
draw_border_simple(draw_ctx, outer_area, inner_area, color, opa); draw_border_simple(draw_ctx, outer_area, inner_area, color, opa);
return; return;
} }
#if LV_DRAW_COMPLEX
/*Get clipped draw area which is the real draw area. /*Get clipped draw area which is the real draw area.
*It is always the same or inside `coords`*/ *It is always the same or inside `coords`*/
lv_area_t draw_area; lv_area_t draw_area;
@ -1281,12 +1282,12 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
/*Draw the corners*/ /*Draw the corners*/
lv_coord_t blend_w; lv_coord_t blend_w;
/*Left and right corner together is they close to eachother*/ /*Left and right corner together if they are close to each other*/
if(!split_hor) { if(!split_hor) {
/*Calculate the top corner and mirror it to the bottom*/ /*Calculate the top corner and mirror it to the bottom*/
blend_area.x1 = draw_area.x1; blend_area.x1 = draw_area.x1;
blend_area.x2 = draw_area.x2; blend_area.x2 = draw_area.x2;
lv_coord_t max_h = LV_MAX(rout, outer_area->y1 - inner_area->y1); lv_coord_t max_h = LV_MAX(rout, inner_area->y1 - outer_area->y1);
for(h = 0; h < max_h; h++) { for(h = 0; h < max_h; h++) {
lv_coord_t top_y = outer_area->y1 + h; lv_coord_t top_y = outer_area->y1 + h;
lv_coord_t bottom_y = outer_area->y2 - h; lv_coord_t bottom_y = outer_area->y2 - h;
@ -1375,6 +1376,13 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
#else /*LV_DRAW_COMPLEX*/ #else /*LV_DRAW_COMPLEX*/
LV_UNUSED(blend_mode); LV_UNUSED(blend_mode);
LV_UNUSED(rout);
LV_UNUSED(rin);
if(!mask_any) {
draw_border_simple(draw_ctx, outer_area, inner_area, color, opa);
return;
}
#endif /*LV_DRAW_COMPLEX*/ #endif /*LV_DRAW_COMPLEX*/
} }
static void draw_border_simple(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area, const lv_area_t * inner_area, static void draw_border_simple(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area, const lv_area_t * inner_area,

View File

@ -139,7 +139,6 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t
return (uint8_t)v.num; return (uint8_t)v.num;
} }
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@ -187,14 +187,15 @@ void lv_fragment_manager_replace(lv_fragment_manager_t * manager, lv_fragment_t
bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata) bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata)
{ {
LV_ASSERT_NULL(manager); LV_ASSERT_NULL(manager);
lv_fragment_stack_item_t * top = _lv_ll_get_tail(&manager->stack); lv_fragment_managed_states_t * p = NULL;
if(!top) return false; _LV_LL_READ_BACK(&manager->attached, p) {
lv_fragment_managed_states_t * states = top->states; if(!p->obj_created || p->destroying_obj) continue;
lv_fragment_t * instance = states->instance; lv_fragment_t * instance = p->instance;
if(!instance) return false; if(!instance) continue;
if(lv_fragment_manager_send_event(instance->child_manager, code, userdata)) return true; if(lv_fragment_manager_send_event(instance->child_manager, code, userdata)) return true;
if(!states->cls->event_cb) return false; if(p->cls->event_cb && p->cls->event_cb(instance, code, userdata)) return true;
return states->cls->event_cb(instance, code, userdata); }
return false;
} }
size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager) size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager)

View File

@ -613,7 +613,6 @@ static lv_res_t double_click_reset(lv_obj_t * obj)
* We replace division by 255 by a division by 256, a.k.a a shift right by 8 bits. * We replace division by 255 by a division by 256, a.k.a a shift right by 8 bits.
* This is wrong, but since this is only used to compute the pixels on the screen and not the final color, it's ok. * This is wrong, but since this is only used to compute the pixels on the screen and not the final color, it's ok.
*/ */
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b);
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b) static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b)
{ {
if(!s) { if(!s) {
@ -652,6 +651,11 @@ static lv_color_t angle_to_mode_color_fast(lv_obj_t * obj, uint16_t angle)
uint8_t r = 0, g = 0, b = 0; uint8_t r = 0, g = 0, b = 0;
static uint16_t h = 0; static uint16_t h = 0;
static uint8_t s = 0, v = 0, m = 255; static uint8_t s = 0, v = 0, m = 255;
static uint16_t angle_saved = 0xffff;
/*If the angle is different recalculate scaling*/
if(angle_saved != angle) m = 255;
angle_saved = angle;
switch(ext->mode) { switch(ext->mode) {
default: default:

View File

@ -178,6 +178,7 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &rect_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &rect_dsc);
/*Use the original colors brightness to modify color->led*/ /*Use the original colors brightness to modify color->led*/
rect_dsc.bg_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.bg_color));
rect_dsc.bg_grad.stops[0].color = lv_color_mix(led->color, lv_color_black(), rect_dsc.bg_grad.stops[0].color = lv_color_mix(led->color, lv_color_black(),
lv_color_brightness(rect_dsc.bg_grad.stops[0].color)); lv_color_brightness(rect_dsc.bg_grad.stops[0].color));
rect_dsc.bg_grad.stops[1].color = lv_color_mix(led->color, lv_color_black(), rect_dsc.bg_grad.stops[1].color = lv_color_mix(led->color, lv_color_black(),
@ -187,6 +188,7 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
rect_dsc.outline_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.outline_color)); rect_dsc.outline_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.outline_color));
/*Mix. the color with black proportionally with brightness*/ /*Mix. the color with black proportionally with brightness*/
rect_dsc.bg_color = lv_color_mix(rect_dsc.bg_color, lv_color_black(), led->bright);
rect_dsc.bg_grad.stops[0].color = lv_color_mix(rect_dsc.bg_grad.stops[0].color, lv_color_black(), led->bright); rect_dsc.bg_grad.stops[0].color = lv_color_mix(rect_dsc.bg_grad.stops[0].color, lv_color_black(), led->bright);
rect_dsc.bg_grad.stops[1].color = lv_color_mix(rect_dsc.bg_grad.stops[1].color, lv_color_black(), led->bright); rect_dsc.bg_grad.stops[1].color = lv_color_mix(rect_dsc.bg_grad.stops[1].color, lv_color_black(), led->bright);
rect_dsc.border_color = lv_color_mix(rect_dsc.border_color, lv_color_black(), led->bright); rect_dsc.border_color = lv_color_mix(rect_dsc.border_color, lv_color_black(), led->bright);

View File

@ -49,11 +49,26 @@ extern "C" {
#define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/ #define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/
LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE); LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE);
// *INDENT-OFF*
#if LV_USE_ASSERT_STYLE #if LV_USE_ASSERT_STYLE
#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .sentinel = LV_STYLE_SENTINEL_VALUE, .v_p = { .const_props = prop_array }, .has_group = 0xFF, .prop1 = LV_STYLE_PROP_ANY } #define LV_STYLE_CONST_INIT(var_name, prop_array) \
const lv_style_t var_name = { \
.sentinel = LV_STYLE_SENTINEL_VALUE, \
.v_p = { .const_props = prop_array }, \
.has_group = 0xFF, \
.prop1 = LV_STYLE_PROP_ANY, \
.prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
}
#else #else
#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .v_p = { .const_props = prop_array }, .has_group = 0xFF, .prop1 = LV_STYLE_PROP_ANY } #define LV_STYLE_CONST_INIT(var_name, prop_array) \
const lv_style_t var_name = { \
.v_p = { .const_props = prop_array }, \
.has_group = 0xFF, \
.prop1 = LV_STYLE_PROP_ANY, \
.prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
}
#endif #endif
// *INDENT-ON*
/** On simple system, don't waste resources on gradients */ /** On simple system, don't waste resources on gradients */
#if !defined(LV_DRAW_COMPLEX) || !defined(LV_GRADIENT_MAX_STOPS) #if !defined(LV_DRAW_COMPLEX) || !defined(LV_GRADIENT_MAX_STOPS)
@ -440,7 +455,9 @@ static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style,
{ {
if(style->prop1 == LV_STYLE_PROP_ANY) { if(style->prop1 == LV_STYLE_PROP_ANY) {
const lv_style_const_prop_t * const_prop; const lv_style_const_prop_t * const_prop;
for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) { uint32_t i;
for(i = 0; i < style->prop_cnt; i++) {
const_prop = style->v_p.const_props + i;
lv_style_prop_t prop_id = LV_STYLE_PROP_ID_MASK(const_prop->prop); lv_style_prop_t prop_id = LV_STYLE_PROP_ID_MASK(const_prop->prop);
if(prop_id == prop) { if(prop_id == prop) {
if(const_prop->prop & LV_STYLE_PROP_META_INHERIT) if(const_prop->prop & LV_STYLE_PROP_META_INHERIT)

View File

@ -757,9 +757,15 @@ static lv_coord_t get_angle(const lv_obj_t * obj)
angle += arc->indic_angle_start; angle += arc->indic_angle_start;
} }
else if(arc->type == LV_ARC_MODE_SYMMETRICAL) { else if(arc->type == LV_ARC_MODE_SYMMETRICAL) {
int32_t range_midpoint = (int32_t)(arc->min_value + arc->max_value) / 2; int16_t bg_end = arc->bg_angle_end;
if(arc->value < range_midpoint) angle += arc->indic_angle_start; if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360;
else angle += arc->indic_angle_end; int16_t indic_end = arc->indic_angle_end;
if(arc->indic_angle_end < arc->indic_angle_start) indic_end = arc->indic_angle_end + 360;
int32_t angle_midpoint = (int32_t)(arc->bg_angle_start + bg_end) / 2;
if(arc->indic_angle_start < angle_midpoint) angle += arc->indic_angle_start;
else if(indic_end > angle_midpoint) angle += arc->indic_angle_end;
else angle += angle_midpoint;
} }
return angle; return angle;

View File

@ -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; draw_dsc.antialias = antialias;
lv_area_t dest_area; lv_area_t dest_area;
dest_area.x1 = 0; dest_area.x1 = -offset_x;
dest_area.x2 = dest_img->header.w - 1; dest_area.x2 = dest_area.x1 + dest_img->header.w - 1;
dest_area.y1 = 0; dest_area.y1 = -offset_y;
dest_area.y2 = 0; dest_area.y2 = -offset_y;
lv_color_t * cbuf = lv_mem_alloc(dest_img->header.w * sizeof(lv_color_t)); 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)); 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); &draw_dsc, canvas->dsc.header.cf, cbuf, abuf);
for(x = 0; x < dest_img->header.w; x++) { 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]) { if(abuf[x]) {
lv_img_buf_set_px_color(dest_img, x + offset_x, y + offset_y, cbuf[x]); lv_img_buf_set_px_color(dest_img, x, y, cbuf[x]);
lv_img_buf_set_px_alpha(dest_img, x + offset_x, y + offset_y, abuf[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.y1++;
dest_area.y2++; dest_area.y2++;
} }

View File

@ -212,7 +212,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Make the point relative to the indicator*/ /*Make the point relative to the indicator*/
new_value = p.x - (obj->coords.x1 + bg_left); new_value = p.x - (obj->coords.x1 + bg_left);
} }
new_value = (new_value * range) / indic_w; new_value = (new_value * range + indic_w / 2) / indic_w;
new_value += slider->bar.min_value; new_value += slider->bar.min_value;
} }
else { else {
@ -223,7 +223,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*Make the point relative to the indicator*/ /*Make the point relative to the indicator*/
new_value = p.y - (obj->coords.y2 + bg_bottom); new_value = p.y - (obj->coords.y2 + bg_bottom);
new_value = (-new_value * range) / indic_h; new_value = (-new_value * range + indic_h / 2) / indic_h;
new_value += slider->bar.min_value; new_value += slider->bar.min_value;
} }
@ -238,7 +238,6 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
} }
new_value = LV_CLAMP(real_min_value, new_value, real_max_value); new_value = LV_CLAMP(real_min_value, new_value, real_max_value);
if(*slider->value_to_set != new_value) { if(*slider->value_to_set != new_value) {
*slider->value_to_set = new_value; *slider->value_to_set = new_value;
lv_obj_invalidate(obj); lv_obj_invalidate(obj);
@ -337,15 +336,16 @@ static void draw_knob(lv_event_t * e)
lv_area_t knob_area; lv_area_t knob_area;
lv_coord_t knob_size; lv_coord_t knob_size;
if(is_horizontal) {
knob_size = lv_obj_get_height(obj);
knob_area.x1 = LV_SLIDER_KNOB_COORD(is_rtl, slider->bar.indic_area);
}
else {
bool is_symmetrical = false; bool is_symmetrical = false;
if(slider->bar.mode == LV_BAR_MODE_SYMMETRICAL && slider->bar.min_value < 0 && if(slider->bar.mode == LV_BAR_MODE_SYMMETRICAL && slider->bar.min_value < 0 &&
slider->bar.max_value > 0) is_symmetrical = true; slider->bar.max_value > 0) is_symmetrical = true;
if(is_horizontal) {
knob_size = lv_obj_get_height(obj);
if(is_symmetrical && slider->bar.cur_value < 0) knob_area.x1 = slider->bar.indic_area.x1;
else knob_area.x1 = LV_SLIDER_KNOB_COORD(is_rtl, slider->bar.indic_area);
}
else {
knob_size = lv_obj_get_width(obj); knob_size = lv_obj_get_width(obj);
if(is_symmetrical && slider->bar.cur_value < 0) knob_area.y1 = slider->bar.indic_area.y2; if(is_symmetrical && slider->bar.cur_value < 0) knob_area.y1 = slider->bar.indic_area.y2;
else knob_area.y1 = slider->bar.indic_area.y1; else knob_area.y1 = slider->bar.indic_area.y1;