1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

merge beta

This commit is contained in:
Gabor Kiss-Vamosi 2018-07-18 23:19:45 +02:00
commit 8005f1bb28
19 changed files with 59 additions and 45 deletions

View File

@ -20,15 +20,22 @@ 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 (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:
* misspelling (in comments function/variable names or grammatical issues in comments)
@ -65,9 +72,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?

View File

@ -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: 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*/
/*Log settings*/
#define USE_LV_LOG 1 /*Enable/disable the log module*/

View File

@ -31,6 +31,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, '*/

View File

@ -269,6 +269,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) {

View File

@ -378,7 +378,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*/

View File

@ -92,7 +92,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) {
@ -327,7 +327,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) {

View File

@ -72,7 +72,6 @@ static void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
* GLOBAL FUNCTIONS
**********************/
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -67,7 +67,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;
@ -109,13 +109,14 @@ 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
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 ++) {
@ -142,7 +143,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*/
}

View File

@ -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;

View File

@ -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;
@ -345,7 +345,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;

View File

@ -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);

View File

@ -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

View File

@ -172,7 +172,9 @@ int16_t lv_font_get_width_sparse(const lv_font_t * font, uint32_t unicode_letter
#include "../lv_fonts/lv_font_builtin.h"
/*Declare the custom (user defined) fonts*/
#ifdef LV_FONT_CUSTOM_DECLARE
LV_FONT_CUSTOM_DECLARE
#endif
#ifdef __cplusplus
} /* extern "C" */

View File

@ -416,7 +416,7 @@ static bool lv_btn_design(lv_obj_t * btn, const lv_area_t * mask, lv_design_mode
cir_area.x2 = p_act.x + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
cir_area.y2 = p_act.y + ((half_side * coord_state) >> (LV_BTN_INK_VALUE_MAX_SHIFT - 1));
lv_area_union(&cir_area, &btn->coords, &cir_area); /*Limit the area. (It might be too big on the smaller side)*/
lv_area_intersect(&cir_area, &btn->coords, &cir_area); /*Limit the area. (It might be too big on the smaller side)*/
/*In the second part animate the radius. Circle -> body.radius*/
lv_coord_t r_state = ink_value > LV_BTN_INK_VALUE_MAX / 2 ? ink_value - LV_BTN_INK_VALUE_MAX / 2 : 0;

View File

@ -671,7 +671,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, lv_obj_get_opa_scale(chart));
}

View File

@ -480,7 +480,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;

View File

@ -705,8 +705,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;
}
@ -714,8 +714,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;
}
@ -774,16 +774,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);
}
@ -836,16 +836,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);
}
}

View File

@ -252,7 +252,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;
@ -417,7 +417,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;
@ -434,7 +434,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;

View File

@ -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)*/