From 930673c2f29f1804cdc6f167a674ec181d769fee Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 2 Jul 2018 20:02:04 +0200 Subject: [PATCH 01/14] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index b79352759..93ab4db72 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -20,15 +20,20 @@ As graphical interfaces for embedded systems has an increasing relevance today y Please, take a look at [CODE_OF_CONDUCT](https://github.com/littlevgl/lvgl/blob/master/docs/CODE_OF_CONDUCT.md) -There a few general rules: +There are few general rules: * We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) * Be kind and respectful. Strating with "Hi" is always a good idea :) * If somebedy helped you give a feedback. -* Always create an issue before creating a [Pull request](https://help.github.com/articles/about-pull-requests/) (maybe somebeody already working on this issue) * One issue should be about one topic. If you have other questions please open a new issue. +* Always create an issue before creating a [Pull request](https://help.github.com/articles/about-pull-requests/) to discuss the idea first +* Create small, "digestable" Pull requests. * Tell your remarks in a structured way. Use paragraphs and the [Markdown](https://guides.github.com/features/mastering-markdown/) support of GitHub. * Be sure you are using the lates version (from `master` branch) - +* Keep in mind LittlevGL should be and should remain: + - usable on small MCUs as well (think about memory footprint) + - compilable with "non-standard" tools (like Arduino) + - the API cleaan and easiy to understand + ## How to report a bug? If you found a **simple and straightforward bug** like: * misspelling (in comments function/variable names or grammatical issues in comments) @@ -65,9 +70,9 @@ Your suggestion can have 4 possible outcomes: 1. This feature is already exists. In this case you will learn how to achive your goal. 2. You can simply realize it with the current functionality. 3. Although it's a new feature but it would break LittlevGL's platform independent and/or resource minimalist nature. -4. It's really a new feature which would be good to be in LittlevGL. Hurray! In a discussion we figure out the technical details andimplementation options. With the knowledge of how to do it somebody can implement the new feature. +4. It's really a new feature which would be good to be in LittlevGL. Hurray! In a discussion we figure out the technical details and implementation options. With the knowledge of how to do it somebody can implement the new feature. -Keep in mind if you wouldn't like to do the implementation there is no guarantee that it will be ready in the new future. +Keep in mind if you wouldn't like to do the implementation there is no guarantee that it will be ready in the near future. However if you would like to force it, take a look at this page: [Feature request service](http://www.gl.littlev.hu/services#feature) ## How to implement a feature? From 33794674848c754a5215f036c0b7569d9fe706ea Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 2 Jul 2018 20:02:32 +0200 Subject: [PATCH 02/14] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 93ab4db72..9e205a15e 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -20,7 +20,7 @@ As graphical interfaces for embedded systems has an increasing relevance today y Please, take a look at [CODE_OF_CONDUCT](https://github.com/littlevgl/lvgl/blob/master/docs/CODE_OF_CONDUCT.md) -There are few general rules: +There are few **general rules** * We use [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) * Be kind and respectful. Strating with "Hi" is always a good idea :) * If somebedy helped you give a feedback. From 75878b96e6daa3bf4d1bd6b627afeeb52f14dbb4 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 2 Jul 2018 20:04:21 +0200 Subject: [PATCH 03/14] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 9e205a15e..094a1f18e 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -33,6 +33,7 @@ There are few **general rules** - usable on small MCUs as well (think about memory footprint) - compilable with "non-standard" tools (like Arduino) - the API cleaan and easiy to understand + - all configuration should be in `lv_conf.h`. (Instead of modifying the library) ## How to report a bug? If you found a **simple and straightforward bug** like: From b65b03765d269570b2126391effb8ffe467f4682 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 7 Jul 2018 08:58:49 +0200 Subject: [PATCH 04/14] Update CONTRIBUTING.md --- docs/CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 094a1f18e..e5ae3c8d2 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -31,9 +31,10 @@ There are few **general rules** * Be sure you are using the lates version (from `master` branch) * Keep in mind LittlevGL should be and should remain: - usable on small MCUs as well (think about memory footprint) - - compilable with "non-standard" tools (like Arduino) - - the API cleaan and easiy to understand + - compilable with "non-standard" tools like Arduino (no gcc specific options) + - C compatible (no C++ specific code and features) - all configuration should be in `lv_conf.h`. (Instead of modifying the library) + - the API clean and easiy to understand ## How to report a bug? If you found a **simple and straightforward bug** like: From 43cfd5fea5b10952197c887d96bf7a68b3832170 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Thu, 12 Jul 2018 17:16:14 +0200 Subject: [PATCH 05/14] Fix incorrect calculation of area that needs to be invalidated for the scrollbars. --- lv_objx/lv_page.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 2f0c0fcc9..1d9fa9481 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -621,8 +621,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi lv_area_copy(&sb_area_tmp, &page_ext->sb.hor_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); page_ext->sb.hor_draw = 0; } @@ -630,8 +630,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi lv_area_copy(&sb_area_tmp, &page_ext->sb.ver_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); page_ext->sb.ver_draw = 0; } @@ -692,16 +692,16 @@ static void lv_page_sb_refresh(lv_obj_t * page) lv_area_copy(&sb_area_tmp, &ext->sb.hor_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); } if(ext->sb.ver_draw != 0) { lv_area_copy(&sb_area_tmp, &ext->sb.ver_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); } @@ -754,16 +754,16 @@ static void lv_page_sb_refresh(lv_obj_t * page) lv_area_copy(&sb_area_tmp, &ext->sb.hor_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); } if(ext->sb.ver_draw != 0) { lv_area_copy(&sb_area_tmp, &ext->sb.ver_area); sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.y1 += page->coords.y1; - sb_area_tmp.x2 += page->coords.x2; - sb_area_tmp.y2 += page->coords.y2; + sb_area_tmp.x2 += page->coords.x1; + sb_area_tmp.y2 += page->coords.y1; lv_inv_area(&sb_area_tmp); } } From 4773dfd53f5847885220ec96c085a12aaa719062 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 13 Jul 2018 13:54:41 +0200 Subject: [PATCH 06/14] add LV_FONT_CUSTOM_DECLARE only if defined --- lv_misc/lv_font.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lv_misc/lv_font.h b/lv_misc/lv_font.h index 6465c4656..786b55394 100644 --- a/lv_misc/lv_font.h +++ b/lv_misc/lv_font.h @@ -214,7 +214,9 @@ LV_FONT_DECLARE(lv_font_symbol_40); #endif /*Declare the custom (user defined) fonts*/ +#ifdef LV_FONT_CUSTOM_DECLARE LV_FONT_CUSTOM_DECLARE +#endif #ifdef __cplusplus } /* extern "C" */ From 0a4c00c5f224af6cd04a7a29c615bac9a7fac698 Mon Sep 17 00:00:00 2001 From: kisvegabor Date: Fri, 13 Jul 2018 21:40:56 +0200 Subject: [PATCH 07/14] lv_conf_templ: add config option for Visual Studio --- lv_conf_templ.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index f69d16de7..1dc055a80 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -82,9 +82,11 @@ #define USE_LV_FILESYSTEM 1 /*1: Enable file system (required by images*/ /*Compiler settings*/ -#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ -#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ -#define LV_COMPILER_VLA_SUPPORTED 1 /* 1: Variable length array is supported*/ +#define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ +#define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ +#define LV_COMPILER_VLA_SUPPORTED 0 /* 1: Variable length array is supported. (In Visual studio it is not supported)*/ +#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 0 /* 1: Initialziation woth non constant values are supproted (In Visual studio it is not supported)*/ +//#define _CRT_SECURE_NO_WARNINGS /* Visual Studio needs it to use `strcpy`, `sprintf` etc*/ /*================ * THEME USAGE From 8746d3de4564b50b36501f31bd26db97576ce2e0 Mon Sep 17 00:00:00 2001 From: kisvegabor Date: Fri, 13 Jul 2018 21:47:56 +0200 Subject: [PATCH 08/14] fix non const initialization --- lv_draw/lv_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index a4092ccd0..a7e93fbe9 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -477,9 +477,9 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, uint8_t buf[lv_area_get_width(&mask_com) * px_size]; #else # if LV_HOR_RES > LV_VER_RES - uint8_t buf[LV_HOR_RES * px_size]; + uint8_t buf[LV_HOR_RES * ((LV_COLOR_DEPTH >> 8) + 1)]; /*+1 because of the possible alpha byte*/ # else - uint8_t buf[LV_VER_RES * px_size]; + uint8_t buf[LV_VER_RES * ((LV_COLOR_DEPTH >> 8) + 1)]; # endif #endif for(row = mask_com.y1; row <= mask_com.y2; row ++) { From 6e7cc4414a2f268326b7b5410b52a44adce46dd5 Mon Sep 17 00:00:00 2001 From: kisvegabor Date: Fri, 13 Jul 2018 21:54:11 +0200 Subject: [PATCH 09/14] fix non const initialization --- lv_draw/lv_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index a7e93fbe9..534e5139b 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -473,7 +473,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, lv_coord_t row; uint32_t act_pos; -#if LV_COMPILER_VLA_SUPPORTED +#if LV_COMPILER_VLA_SUPoPORTED uint8_t buf[lv_area_get_width(&mask_com) * px_size]; #else # if LV_HOR_RES > LV_VER_RES From 3fec97db45d991713977881d8056b337a9421812 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 15 Jul 2018 16:52:14 +0200 Subject: [PATCH 10/14] lv_conf_templ.h: fix typo --- lv_conf_templ.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_conf_templ.h b/lv_conf_templ.h index 77e8053f5..2db29f21d 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -85,7 +85,7 @@ #define LV_ATTRIBUTE_TICK_INC /* Define a custom attribute to `lv_tick_inc` function */ #define LV_ATTRIBUTE_TASK_HANDLER /* Define a custom attribute to `lv_task_handler` function */ #define LV_COMPILER_VLA_SUPPORTED 0 /* 1: Variable length array is supported. (In Visual studio it is not supported)*/ -#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 0 /* 1: Initialziation woth non constant values are supproted (In Visual studio it is not supported)*/ +#define LV_COMPILER_NON_CONST_INIT_SUPPORTED 0 /* 1: Initialization with non constant values are supported (In Visual studio it is not supported)*/ //#define _CRT_SECURE_NO_WARNINGS /* Visual Studio needs it to use `strcpy`, `sprintf` etc*/ /*================ From 4e2f371fc953e54cd9d5ae59c278ea6a6c35cc56 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 16 Jul 2018 23:24:34 +0200 Subject: [PATCH 11/14] lv_indev: make possible to delete objects in the read function --- lv_core/lv_indev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index d363e2ce8..dbd9515e5 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -259,6 +259,7 @@ static void indev_proc_task(void * param) do { /*Read the data*/ more_to_read = lv_indev_read(i, &data); + indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/ i->proc.state = data.state; if(i->proc.state == LV_INDEV_STATE_PR) { From f4a66c4b22dd9e1622d3bd6b7296278c431b8bf0 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 17 Jul 2018 00:22:43 +0200 Subject: [PATCH 12/14] add LV_GROUP_KEY_DEL --- lv_core/lv_group.h | 1 + lv_objx/lv_ta.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lv_core/lv_group.h b/lv_core/lv_group.h index 19a0f15e7..d169d07f2 100644 --- a/lv_core/lv_group.h +++ b/lv_core/lv_group.h @@ -26,6 +26,7 @@ extern "C" { #define LV_GROUP_KEY_RIGHT 19 /*0x13*/ #define LV_GROUP_KEY_LEFT 20 /*0x14*/ #define LV_GROUP_KEY_ESC 27 /*0x1B*/ +#define LV_GROUP_KEY_DEL 28 /*0x1C*/ #define LV_GROUP_KEY_ENTER 10 /*0x0A, '\n'*/ #define LV_GROUP_KEY_NEXT 9 /*0x09, '\t'*/ #define LV_GROUP_KEY_PREV 11 /*0x0B, '*/ diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 2e2ff8972..abc47193b 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -941,6 +941,7 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) else if(c == LV_GROUP_KEY_LEFT) lv_ta_cursor_left(ta); else if(c == LV_GROUP_KEY_UP) lv_ta_cursor_up(ta); else if(c == LV_GROUP_KEY_DOWN) lv_ta_cursor_down(ta); + else if(c == LV_GROUP_KEY_DEL) lv_ta_del_char(ta); else { #if LV_TXT_UTF8 != 0 /*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/ From edf94bf1b253c96aa0d6387a2b92a15df310cdda Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 17 Jul 2018 16:40:52 +0200 Subject: [PATCH 13/14] rename lv_area_union to lv_area_intersect --- lv_core/lv_obj.c | 2 +- lv_core/lv_refr.c | 10 +++++----- lv_draw/lv_draw.c | 4 ++-- lv_draw/lv_draw_rbasic.c | 6 +++--- lv_draw/lv_draw_vbasic.c | 4 ++-- lv_misc/lv_area.c | 4 ++-- lv_misc/lv_area.h | 2 +- lv_objx/lv_chart.c | 2 +- lv_objx/lv_ddlist.c | 2 +- lv_objx/lv_roller.c | 6 +++--- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 77f9958dd..6c791a6eb 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -364,7 +364,7 @@ void lv_obj_invalidate(lv_obj_t * obj) /*Check through all parents*/ while(par != NULL) { - union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords); + union_ok = lv_area_intersect(&area_trunc, &area_trunc, &par->coords); if(union_ok == false) break; /*If no common parts with parent break;*/ if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/ diff --git a/lv_core/lv_refr.c b/lv_core/lv_refr.c index fbf14d8f9..8b0ea59d9 100644 --- a/lv_core/lv_refr.c +++ b/lv_core/lv_refr.c @@ -93,7 +93,7 @@ void lv_inv_area(const lv_area_t * area_p) lv_area_t com_area; bool suc; - suc = lv_area_union(&com_area, area_p, &scr_area); + suc = lv_area_intersect(&com_area, area_p, &scr_area); /*The area is truncated to the screen*/ if(suc != false) { @@ -328,7 +328,7 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p) /*Get the new mask from the original area and the act. VDB It will be a part of 'area_p'*/ lv_area_t start_mask; - lv_area_union(&start_mask, area_p, &vdb_p->area); + lv_area_intersect(&start_mask, area_p, &vdb_p->area); /*Get the most top object which is not covered by others*/ top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act()); @@ -451,7 +451,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) obj_area.y1 -= ext_size; obj_area.x2 += ext_size; obj_area.y2 += ext_size; - union_ok = lv_area_union(&obj_ext_mask, mask_ori_p, &obj_area); + union_ok = lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area); /*Draw the parent and its children only if they ore on 'mask_parent'*/ if(union_ok != false) { @@ -465,7 +465,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) /*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/ lv_obj_get_coords(obj, &obj_area); - union_ok = lv_area_union(&obj_mask, mask_ori_p, &obj_area); + union_ok = lv_area_intersect(&obj_mask, mask_ori_p, &obj_area); if(union_ok != false) { lv_area_t mask_child; /*Mask from obj and its child*/ lv_obj_t * child_p; @@ -479,7 +479,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p) child_area.y2 += ext_size; /* Get the union (common parts) of original mask (from obj) * and its child */ - union_ok = lv_area_union(&mask_child, &obj_mask, &child_area); + union_ok = lv_area_intersect(&mask_child, &obj_mask, &child_area); /*If the parent and the child has common area then refresh the child */ if(union_ok) { diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 534e5139b..284fac825 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -431,7 +431,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, lv_area_t mask_com; /*Common area of mask and cords*/ bool union_ok; - union_ok = lv_area_union(&mask_com, mask, coords); + union_ok = lv_area_intersect(&mask_com, mask, coords); if(union_ok == false) { lv_fs_close(&file); return; @@ -506,7 +506,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const lv_img_t * img_var = src; lv_area_t mask_com; /*Common area of mask and coords*/ bool union_ok; - union_ok = lv_area_union(&mask_com, mask, coords); + union_ok = lv_area_intersect(&mask_com, mask, coords); if(union_ok == false) { return; /*Out of mask*/ } diff --git a/lv_draw/lv_draw_rbasic.c b/lv_draw/lv_draw_rbasic.c index ef9996685..369adf523 100644 --- a/lv_draw/lv_draw_rbasic.c +++ b/lv_draw/lv_draw_rbasic.c @@ -76,11 +76,11 @@ void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p, bool union_ok = true; if(mask_p != NULL) { - union_ok = lv_area_union(&masked_area, cords_p, mask_p); + union_ok = lv_area_intersect(&masked_area, cords_p, mask_p); } else { lv_area_t scr_area; lv_area_set(&scr_area, 0, 0, LV_HOR_RES - 1, LV_VER_RES - 1); - union_ok = lv_area_union(&masked_area, cords_p, &scr_area); + union_ok = lv_area_intersect(&masked_area, cords_p, &scr_area); } if(union_ok != false) { @@ -222,7 +222,7 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p, lv_area_t masked_a; bool union_ok; - union_ok = lv_area_union(&masked_a, cords_p, mask_p); + union_ok = lv_area_intersect(&masked_a, cords_p, mask_p); /*If there are common part of the mask and map then draw the map*/ if(union_ok == false) return; diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 1f2033267..a71c06c27 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -101,7 +101,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, /*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_union(&res_a, cords_p, mask_p); + 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; @@ -337,7 +337,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, /*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_union(&masked_a, cords_p, mask_p); + 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; diff --git a/lv_misc/lv_area.c b/lv_misc/lv_area.c index 3ba5d303a..f340690a4 100644 --- a/lv_misc/lv_area.c +++ b/lv_misc/lv_area.c @@ -102,12 +102,12 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) /** * Get the common parts of two areas - * @param res_p pointer to an area, the result will be stored her + * @param res_p pointer to an area, the result will be stored here * @param a1_p pointer to the first area * @param a2_p pointer to the second area * @return false: the two area has NO common parts, res_p is invalid */ -bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) +bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) { /* Get the smaller area from 'a1_p' and 'a2_p' */ res_p->x1 = LV_MATH_MAX(a1_p->x1, a2_p->x1); diff --git a/lv_misc/lv_area.h b/lv_misc/lv_area.h index 4663e0106..fc8b7dec8 100644 --- a/lv_misc/lv_area.h +++ b/lv_misc/lv_area.h @@ -123,7 +123,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p); * @param a2_p pointer to the second area * @return false: the two area has NO common parts, res_p is invalid */ -bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); +bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); /** * Join two areas into a third which involves the other two diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index b32caaa37..fac54ad08 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -670,7 +670,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask) y_tmp = y_tmp / (ext->ymax - ext->ymin); col_a.y1 = h - y_tmp + chart->coords.y1; - mask_ret = lv_area_union(&col_mask, mask, &col_a); + mask_ret = lv_area_intersect(&col_mask, mask, &col_a); if(mask_ret != false) { lv_draw_rect(&chart->coords, &col_mask, &rects); } diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 1d2687275..da10aa94f 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -479,7 +479,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig area_sel.x2 = ddlist->coords.x2; lv_area_t mask_sel; bool area_ok; - area_ok = lv_area_union(&mask_sel, mask, &area_sel); + area_ok = lv_area_intersect(&mask_sel, mask, &area_sel); if(area_ok) { lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL); lv_style_t new_style; diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 3c3a909f0..5b4092586 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -251,7 +251,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig rect_area.x2 = roller->coords.x2; lv_area_t mask_sel; bool area_ok; - area_ok = lv_area_union(&mask_sel, mask, &rect_area); + area_ok = lv_area_intersect(&mask_sel, mask, &rect_area); if(area_ok) { lv_style_t * sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL); lv_style_t new_style; @@ -416,7 +416,7 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask) half_roller.y1 -= roller->ext_size; half_roller.y2 = roller->coords.y1 + h / 2; - union_ok = lv_area_union(&half_mask, &half_roller, mask); + union_ok = lv_area_intersect(&half_mask, &half_roller, mask); half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/ half_roller.x2 -= roller->ext_size; @@ -433,7 +433,7 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask) half_roller.y1 = roller->coords.y1 + h / 2; if((h & 0x1) == 0) half_roller.y1++; /*With even height the pixels in the middle would be drawn twice*/ - union_ok = lv_area_union(&half_mask, &half_roller, mask); + union_ok = lv_area_intersect(&half_mask, &half_roller, mask); half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/ half_roller.x2 -= roller->ext_size; From dc4541f267aec6ccf0d4aa8879abf1c1fdf8b6c1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 18 Jul 2018 23:16:42 +0200 Subject: [PATCH 14/14] fix a typo of LV_COMPILER_VLA_SUPPORTED in lv_draw.c --- lv_draw/lv_draw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lv_draw/lv_draw.c b/lv_draw/lv_draw.c index 284fac825..aadaa93f6 100644 --- a/lv_draw/lv_draw.c +++ b/lv_draw/lv_draw.c @@ -473,7 +473,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, lv_coord_t row; uint32_t act_pos; -#if LV_COMPILER_VLA_SUPoPORTED +#if LV_COMPILER_VLA_SUPPORTED uint8_t buf[lv_area_get_width(&mask_com) * px_size]; #else # if LV_HOR_RES > LV_VER_RES