From 9bd86963c9a4f4471bf470d35e28d3873ac8b42d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 16 Apr 2020 21:22:06 -0400 Subject: [PATCH 01/12] Add note about header guard in lv_conf.h (#1347) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9e47f3ac..c8fd62131 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-s 1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library 2. Copy the `lvgl` folder into your project -3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. +3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors. 4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions. 5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL. 6. Call `lv_init()` From 9916253a6e08c102abe6125d484cde24dc260910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=B1=B3-=E9=BB=84=E9=BD=90?= <757509347@qq.com> Date: Fri, 17 Apr 2020 19:20:40 +0800 Subject: [PATCH 02/12] Fix build warnings (#1457) Signed-off-by: Huang Qi Change-Id: Iab6b1c9d64a865b16b6e39ddeaf7d7295ef74060 Co-authored-by: Huang Qi --- src/lv_draw/lv_draw_basic.c | 2 +- src/lv_objx/lv_img.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lv_draw/lv_draw_basic.c b/src/lv_draw/lv_draw_basic.c index 462e15224..875eb394b 100644 --- a/src/lv_draw/lv_draw_basic.c +++ b/src/lv_draw/lv_draw_basic.c @@ -530,7 +530,7 @@ void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint else { for(row = masked_a.y1; row <= masked_a.y2; row++) { #if LV_USE_GPU - if(disp->driver.gpu_blend_cb == false) { + if(disp->driver.gpu_blend_cb == NULL) { sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); } else { disp->driver.gpu_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); diff --git a/src/lv_objx/lv_img.c b/src/lv_objx/lv_img.c index bf0269f9e..02dc9b94c 100644 --- a/src/lv_objx/lv_img.c +++ b/src/lv_objx/lv_img.c @@ -355,8 +355,8 @@ static bool lv_img_design(lv_obj_t * img, const lv_area_t * mask, lv_design_mode if(ext->cf == LV_IMG_CF_TRUE_COLOR || ext->cf == LV_IMG_CF_RAW) cover = lv_area_is_in(mask, &img->coords); - const lv_style_t * style = lv_img_get_style(img, LV_IMG_STYLE_MAIN); - if(style->image.opa < LV_OPA_MAX) return false; + const lv_style_t * style_local = lv_img_get_style(img, LV_IMG_STYLE_MAIN); + if(style_local->image.opa < LV_OPA_MAX) return false; return cover; } else if(mode == LV_DESIGN_DRAW_MAIN) { From a1e8fd578f99259b6de6b418ea8a735c6aaa9a27 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 17 Apr 2020 08:10:31 -0400 Subject: [PATCH 03/12] lv_tabview: respect tab button's inactive state --- src/lv_objx/lv_tabview.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index ff5f24d2a..681ef8324 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -1006,6 +1006,8 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event) uint16_t btn_id = lv_btnm_get_active_btn(tab_btnm); if(btn_id == LV_BTNM_BTN_NONE) return; + + if(lv_btnm_get_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_INACTIVE)) return; lv_btnm_clear_btn_ctrl_all(tab_btnm, LV_BTNM_CTRL_TGL_STATE); lv_btnm_set_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_TGL_STATE); From e6f817e545b15e54bd14ba435d29394b06d30615 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:06:39 -0400 Subject: [PATCH 04/12] Fix swapped comments in `lv_slider.h` --- src/lv_objx/lv_slider.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lv_objx/lv_slider.h b/src/lv_objx/lv_slider.h index 967c8b688..5708e6380 100644 --- a/src/lv_objx/lv_slider.h +++ b/src/lv_objx/lv_slider.h @@ -93,10 +93,9 @@ static inline void lv_slider_set_range(lv_obj_t * slider, int16_t min, int16_t m } /** - * Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum - * position. - * @param slider pointer to a slider object - * @param en true: enable disable symmetric behavior; false: disable + * Set the animation time of the slider + * @param slider pointer to a bar object + * @param anim_time the animation time in milliseconds. */ static inline void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time) { @@ -104,9 +103,10 @@ static inline void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time } /** - * Set the animation time of the slider - * @param slider pointer to a bar object - * @param anim_time the animation time in milliseconds. + * Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum + * position. + * @param slider pointer to a slider object + * @param en true: enable disable symmetric behavior; false: disable */ static inline void lv_slider_set_sym(lv_obj_t * slider, bool en) { From 101470488b06c777b883175d3903e0f0df950559 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 19 Apr 2020 22:28:37 +0200 Subject: [PATCH 05/12] label: clip text to the real area while drawing (respect padding) --- src/lv_objx/lv_label.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index b413d1cbe..106f87bda 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -1065,7 +1065,13 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ sel.start = lv_label_get_text_sel_start(label); sel.end = lv_label_get_text_sel_end(label); - lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ext->offset, &sel, hint, lv_obj_get_base_dir(label)); + + lv_area_t mask2; + bool has_common; + has_common = lv_area_intersect(&mask2, &coords, mask); + if(!has_common) return false; + + lv_draw_label(&coords, &mask2, style, opa_scale, ext->text, flag, &ext->offset, &sel, hint, lv_obj_get_base_dir(label)); if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) { @@ -1081,14 +1087,14 @@ static bool lv_label_design(lv_obj_t * label, const lv_area_t * mask, lv_design_ lv_font_get_glyph_width(style->text.font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT; ofs.y = ext->offset.y; - lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label)); + lv_draw_label(&coords, &mask2, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label)); } /*Draw the text again below the original to make an circular effect */ if(size.y > lv_obj_get_height(label)) { ofs.x = ext->offset.x; ofs.y = ext->offset.y + size.y + lv_font_get_line_height(style->text.font); - lv_draw_label(&coords, mask, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label)); + lv_draw_label(&coords, &mask2, style, opa_scale, ext->text, flag, &ofs, &sel, NULL, lv_obj_get_base_dir(label)); } } } From cdf362868210d73af9e568b2638b462421c2e44a Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 19 Apr 2020 22:44:45 +0200 Subject: [PATCH 06/12] label: fix LV_LABEL_LONG_DOT --- src/lv_objx/lv_label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index 106f87bda..b8ebdf9a5 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -727,7 +727,7 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos) #if LV_USE_BIDI bidi_txt = lv_draw_get_buf(new_line_start - line_start + 1); uint16_t txt_len = new_line_start - line_start; - if(bidi_txt[new_line_start] == '\0') txt_len--; + if(txt[new_line_start] == '\0') txt_len--; lv_bidi_process_paragraph(txt + line_start, bidi_txt, txt_len, lv_obj_get_base_dir(label), NULL, 0); #else bidi_txt = (char*)txt + line_start; From d203c386b4325c44425318d668d56ca1c8a1f095 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 20 Apr 2020 14:24:45 +0200 Subject: [PATCH 07/12] fix build error --- src/lv_widgets/lv_tabview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lv_widgets/lv_tabview.c b/src/lv_widgets/lv_tabview.c index ab2d77875..ebfc0d4f2 100644 --- a/src/lv_widgets/lv_tabview.c +++ b/src/lv_widgets/lv_tabview.c @@ -782,7 +782,7 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event) uint16_t btn_id = lv_btnmatrix_get_active_btn(tab_btnm); if(btn_id == LV_BTNMATRIX_BTN_NONE) return; - if(lv_btnm_get_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_DISABLED)) return; + if(lv_btnmatrix_get_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_DISABLED)) return; lv_btnmatrix_clear_btn_ctrl_all(tab_btnm, LV_BTNMATRIX_CTRL_CHECK_STATE); lv_btnmatrix_set_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_CHECK_STATE); From f1058bbfe04f638bec9b73325410557297df4358 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 20 Apr 2020 14:52:10 +0200 Subject: [PATCH 08/12] remove file created when merging master --- src/lv_draw/lv_draw_basic.c | 783 ------------------------------------ 1 file changed, 783 deletions(-) delete mode 100644 src/lv_draw/lv_draw_basic.c diff --git a/src/lv_draw/lv_draw_basic.c b/src/lv_draw/lv_draw_basic.c deleted file mode 100644 index 875eb394b..000000000 --- a/src/lv_draw/lv_draw_basic.c +++ /dev/null @@ -1,783 +0,0 @@ -/** - * @file lv_draw_basic.c - * - */ - -#include "lv_draw_basic.h" - -#include -#include -#include - -#include "../lv_core/lv_refr.h" -#include "../lv_hal/lv_hal.h" -#include "../lv_font/lv_font.h" -#include "../lv_misc/lv_area.h" -#include "../lv_misc/lv_color.h" -#include "../lv_misc/lv_log.h" - -#include -#include "lv_draw.h" - -/********************* - * INCLUDES - *********************/ - -/********************* - * DEFINES - *********************/ - -/*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/ -#define VFILL_HW_ACC_SIZE_LIMIT 50 - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ -static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); -static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_t * fill_area, lv_color_t color, - lv_opa_t opa); - -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP -static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa); -#endif - -/********************** - * STATIC VARIABLES - **********************/ - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -/** - * Put a pixel in the Virtual Display Buffer - * @param x pixel x coordinate - * @param y pixel y coordinate - * @param mask_p fill only on this mask (truncated to VDB area) - * @param color pixel color - * @param opa opacity of the area (0..255) - */ -void lv_draw_px(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa) -{ - - if(opa < LV_OPA_MIN) return; - if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; - - /*Pixel out of the mask*/ - if(x < mask_p->x1 || x > mask_p->x2 || y < mask_p->y1 || y > mask_p->y2) { - return; - } - - lv_disp_t * disp = lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); - uint32_t vdb_width = lv_area_get_width(&vdb->area); - - /*Make the coordinates relative to VDB*/ - x -= vdb->area.x1; - y -= vdb->area.y1; - - if(disp->driver.set_px_cb) { - disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, x, y, color, opa); - } else { - bool scr_transp = false; -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - scr_transp = disp->driver.screen_transp; -#endif - - lv_color_t * vdb_px_p = vdb->buf_act; - vdb_px_p += y * vdb_width + x; - - if(scr_transp == false) { - if(opa == LV_OPA_COVER) { - *vdb_px_p = color; - } else { - *vdb_px_p = lv_color_mix(color, *vdb_px_p, opa); - } - } else { -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - *vdb_px_p = color_mix_2_alpha(*vdb_px_p, (*vdb_px_p).ch.alpha, color, opa); -#endif - } - } -} - -/** - * Fill an area in the Virtual Display Buffer - * @param cords_p coordinates of the area to fill - * @param mask_p fill only o this mask (truncated to VDB area) - * @param color fill color - * @param opa opacity of the area (0..255) - */ -void lv_draw_fill(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_color_t color, lv_opa_t opa) -{ - if(opa < LV_OPA_MIN) return; - if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; - - lv_area_t res_a; - bool union_ok; - - /*Get the union of cord and mask*/ - /* The mask is already truncated to the vdb size - * in 'lv_refr_area_with_vdb' function */ - union_ok = lv_area_intersect(&res_a, cords_p, mask_p); - - /*If there are common part of the three area then draw to the vdb*/ - if(union_ok == false) { - return; - } - - lv_disp_t * disp = lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); - - lv_area_t vdb_rel_a; /*Stores relative coordinates on vdb*/ - vdb_rel_a.x1 = res_a.x1 - vdb->area.x1; - vdb_rel_a.y1 = res_a.y1 - vdb->area.y1; - vdb_rel_a.x2 = res_a.x2 - vdb->area.x1; - vdb_rel_a.y2 = res_a.y2 - vdb->area.y1; - - lv_color_t * vdb_buf_tmp = vdb->buf_act; - uint32_t vdb_width = lv_area_get_width(&vdb->area); - /*Move the vdb_tmp to the first row*/ - vdb_buf_tmp += vdb_width * vdb_rel_a.y1; - -#if LV_USE_GPU - static LV_ATTRIBUTE_MEM_ALIGN lv_color_t color_array_tmp[LV_HOR_RES_MAX]; /*Used by 'lv_disp_mem_blend'*/ - static lv_coord_t last_width = -1; - - lv_coord_t w = lv_area_get_width(&vdb_rel_a); - /*Don't use hw. acc. for every small fill (because of the init overhead)*/ - if(w < VFILL_HW_ACC_SIZE_LIMIT) { - sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa); - } - /*Not opaque fill*/ - else if(opa == LV_OPA_COVER) { - /*Use hw fill if present*/ - if(disp->driver.gpu_fill_cb) { - disp->driver.gpu_fill_cb(&disp->driver, vdb->buf_act, vdb_width, &vdb_rel_a, color); - } - /*Use hw blend if present and the area is not too small*/ - else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT && disp->driver.gpu_blend_cb) { - /*Fill a one line sized buffer with a color and blend this later*/ - if(color_array_tmp[0].full != color.full || last_width != w) { - uint16_t i; - for(i = 0; i < w; i++) { - color_array_tmp[i].full = color.full; - } - last_width = w; - } - - /*Blend the filled line to every line VDB line-by-line*/ - lv_coord_t row; - for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) { - disp->driver.gpu_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); - vdb_buf_tmp += vdb_width; - } - - } - /*Else use sw fill if no better option*/ - else { - sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa); - } - - } - /*Fill with opacity*/ - else { - /*Use hw blend if present*/ - if(disp->driver.gpu_blend_cb) { - if(color_array_tmp[0].full != color.full || last_width != w) { - uint16_t i; - for(i = 0; i < w; i++) { - color_array_tmp[i].full = color.full; - } - - last_width = w; - } - lv_coord_t row; - for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) { - disp->driver.gpu_blend_cb(&disp->driver, &vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); - vdb_buf_tmp += vdb_width; - } - - } - /*Use sw fill with opa if no better option*/ - else { - sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa); - } - } -#else - sw_color_fill(vdb->buf_act, vdb_width, &vdb_rel_a, color, opa); -#endif -} - -/** - * Draw a letter in the Virtual Display Buffer - * @param pos_p left-top coordinate of the latter - * @param mask_p the letter will be drawn only on this area (truncated to VDB area) - * @param font_p pointer to font - * @param letter a letter to draw - * @param color color of letter - * @param opa opacity of letter (0..255) - */ -void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * mask_p, const lv_font_t * font_p, uint32_t letter, - lv_color_t color, lv_opa_t opa) -{ - /*clang-format off*/ - const uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/ - const uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/ - const uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/ - 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255}; - /*clang-format on*/ - - if(opa < LV_OPA_MIN) return; - if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; - - if(font_p == NULL) { - LV_LOG_WARN("Font: character's bitmap not found"); - return; - } - - lv_font_glyph_dsc_t g; - bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0'); - if(g_ret == false) return; - - - lv_coord_t pos_x = pos_p->x + g.ofs_x; - lv_coord_t pos_y = pos_p->y + (font_p->line_height - font_p->base_line) - g.box_h - g.ofs_y; - - const uint8_t * bpp_opa_table; - uint8_t bitmask_init; - uint8_t bitmask; - - /*bpp = 3 should be converted to bpp = 4 in lv_font_get_glyph_bitmap */ - if(g.bpp == 3) g.bpp = 4; - - switch(g.bpp) { - case 1: - bpp_opa_table = bpp1_opa_table; - bitmask_init = 0x80; - break; - case 2: - bpp_opa_table = bpp2_opa_table; - bitmask_init = 0xC0; - break; - case 4: - bpp_opa_table = bpp4_opa_table; - bitmask_init = 0xF0; - break; - case 8: - bpp_opa_table = NULL; - bitmask_init = 0xFF; - break; /*No opa table, pixel value will be used directly*/ - default: return; /*Invalid bpp. Can't render the letter*/ - } - - const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter); - - if(map_p == NULL) return; - - /*If the letter is completely out of mask don't draw it */ - if(pos_x + g.box_w < mask_p->x1 || pos_x > mask_p->x2 || pos_y + g.box_h < mask_p->y1 || pos_y > mask_p->y2) return; - - lv_disp_t * disp = lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); - - lv_coord_t vdb_width = lv_area_get_width(&vdb->area); - lv_color_t * vdb_buf_tmp = vdb->buf_act; - lv_coord_t col, row; - - uint8_t width_byte_scr = g.box_w >> 3; /*Width in bytes (on the screen finally) (e.g. w = 11 -> 2 bytes wide)*/ - if(g.box_w & 0x7) width_byte_scr++; - uint16_t width_bit = g.box_w * g.bpp; /*Letter width in bits*/ - - bool subpx = font_p->subpx == LV_FONT_SUBPX_NONE ? false : true; - - /* Calculate the col/row start/end on the map*/ - lv_coord_t col_start; - lv_coord_t col_end; - lv_coord_t row_start; - lv_coord_t row_end; - - if(subpx == false) { - col_start = pos_x >= mask_p->x1 ? 0 : mask_p->x1 - pos_x; - col_end = pos_x + g.box_w <= mask_p->x2 ? g.box_w : mask_p->x2 - pos_x + 1; - row_start = pos_y >= mask_p->y1 ? 0 : mask_p->y1 - pos_y; - row_end = pos_y + g.box_h <= mask_p->y2 ? g.box_h : mask_p->y2 - pos_y + 1; - } else { - col_start = pos_x >= mask_p->x1 ? 0 : (mask_p->x1 - pos_x) * 3; - col_end = pos_x + g.box_w / 3 <= mask_p->x2 ? g.box_w : (mask_p->x2 - pos_x + 1) * 3; - row_start = pos_y >= mask_p->y1 ? 0 : mask_p->y1 - pos_y; - row_end = pos_y + g.box_h <= mask_p->y2 ? g.box_h : mask_p->y2 - pos_y + 1; - } - - /*Set a pointer on VDB to the first pixel of the letter*/ - vdb_buf_tmp += ((pos_y - vdb->area.y1) * vdb_width) + pos_x - vdb->area.x1; - - /*If the letter is partially out of mask the move there on VDB*/ - if(subpx) vdb_buf_tmp += (row_start * vdb_width) + col_start / 3; - else vdb_buf_tmp += (row_start * vdb_width) + col_start; - - /*Move on the map too*/ - uint32_t bit_ofs = (row_start * width_bit) + (col_start * g.bpp); - map_p += bit_ofs >> 3; - - uint8_t letter_px; - lv_opa_t px_opa = 0; - uint16_t col_bit; - col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */ - - bool scr_transp = false; -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - scr_transp = disp->driver.screen_transp; -#endif - - uint8_t font_rgb[3]; - uint8_t txt_rgb[3] = {LV_COLOR_GET_R(color), LV_COLOR_GET_G(color), LV_COLOR_GET_B(color)}; - - for(row = row_start; row < row_end; row++) { - bitmask = bitmask_init >> col_bit; - uint8_t sub_px_cnt = 0; - for(col = col_start; col < col_end; col++) { - letter_px = (*map_p & bitmask) >> (8 - col_bit - g.bpp); - - /*subpx == 0*/ - if(subpx == false) { - if(letter_px != 0) { - if(opa == LV_OPA_COVER) { - px_opa = g.bpp == 8 ? letter_px : bpp_opa_table[letter_px]; - } else { - px_opa = g.bpp == 8 ? (uint16_t)((uint16_t)letter_px * opa) >> 8 - : (uint16_t)((uint16_t)bpp_opa_table[letter_px] * opa) >> 8; - } - - if(disp->driver.set_px_cb) { - disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, - (col + pos_x) - vdb->area.x1, (row + pos_y) - vdb->area.y1, color, px_opa); - } else if(vdb_buf_tmp->full != color.full) { - if(px_opa > LV_OPA_MAX) { - *vdb_buf_tmp = color; - } else if(px_opa > LV_OPA_MIN) { - if(scr_transp == false) { - *vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, px_opa); - } else { -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - *vdb_buf_tmp = color_mix_2_alpha(*vdb_buf_tmp, (*vdb_buf_tmp).ch.alpha, color, px_opa); -#endif - } - } - } - } - vdb_buf_tmp++; - } - /*Handle subpx drawing*/ - else { - if(letter_px != 0) { - if(opa == LV_OPA_COVER) { - px_opa = g.bpp == 8 ? letter_px : bpp_opa_table[letter_px]; - } else { - px_opa = g.bpp == 8 ? (uint16_t)((uint16_t)letter_px * opa) >> 8 - : (uint16_t)((uint16_t)bpp_opa_table[letter_px] * opa) >> 8; - } - - font_rgb[sub_px_cnt] = px_opa; - } else { - font_rgb[sub_px_cnt] = 0; - } - sub_px_cnt ++; - - if(sub_px_cnt == 3) { - lv_color_t res_color; - - if(font_rgb[0] == 0 && font_rgb[1] == 0 && font_rgb[2] == 0) { - res_color = *vdb_buf_tmp; - } else { - - uint8_t bg_rgb[3] = {LV_COLOR_GET_R(*vdb_buf_tmp), LV_COLOR_GET_G(*vdb_buf_tmp), LV_COLOR_GET_B(*vdb_buf_tmp)}; - -#if LV_FONT_SUBPX_BGR - LV_COLOR_SET_B(res_color, (uint16_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[2] * (255 - font_rgb[0]))) >> 8); - LV_COLOR_SET_R(res_color, (uint16_t)((uint16_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[0] * (255 - font_rgb[2]))) >> 8); -#else - LV_COLOR_SET_R(res_color, (uint16_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8); - LV_COLOR_SET_B(res_color, (uint16_t)((uint16_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8); -#endif - LV_COLOR_SET_G(res_color, (uint16_t)((uint16_t)txt_rgb[1] * font_rgb[1] + (bg_rgb[1] * (255 - font_rgb[1]))) >> 8); - } - if(scr_transp == false) { - vdb_buf_tmp->full = res_color.full; -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - } else { - *vdb_buf_tmp = color_mix_2_alpha(*vdb_buf_tmp, (*vdb_buf_tmp).ch.alpha, color, px_opa); -#endif - } - sub_px_cnt = 0; - vdb_buf_tmp++; - } - } - - - if(col_bit < 8 - g.bpp) { - col_bit += g.bpp; - bitmask = bitmask >> g.bpp; - } else { - col_bit = 0; - bitmask = bitmask_init; - map_p++; - } - } - - col_bit += ((g.box_w - col_end) + col_start) * g.bpp; - - map_p += (col_bit >> 3); - col_bit = col_bit & 0x7; - - /*Next row in VDB*/ - if(subpx) vdb_buf_tmp += vdb_width - (col_end - col_start) / 3; - else vdb_buf_tmp += vdb_width - (col_end - col_start); - } -} - -/** - * Draw a color map to the display (image) - * @param cords_p coordinates the color map - * @param mask_p the map will drawn only on this area (truncated to VDB area) - * @param map_p pointer to a lv_color_t array - * @param opa opacity of the map - * @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels - * @param alpha_byte true: extra alpha byte is inserted for every pixel - * @param recolor mix the pixels with this color - * @param recolor_opa the intense of recoloring - */ -void lv_draw_map(const lv_area_t * cords_p, const lv_area_t * mask_p, const uint8_t * map_p, lv_opa_t opa, - bool chroma_key, bool alpha_byte, lv_color_t recolor, lv_opa_t recolor_opa) -{ - - if(opa < LV_OPA_MIN) return; - if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; - - lv_area_t masked_a; - bool union_ok; - - /*Get the union of map size and mask*/ - /* The mask is already truncated to the vdb size - * in 'lv_refr_area_with_vdb' function */ - union_ok = lv_area_intersect(&masked_a, cords_p, mask_p); - - /*If there are common part of the three area then draw to the vdb*/ - if(union_ok == false) return; - - /*The pixel size in byte is different if an alpha byte is added too*/ - uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t); - - /*If the map starts OUT of the masked area then calc. the first pixel*/ - lv_coord_t map_width = lv_area_get_width(cords_p); - if(cords_p->y1 < masked_a.y1) { - map_p += (uint32_t)map_width * ((masked_a.y1 - cords_p->y1)) * px_size_byte; - } - if(cords_p->x1 < masked_a.x1) { - map_p += (masked_a.x1 - cords_p->x1) * px_size_byte; - } - - lv_disp_t * disp = lv_refr_get_disp_refreshing(); - lv_disp_buf_t * vdb = lv_disp_get_buf(disp); - - /*Stores coordinates relative to the current VDB*/ - masked_a.x1 = masked_a.x1 - vdb->area.x1; - masked_a.y1 = masked_a.y1 - vdb->area.y1; - masked_a.x2 = masked_a.x2 - vdb->area.x1; - masked_a.y2 = masked_a.y2 - vdb->area.y1; - - lv_coord_t vdb_width = lv_area_get_width(&vdb->area); - lv_color_t * vdb_buf_tmp = vdb->buf_act; - vdb_buf_tmp += (uint32_t)vdb_width * masked_a.y1; /*Move to the first row*/ - vdb_buf_tmp += (uint32_t)masked_a.x1; /*Move to the first col*/ - - lv_coord_t row; - lv_coord_t map_useful_w = lv_area_get_width(&masked_a); - - bool scr_transp = false; -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - scr_transp = disp->driver.screen_transp; -#endif - - /*The simplest case just copy the pixels into the VDB*/ - if(chroma_key == false && alpha_byte == false && opa == LV_OPA_COVER && recolor_opa == LV_OPA_TRANSP) { - - /*Use the custom VDB write function is exists*/ - if(disp->driver.set_px_cb) { - lv_coord_t col; - for(row = masked_a.y1; row <= masked_a.y2; row++) { - for(col = 0; col < map_useful_w; col++) { - lv_color_t px_color = *((lv_color_t *)&map_p[(uint32_t)col * px_size_byte]); - disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, row, - px_color, opa); - } - map_p += map_width * px_size_byte; /*Next row on the map*/ - } - } - /*Normal native VDB*/ - else { - for(row = masked_a.y1; row <= masked_a.y2; row++) { -#if LV_USE_GPU - if(disp->driver.gpu_blend_cb == NULL) { - sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); - } else { - disp->driver.gpu_blend_cb(&disp->driver, vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); - } -#else - sw_mem_blend(vdb_buf_tmp, (lv_color_t *)map_p, map_useful_w, opa); -#endif - map_p += map_width * px_size_byte; /*Next row on the map*/ - vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ - } - } - } - - /*In the other cases every pixel need to be checked one-by-one*/ - else { - - lv_coord_t col; - lv_color_t last_img_px = LV_COLOR_BLACK; - lv_color_t recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa); - for(row = masked_a.y1; row <= masked_a.y2; row++) { - for(col = 0; col < map_useful_w; col++) { - lv_opa_t opa_result = opa; - uint8_t * px_color_p = (uint8_t *)&map_p[(uint32_t)col * px_size_byte]; - lv_color_t px_color; - - /*Calculate with the pixel level alpha*/ - if(alpha_byte) { -#if LV_COLOR_DEPTH == 8 || LV_COLOR_DEPTH == 1 - px_color.full = px_color_p[0]; -#elif LV_COLOR_DEPTH == 16 - /*Because of Alpha byte 16 bit color can start on odd address which can cause - * crash*/ - px_color.full = px_color_p[0] + (px_color_p[1] << 8); -#elif LV_COLOR_DEPTH == 32 - px_color = *((lv_color_t *)px_color_p); -#endif - lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1); - if(px_opa == LV_OPA_TRANSP) - continue; - else if(px_opa != LV_OPA_COVER) - opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8; - } else { - px_color = *((lv_color_t *)px_color_p); - } - - /*Handle chroma key*/ - if(chroma_key && px_color.full == disp->driver.color_chroma_key.full) continue; - - /*Re-color the pixel if required*/ - if(recolor_opa != LV_OPA_TRANSP) { - if(last_img_px.full != px_color.full) { /*Minor acceleration: calculate only for - new colors (save the last)*/ - last_img_px = px_color; - recolored_px = lv_color_mix(recolor, last_img_px, recolor_opa); - } - /*Handle custom VDB write is present*/ - if(disp->driver.set_px_cb) { - disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, - row, recolored_px, opa_result); - } - /*Normal native VDB write*/ - else { - if(opa_result == LV_OPA_COVER) - vdb_buf_tmp[col].full = recolored_px.full; - else - vdb_buf_tmp[col] = lv_color_mix(recolored_px, vdb_buf_tmp[col], opa_result); - } - } else { - /*Handle custom VDB write is present*/ - if(disp->driver.set_px_cb) { - disp->driver.set_px_cb(&disp->driver, (uint8_t *)vdb->buf_act, vdb_width, col + masked_a.x1, - row, px_color, opa_result); - } - /*Normal native VDB write*/ - else { - - if(opa_result == LV_OPA_COVER) - vdb_buf_tmp[col] = px_color; - else { - if(scr_transp == false) { - vdb_buf_tmp[col] = lv_color_mix(px_color, vdb_buf_tmp[col], opa_result); - } else { -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - vdb_buf_tmp[col] = color_mix_2_alpha(vdb_buf_tmp[col], vdb_buf_tmp[col].ch.alpha, - px_color, opa_result); -#endif - } - } - } - } - } - - map_p += map_width * px_size_byte; /*Next row on the map*/ - vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ - } - } -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -/** - * Blend pixels to destination memory using opacity - * @param dest a memory address. Copy 'src' here. - * @param src pointer to pixel map. Copy it to 'dest'. - * @param length number of pixels in 'src' - * @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover) - */ -static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) -{ - if(opa == LV_OPA_COVER) { - memcpy(dest, src, length * sizeof(lv_color_t)); - } else { - uint32_t col; - for(col = 0; col < length; col++) { - dest[col] = lv_color_mix(src[col], dest[col], opa); - } - } -} - -/** - * Fill an area with a color - * @param mem a memory address. Considered to a rectangular window according to 'mem_area' - * @param mem_width width of the 'mem' buffer - * @param fill_area coordinates of an area to fill. Relative to 'mem_area'. - * @param color fill color - * @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover) - */ -static void sw_color_fill(lv_color_t * mem, lv_coord_t mem_width, const lv_area_t * fill_area, lv_color_t color, - lv_opa_t opa) -{ - /*Set all row in vdb to the given color*/ - lv_coord_t row; - lv_coord_t col; - - lv_disp_t * disp = lv_refr_get_disp_refreshing(); - if(disp->driver.set_px_cb) { - for(col = fill_area->x1; col <= fill_area->x2; col++) { - for(row = fill_area->y1; row <= fill_area->y2; row++) { - disp->driver.set_px_cb(&disp->driver, (uint8_t *)mem, mem_width, col, row, color, opa); - } - } - } else { - mem += fill_area->y1 * mem_width; /*Go to the first row*/ - - /*Run simpler function without opacity*/ - if(opa == LV_OPA_COVER) { - - /*Fill the first row with 'color'*/ - for(col = fill_area->x1; col <= fill_area->x2; col++) { - mem[col] = color; - } - - /*Copy the first row to all other rows*/ - lv_color_t * mem_first = &mem[fill_area->x1]; - lv_coord_t copy_size = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t); - mem += mem_width; - - for(row = fill_area->y1 + 1; row <= fill_area->y2; row++) { - memcpy(&mem[fill_area->x1], mem_first, copy_size); - mem += mem_width; - } - } - /*Calculate with alpha too*/ - else { - bool scr_transp = false; -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - scr_transp = disp->driver.screen_transp; -#endif - - lv_color_t bg_tmp = LV_COLOR_BLACK; - lv_color_t opa_tmp = lv_color_mix(color, bg_tmp, opa); - for(row = fill_area->y1; row <= fill_area->y2; row++) { - for(col = fill_area->x1; col <= fill_area->x2; col++) { - if(scr_transp == false) { - /*If the bg color changed recalculate the result color*/ - if(mem[col].full != bg_tmp.full) { - bg_tmp = mem[col]; - opa_tmp = lv_color_mix(color, bg_tmp, opa); - } - - mem[col] = opa_tmp; - - } else { -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP - mem[col] = color_mix_2_alpha(mem[col], mem[col].ch.alpha, color, opa); -#endif - } - } - mem += mem_width; - } - } - } -} - -#if LV_COLOR_DEPTH == 32 && LV_COLOR_SCREEN_TRANSP -/** - * Mix two colors. Both color can have alpha value. It requires ARGB888 colors. - * @param bg_color background color - * @param bg_opa alpha of the background color - * @param fg_color foreground color - * @param fg_opa alpha of the foreground color - * @return the mixed color. the alpha channel (color.alpha) contains the result alpha - */ -static inline lv_color_t color_mix_2_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa) -{ - /* Pick the foreground if it's fully opaque or the Background is fully transparent*/ - if(fg_opa > LV_OPA_MAX || bg_opa <= LV_OPA_MIN) { - fg_color.ch.alpha = fg_opa; - return fg_color; - } - /*Transparent foreground: use the Background*/ - else if(fg_opa <= LV_OPA_MIN) { - return bg_color; - } - /*Opaque background: use simple mix*/ - else if(bg_opa >= LV_OPA_MAX) { - return lv_color_mix(fg_color, bg_color, fg_opa); - } - /*Both colors have alpha. Expensive calculation need to be applied*/ - else { - /*Save the parameters and the result. If they will be asked again don't compute again*/ - static lv_opa_t fg_opa_save = 0; - static lv_opa_t bg_opa_save = 0; - static lv_color_t fg_color_save = {{0}}; - static lv_color_t bg_color_save = {{0}}; - static lv_color_t c = {{0}}; - - if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full || - bg_color.full != bg_color_save.full) { - fg_opa_save = fg_opa; - bg_opa_save = bg_opa; - fg_color_save.full = fg_color.full; - bg_color_save.full = bg_color.full; - /*Info: - * https://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator*/ - lv_opa_t alpha_res = 255 - ((uint16_t)((uint16_t)(255 - fg_opa) * (255 - bg_opa)) >> 8); - if(alpha_res == 0) { - while(1) - ; - } - lv_opa_t ratio = (uint16_t)((uint16_t)fg_opa * 255) / alpha_res; - c = lv_color_mix(fg_color, bg_color, ratio); - c.ch.alpha = alpha_res; - } - return c; - } -} -#endif From b3a8fb96503d5e6a68f247f2ec814e9c7d7d0cd0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 21 Apr 2020 11:36:05 +0200 Subject: [PATCH 09/12] minor renames and fixes --- src/lv_draw/lv_draw_blend.c | 2 +- src/lv_themes/lv_theme_material.c | 20 ++++++++++---------- src/lv_themes/lv_theme_mono.c | 20 ++++++++++---------- src/lv_widgets/lv_dropdown.c | 4 ++-- src/lv_widgets/lv_list.h | 4 ++-- src/lv_widgets/lv_page.c | 26 +++++++++++++------------- src/lv_widgets/lv_page.h | 4 ++-- src/lv_widgets/lv_roller.c | 2 +- src/lv_widgets/lv_tabview.c | 16 ++++++++-------- src/lv_widgets/lv_textarea.c | 2 +- src/lv_widgets/lv_textarea.h | 2 +- src/lv_widgets/lv_tileview.c | 2 +- src/lv_widgets/lv_tileview.h | 2 +- src/lv_widgets/lv_win.c | 12 ++++++------ src/lv_widgets/lv_win.h | 4 ++-- tests/Makefile | 2 +- tests/build.py | 3 ++- 17 files changed, 64 insertions(+), 63 deletions(-) diff --git a/src/lv_draw/lv_draw_blend.c b/src/lv_draw/lv_draw_blend.c index 0128eb3e6..6757034f2 100644 --- a/src/lv_draw/lv_draw_blend.c +++ b/src/lv_draw/lv_draw_blend.c @@ -860,11 +860,11 @@ static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color fg.ch.red = LV_MATH_MIN(tmp, 255); #endif - tmp = bg.ch.green + fg.ch.green; #if LV_COLOR_DEPTH == 8 fg.ch.green = LV_MATH_MIN(tmp, 7); #elif LV_COLOR_DEPTH == 16 #if LV_COLOR_16_SWAP == 0 + tmp = bg.ch.green + fg.ch.green; fg.ch.green = LV_MATH_MIN(tmp, 63); #else tmp = (bg.ch.green_h << 3) + bg.ch.green_l + (fg.ch.green_h << 3) + fg.ch.green_l; diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 47d6afdab..2b9762b68 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -1095,12 +1095,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG); lv_style_list_add_style(list, &bg); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); lv_style_list_add_style(list, &pad_inner); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR); lv_style_list_add_style(list, &sb); break; #endif @@ -1128,8 +1128,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) case LV_THEME_TABVIEW_PAGE: lv_obj_clean_style_list(obj, LV_PAGE_PART_BG); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); lv_style_list_add_style(list, &tabview_page_scrl); break; @@ -1265,12 +1265,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_WIN_PART_BG); lv_style_list_add_style(list, &scr); - lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR); lv_style_list_add_style(list, &sb); - lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL); - list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL); + lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE); lv_style_list_add_style(list, &tabview_page_scrl); lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER); diff --git a/src/lv_themes/lv_theme_mono.c b/src/lv_themes/lv_theme_mono.c index 0c6b7c5fe..fed09f973 100644 --- a/src/lv_themes/lv_theme_mono.c +++ b/src/lv_themes/lv_theme_mono.c @@ -760,12 +760,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG); lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); lv_style_list_add_style(list, &style_pad_inner); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR); lv_style_list_add_style(list, &style_sb); break; #endif @@ -794,8 +794,8 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name) case LV_THEME_TABVIEW_PAGE: lv_obj_clean_style_list(obj, LV_PAGE_PART_BG); - lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); - list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE); lv_style_list_add_style(list, &style_pad_normal); break; @@ -939,12 +939,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_WIN_PART_BG); lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR); - list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR); + lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR); lv_style_list_add_style(list, &style_sb); - lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL); - list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL); + lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE); lv_style_list_add_style(list, &style_bg); lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER); diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index a2f434189..8db9cb374 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -604,8 +604,8 @@ void lv_dropdown_open(lv_obj_t * ddlist) lv_obj_set_signal_cb(lv_page_get_scrl(ext->page), lv_dropdown_page_scrl_signal); lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_BG), &ext->style_page); - lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRLBAR), &ext->style_scrlbar); - lv_obj_clean_style_list(ext->page, LV_PAGE_PART_SCRL); + lv_style_list_copy(lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR), &ext->style_scrlbar); + lv_obj_clean_style_list(ext->page, LV_PAGE_PART_SCROLLABLE); lv_obj_refresh_style(ext->page, LV_STYLE_PROP_ALL); lv_page_set_scrl_fit(ext->page, LV_FIT_TIGHT); diff --git a/src/lv_widgets/lv_list.h b/src/lv_widgets/lv_list.h index 2c965044d..0c539cf46 100644 --- a/src/lv_widgets/lv_list.h +++ b/src/lv_widgets/lv_list.h @@ -57,10 +57,10 @@ typedef struct { /** List styles. */ enum { LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */ - LV_LIST_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR, /**< List scrollbar style. */ + LV_LIST_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */ LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */ _LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST, - LV_LIST_PART_SCRL = LV_PAGE_PART_SCRL, /**< List scrollable area style. */ + LV_LIST_PART_SCRL = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */ _LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST, }; typedef uint8_t lv_list_style_t; diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index deb23ea07..6b5e981ba 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -391,7 +391,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span) { lv_coord_t obj_w = lv_page_get_width_fit(page); - lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCRL); + lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE); lv_coord_t r = (obj_w - (div - 1) * pinner) / div; @@ -413,7 +413,7 @@ lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span) lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span) { lv_coord_t obj_h = lv_page_get_height_fit(page); - lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCRL); + lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE); lv_coord_t r = (obj_h - (div - 1) * pinner) / div; @@ -704,7 +704,7 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar /*Draw the scrollbars*/ lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); - lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCRLBAR, &rect_dsc); + lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCROLLBAR, &rect_dsc); if(ext->scrlbar.hor_draw && (ext->scrlbar.mode & LV_SCRLBAR_MODE_HIDE) == 0) { lv_draw_rect(&sb_hor_area, clip_area, &rect_dsc); } @@ -781,7 +781,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_GET_STATE_DSC) { lv_get_state_info_t * info = param; - if(info->part == LV_PAGE_PART_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN); + if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN); else info->result = lv_obj_get_state(page, info->part); return LV_RES_OK; } @@ -802,7 +802,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } } - lv_obj_clean_style_list(page, LV_PAGE_PART_SCRLBAR); + lv_obj_clean_style_list(page, LV_PAGE_PART_SCROLLBAR); #if LV_USE_ANIMATION lv_obj_clean_style_list(page, LV_PAGE_PART_EDGE_FLASH); #endif @@ -853,7 +853,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } } else if(sign == LV_SIGNAL_STYLE_CHG) { - lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR); lv_area_set_height(&ext->scrlbar.hor_area, sb_width); lv_area_set_width(&ext->scrlbar.ver_area, sb_width); @@ -1091,10 +1091,10 @@ static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part) case LV_PAGE_PART_BG: style_dsc_p = &page->style_list; break; - case LV_PAGE_PART_SCRL: + case LV_PAGE_PART_SCROLLABLE: style_dsc_p = lv_obj_get_style_list(ext->scrl, LV_CONT_PART_MAIN); break; - case LV_PAGE_PART_SCRLBAR: + case LV_PAGE_PART_SCROLLBAR: style_dsc_p = &ext->scrlbar.style; break; #if LV_USE_ANIMATION @@ -1190,9 +1190,9 @@ static void scrlbar_refresh(lv_obj_t * page) lv_coord_t obj_w = lv_obj_get_width(page); lv_coord_t obj_h = lv_obj_get_height(page); - lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR); - lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR); - lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR); + lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR); + lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR); lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); @@ -1314,8 +1314,8 @@ static void scrlbar_refresh(lv_obj_t * page) static void refr_ext_draw_pad(lv_obj_t * page) { - lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR); - lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR); + lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR); /*Ensure ext. size for the scrollbars if they are out of the page*/ if(page->ext_draw_pad < (-sb_right)) page->ext_draw_pad = -sb_right; diff --git a/src/lv_widgets/lv_page.h b/src/lv_widgets/lv_page.h index 94f008643..367f3c6b0 100644 --- a/src/lv_widgets/lv_page.h +++ b/src/lv_widgets/lv_page.h @@ -85,11 +85,11 @@ typedef struct { enum { LV_PAGE_PART_BG = LV_CONT_PART_MAIN, - LV_PAGE_PART_SCRLBAR = _LV_OBJ_PART_VIRTUAL_LAST, + LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST, LV_PAGE_PART_EDGE_FLASH, _LV_PAGE_PART_VIRTUAL_LAST, - LV_PAGE_PART_SCRL = _LV_OBJ_PART_REAL_LAST, + LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST, _LV_PAGE_PART_REAL_LAST, }; typedef uint8_t lv_part_style_t; diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index 910329d9e..31ce0daaf 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -111,7 +111,7 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal); - lv_obj_clean_style_list(roller, LV_PAGE_PART_SCRL); /*Use a transparent scrollable*/ + lv_obj_clean_style_list(roller, LV_PAGE_PART_SCROLLABLE); /*Use a transparent scrollable*/ lv_theme_apply(roller, LV_THEME_ROLLER); refr_height(roller); diff --git a/src/lv_widgets/lv_tabview.c b/src/lv_widgets/lv_tabview.c index ebfc0d4f2..a3553ab8a 100644 --- a/src/lv_widgets/lv_tabview.c +++ b/src/lv_widgets/lv_tabview.c @@ -176,10 +176,10 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) for(i = 0; i < copy_ext->tab_cnt; i++) { lv_obj_t * new_tab = lv_tabview_add_tab(tabview, copy_ext->tab_name_ptr[i]); lv_obj_t * copy_tab = lv_tabview_get_tab(copy, i); - lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCRL), lv_obj_get_style_list(copy_tab, - LV_PAGE_PART_SCRL)); - lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCRLBAR), lv_obj_get_style_list(copy_tab, - LV_PAGE_PART_SCRLBAR)); + lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLABLE), lv_obj_get_style_list(copy_tab, + LV_PAGE_PART_SCROLLABLE)); + lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLBAR), lv_obj_get_style_list(copy_tab, + LV_PAGE_PART_SCROLLBAR)); lv_obj_refresh_style(new_tab, LV_STYLE_PROP_ALL); } @@ -340,8 +340,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an } lv_coord_t cont_x; - lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCRL); - lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCRL); + lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCROLLABLE); + lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCROLLABLE); switch(ext->btns_pos) { default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/ @@ -599,7 +599,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG); else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN); else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN); - else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCRL); + else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCROLLABLE); return LV_RES_OK; } @@ -751,7 +751,7 @@ static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part) style_dsc_p = &tabview->style_list; break; case LV_TABVIEW_PART_BG_SCRL: - style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCRL); + style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCROLLABLE); break; case LV_TABVIEW_PART_TAB_BG: style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BG); diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index 3099e0fc2..1c5da595f 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -150,7 +150,7 @@ lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_size(ta, LV_TEXTAREA_DEF_WIDTH, LV_TEXTAREA_DEF_HEIGHT); lv_textarea_set_sb_mode(ta, LV_SCRLBAR_MODE_DRAG); - lv_obj_reset_style_list(ta, LV_PAGE_PART_SCRL); + lv_obj_reset_style_list(ta, LV_PAGE_PART_SCROLLABLE); lv_theme_apply(ta, LV_THEME_TEXTAREA); } diff --git a/src/lv_widgets/lv_textarea.h b/src/lv_widgets/lv_textarea.h index 4b14c6f75..47ff097df 100644 --- a/src/lv_widgets/lv_textarea.h +++ b/src/lv_widgets/lv_textarea.h @@ -78,7 +78,7 @@ typedef struct { /** Possible text areas tyles. */ enum { LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */ - LV_TEXTAREA_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR, /**< Scrollbar style */ + LV_TEXTAREA_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */ LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */ LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */ LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */ diff --git a/src/lv_widgets/lv_tileview.c b/src/lv_widgets/lv_tileview.c index 0a8da77db..56792049f 100644 --- a/src/lv_widgets/lv_tileview.c +++ b/src/lv_widgets/lv_tileview.c @@ -118,7 +118,7 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT); - lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCRL); + lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCROLLABLE); lv_theme_apply(new_tileview, LV_THEME_TILEVIEW); } /*Copy an existing tileview*/ diff --git a/src/lv_widgets/lv_tileview.h b/src/lv_widgets/lv_tileview.h index 5b0b3e619..78d2370bc 100644 --- a/src/lv_widgets/lv_tileview.h +++ b/src/lv_widgets/lv_tileview.h @@ -46,7 +46,7 @@ typedef struct { /*Parts of the Tileview*/ enum { LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG, - LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR, + LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCROLLBAR, LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, _LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST, _LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST diff --git a/src/lv_widgets/lv_win.c b/src/lv_widgets/lv_win.c index 36dceb689..0bae32554 100644 --- a/src/lv_widgets/lv_win.c +++ b/src/lv_widgets/lv_win.c @@ -544,9 +544,9 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_GET_STATE_DSC) { lv_win_ext_t * ext = lv_obj_get_ext_attr(win); lv_get_state_info_t * info = param; - if(info->part == LV_WIN_PART_CONTENT_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page), + if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page), LV_CONT_PART_MAIN); - else if(info->part == LV_WIN_PART_SCRLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCRLBAR); + else if(info->part == LV_WIN_PART_SCROLLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCROLLBAR); else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN); return LV_RES_OK; } @@ -616,11 +616,11 @@ static lv_style_list_t * lv_win_get_style(lv_obj_t * win, uint8_t part) case LV_WIN_PART_HEADER: style_dsc_p = lv_obj_get_style_list(ext->header, LV_OBJ_PART_MAIN); break; - case LV_WIN_PART_SCRLBAR: - style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRLBAR); + case LV_WIN_PART_SCROLLBAR: + style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR); break; - case LV_WIN_PART_CONTENT_SCRL: - style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCRL); + case LV_WIN_PART_CONTENT_SCROLLABLE: + style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLABLE); break; default: style_dsc_p = NULL; diff --git a/src/lv_widgets/lv_win.h b/src/lv_widgets/lv_win.h index 96923af64..ebb9e3d64 100644 --- a/src/lv_widgets/lv_win.h +++ b/src/lv_widgets/lv_win.h @@ -64,8 +64,8 @@ enum { LV_WIN_PART_BG = LV_OBJ_PART_MAIN, /**< Window object background style. */ _LV_WIN_PART_VIRTUAL_LAST, LV_WIN_PART_HEADER = _LV_OBJ_PART_REAL_LAST, /**< Window titlebar background style. */ - LV_WIN_PART_CONTENT_SCRL, /**< Window content style. */ - LV_WIN_PART_SCRLBAR, /**< Window scrollbar style. */ + LV_WIN_PART_CONTENT_SCROLLABLE, /**< Window content style. */ + LV_WIN_PART_SCROLLBAR, /**< Window scrollbar style. */ _LV_WIN_PART_REAL_LAST }; diff --git a/tests/Makefile b/tests/Makefile index 418c40928..70d660987 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,7 +5,7 @@ CC ?= gcc LVGL_DIR ?= ${shell pwd}/../.. LVGL_DIR_NAME ?= lvgl -WARNINGS ?= -Werror -Wall -Wextra -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wundef -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wno-switch-enum -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=1024 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wswitch-enum -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare +WARNINGS ?= -Werror -Wall -Wextra -Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers -Wall -Wextra -Wno-unused-function -Wundef -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default -Wno-switch-enum -Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated -Wempty-body -Wtype-limits -Wshift-negative-value -Wstack-usage=2048 -Wno-unused-value -Wno-unused-parameter -Wno-missing-field-initializers -Wuninitialized -Wmaybe-uninitialized -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits -Wsizeof-pointer-memaccess -Wno-format-nonliteral -Wpointer-arith -Wno-cast-qual -Wmissing-prototypes -Wunreachable-code -Wno-switch-default -Wswitch-enum -Wreturn-type -Wmultichar -Wno-discarded-qualifiers -Wformat-security -Wno-ignored-qualifiers -Wno-sign-compare OPTIMIZATION ?= -O3 -g0 diff --git a/tests/build.py b/tests/build.py index 908a8d833..4aed16f02 100755 --- a/tests/build.py +++ b/tests/build.py @@ -204,7 +204,7 @@ all_obj_all_features = { "LV_MEM_SIZE":32*1024, "LV_HOR_RES_MAX":480, "LV_VER_RES_MAX":320, - "LV_COLOR_DEPTH":16, + "LV_COLOR_DEPTH":32, "LV_USE_GROUP":1, "LV_USE_ANIMATION":1, "LV_ANTIALIAS":1, @@ -281,6 +281,7 @@ advanced_features = { "LV_HOR_RES_MAX":800, "LV_VER_RES_MAX":480, "LV_COLOR_DEPTH":16, + "LV_COLOR_16_SWAP":1, "LV_COLOR_SCREEN_TRANSP":1, "LV_USE_GROUP":1, "LV_USE_ANIMATION":1, From e31ac20d00fdc3ec403c2fb98cb60057b7729a5f Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 21 Apr 2020 22:11:20 +0200 Subject: [PATCH 10/12] btn: allow disable state for ever "normal" state --- src/lv_widgets/lv_btn.c | 36 +++++++++++++++++------------------- src/lv_widgets/lv_btn.h | 4 +++- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/lv_widgets/lv_btn.c b/src/lv_widgets/lv_btn.c index 4064fe7fe..bf21476b0 100644 --- a/src/lv_widgets/lv_btn.c +++ b/src/lv_widgets/lv_btn.c @@ -137,27 +137,26 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state) switch(state) { case LV_BTN_STATE_RELEASED: - lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED); + lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); break; case LV_BTN_STATE_PRESSED: - lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED); + lv_obj_clear_state(btn, LV_STATE_CHECKED); lv_obj_add_state(btn, LV_STATE_PRESSED); break; case LV_BTN_STATE_CHECKED_RELEASED: lv_obj_add_state(btn, LV_STATE_CHECKED); - lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED); + lv_obj_clear_state(btn, LV_STATE_PRESSED); break; case LV_BTN_STATE_CHECKED_PRESSED: - lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED); + lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); break; case LV_BTN_STATE_DISABLED: - lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED); lv_obj_add_state(btn, LV_STATE_DISABLED); break; + case LV_BTN_STATE_ACTIVE: + lv_obj_clear_state(btn, LV_STATE_DISABLED); + break; } - - // /*Make the state change happen immediately, without transition*/ - // btn->prev_state = btn->state; } /** @@ -185,26 +184,25 @@ void lv_btn_toggle(lv_obj_t * btn) /** * Get the current state of the button * @param btn pointer to a button object - * @return the state of the button (from lv_btn_state_t enum) + * @return the state of the button (from lv_btn_state_t enum). + * If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states. */ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn) { LV_ASSERT_OBJ(btn, LV_OBJX_NAME); - lv_state_t state = lv_obj_get_state(btn, LV_BTN_PART_MAIN); + lv_state_t obj_state = lv_obj_get_state(btn, LV_BTN_PART_MAIN); + lv_btn_state_t btn_state = 0; + if(obj_state & LV_STATE_DISABLED) btn_state = LV_BTN_STATE_DISABLED; - if(state & LV_STATE_DISABLED) { - return LV_BTN_STATE_DISABLED; - } - else if(state & LV_STATE_CHECKED) { - if(state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED; - else return LV_BTN_STATE_CHECKED_RELEASED; + if(obj_state & LV_STATE_CHECKED) { + if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_CHECKED_PRESSED; + else return btn_state | LV_BTN_STATE_CHECKED_RELEASED; } else { - if(state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED; - else return LV_BTN_STATE_RELEASED; + if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_PRESSED; + else return btn_state | LV_BTN_STATE_RELEASED; } - } /** diff --git a/src/lv_widgets/lv_btn.h b/src/lv_widgets/lv_btn.h index 3c3f9ede9..6af82095e 100644 --- a/src/lv_widgets/lv_btn.h +++ b/src/lv_widgets/lv_btn.h @@ -36,11 +36,12 @@ extern "C" { /** Possible states of a button. * It can be used not only by buttons but other button-like objects too*/ enum { + LV_BTN_STATE_ACTIVE, LV_BTN_STATE_RELEASED, LV_BTN_STATE_PRESSED, LV_BTN_STATE_CHECKED_RELEASED, LV_BTN_STATE_CHECKED_PRESSED, - LV_BTN_STATE_DISABLED, + LV_BTN_STATE_DISABLED = 0x80, _LV_BTN_STATE_LAST, /* Number of states*/ }; typedef uint8_t lv_btn_state_t; @@ -153,6 +154,7 @@ static inline void lv_btn_set_fit(lv_obj_t * btn, lv_fit_t fit) * Get the current state of the button * @param btn pointer to a button object * @return the state of the button (from lv_btn_state_t enum) + * If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states. */ lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn); From c340a7b580013b915b6efd73dea7598136816428 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 21 Apr 2020 22:21:42 +0200 Subject: [PATCH 11/12] minor fixes --- src/lv_draw/lv_draw_rect.c | 10 ++++++---- src/lv_themes/lv_theme_empty.c | 2 +- src/lv_themes/lv_theme_template.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index 0b9e3fd65..d8fcc9316 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -274,10 +274,12 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_re grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode); /*Center part*/ - fill_area2.x1 = coords_bg.x1 + rout; - fill_area2.x2 = coords_bg.x2 - rout; - lv_blend_fill(clip, &fill_area2, - grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode); + if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) { + fill_area2.x1 = coords_bg.x1 + rout; + fill_area2.x2 = coords_bg.x2 - rout; + lv_blend_fill(clip, &fill_area2, + grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode); + } /*Right part*/ fill_area2.x1 = coords_bg.x2 - rout + 1; diff --git a/src/lv_themes/lv_theme_empty.c b/src/lv_themes/lv_theme_empty.c index 784e8d111..93b34affb 100644 --- a/src/lv_themes/lv_theme_empty.c +++ b/src/lv_themes/lv_theme_empty.c @@ -62,7 +62,7 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco lv_style_init(&opa_cover); lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER); - theme.apply_cb = lv_theme_empty_apply; + theme.apply_xcb = lv_theme_empty_apply; return &theme; } diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c index 441a6ea87..ae85c64a8 100644 --- a/src/lv_themes/lv_theme_template.c +++ b/src/lv_themes/lv_theme_template.c @@ -382,7 +382,7 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s table_init(); win_init(); - theme.apply_cb = lv_theme_material_apply; + theme.apply_xcb = lv_theme_material_apply; return &theme; } From d9f82dab534874a3bcf91737400d624028be12ac Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 22 Apr 2020 10:10:57 -0400 Subject: [PATCH 12/12] Fix #1467: check whether object type is not NULL --- src/lv_core/lv_debug.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lv_core/lv_debug.c b/src/lv_core/lv_debug.c index 5bfdeac00..8f0191892 100644 --- a/src/lv_core/lv_debug.c +++ b/src/lv_core/lv_debug.c @@ -63,6 +63,7 @@ bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type) uint8_t i; for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) { + if(types.type[i] == NULL) break; if(strcmp(types.type[i], obj_type) == 0) return true; }