format with astyler

This commit is contained in:
Gabor Kiss-Vamosi
2018-06-19 09:49:58 +02:00
parent 175f06a7f9
commit 383ce0599e
137 changed files with 145842 additions and 145911 deletions
+2 -2
View File
@@ -212,8 +212,8 @@
/*Preload (dependencies: arc)*/ /*Preload (dependencies: arc)*/
#define USE_LV_PRELOAD 1 #define USE_LV_PRELOAD 1
#if USE_LV_PRELOAD != 0 #if USE_LV_PRELOAD != 0
#define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/ #define LV_PRELOAD_DEF_ARC_LENGTH 60 /*[deg]*/
#define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/ #define LV_PRELOAD_DEF_SPIN_TIME 1000 /*[ms]*/
#endif #endif
/************************* /*************************
+13 -13
View File
@@ -58,17 +58,17 @@ lv_group_t * lv_group_create(void)
*/ */
void lv_group_del(lv_group_t * group) void lv_group_del(lv_group_t * group)
{ {
/*Defocus the the currently focused object*/ /*Defocus the the currently focused object*/
if(group->obj_focus != NULL) { if(group->obj_focus != NULL) {
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL); (*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
lv_obj_invalidate(*group->obj_focus); lv_obj_invalidate(*group->obj_focus);
} }
/*Remove the objects from the group*/ /*Remove the objects from the group*/
lv_obj_t ** obj; lv_obj_t ** obj;
LL_READ(group->obj_ll, obj) { LL_READ(group->obj_ll, obj) {
(*obj)->group_p = NULL; (*obj)->group_p = NULL;
} }
lv_ll_clear(&(group->obj_ll)); lv_ll_clear(&(group->obj_ll));
lv_mem_free(group); lv_mem_free(group);
@@ -102,16 +102,16 @@ void lv_group_remove_obj(lv_obj_t * obj)
{ {
lv_group_t * g = obj->group_p; lv_group_t * g = obj->group_p;
if(g == NULL) return; if(g == NULL) return;
if(g->obj_focus == NULL) return; /*Just to be sure (Not possible if there is at least one object in the group)*/ if(g->obj_focus == NULL) return; /*Just to be sure (Not possible if there is at least one object in the group)*/
if(*g->obj_focus == obj) { if(*g->obj_focus == obj) {
lv_group_focus_next(g); lv_group_focus_next(g);
} }
/* If the focuses object is still the same then it was the only object in the group but it will be deleted. /* If the focuses object is still the same then it was the only object in the group but it will be deleted.
* Set the `obj_focus` to NULL to get back to the initial state of the group with zero objects*/ * Set the `obj_focus` to NULL to get back to the initial state of the group with zero objects*/
if(*g->obj_focus == obj) { if(*g->obj_focus == obj) {
g->obj_focus = NULL; g->obj_focus = NULL;
} }
/*Search the object and remove it from its group */ /*Search the object and remove it from its group */
@@ -146,7 +146,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
g->obj_focus = i; g->obj_focus = i;
if(g->obj_focus != NULL){ if(g->obj_focus != NULL) {
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL); (*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_obj_invalidate(*g->obj_focus); lv_obj_invalidate(*g->obj_focus);
} }
@@ -175,7 +175,7 @@ void lv_group_focus_next(lv_group_t * group)
if(obj_next == NULL) obj_next = lv_ll_get_head(&group->obj_ll); if(obj_next == NULL) obj_next = lv_ll_get_head(&group->obj_ll);
group->obj_focus = obj_next; group->obj_focus = obj_next;
if(group->obj_focus){ if(group->obj_focus) {
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL); (*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_obj_invalidate(*group->obj_focus); lv_obj_invalidate(*group->obj_focus);
@@ -203,7 +203,7 @@ void lv_group_focus_prev(lv_group_t * group)
if(obj_next == NULL) obj_next = lv_ll_get_tail(&group->obj_ll); if(obj_next == NULL) obj_next = lv_ll_get_tail(&group->obj_ll);
group->obj_focus = obj_next; group->obj_focus = obj_next;
if(group->obj_focus != NULL){ if(group->obj_focus != NULL) {
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL); (*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
lv_obj_invalidate(*group->obj_focus); lv_obj_invalidate(*group->obj_focus);
@@ -241,7 +241,7 @@ void lv_group_send_data(lv_group_t * group, uint32_t c)
* @param group pointer to a group * @param group pointer to a group
* @param style_mod_func the style modifier function pointer * @param style_mod_func the style modifier function pointer
*/ */
void lv_group_set_style_mod_cb(lv_group_t * group,lv_group_style_mod_func_t style_mod_func) void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_func_t style_mod_func)
{ {
group->style_mod = style_mod_func; group->style_mod = style_mod_func;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus); if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
+1 -1
View File
@@ -49,7 +49,7 @@ typedef struct _lv_group_t
lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/ lv_group_focus_cb_t focus_cb; /*A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /*Stores the modified style of the focused object */ lv_style_t style_tmp; /*Stores the modified style of the focused object */
uint8_t frozen:1; /*1: can't focus to new object*/ uint8_t frozen:1; /*1: can't focus to new object*/
}lv_group_t; } lv_group_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
+61 -71
View File
@@ -45,7 +45,7 @@ static void indev_drag_throw(lv_indev_proc_t * state);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_indev_t *indev_act; static lv_indev_t * indev_act;
/********************** /**********************
* MACROS * MACROS
@@ -110,10 +110,10 @@ void lv_indev_reset_lpr(lv_indev_t * indev)
*/ */
void lv_indev_enable(lv_hal_indev_type_t type, bool enable) void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
{ {
lv_indev_t *i = lv_indev_next(NULL); lv_indev_t * i = lv_indev_next(NULL);
while (i) { while(i) {
if (i->driver.type == type) i->proc.disabled = enable == false ? 1 : 0; if(i->driver.type == type) i->proc.disabled = enable == false ? 1 : 0;
i = lv_indev_next(i); i = lv_indev_next(i);
} }
} }
@@ -123,7 +123,7 @@ void lv_indev_enable(lv_hal_indev_type_t type, bool enable)
* @param indev pointer to an input device * @param indev pointer to an input device
* @param cur_obj pointer to an object to be used as cursor * @param cur_obj pointer to an object to be used as cursor
*/ */
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj) void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
{ {
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) return; if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) return;
@@ -138,7 +138,7 @@ void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
* @param indev pointer to an input device * @param indev pointer to an input device
* @param group point to a group * @param group point to a group
*/ */
void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group) void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group)
{ {
if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) indev->group = group; if(indev->driver.type == LV_INDEV_TYPE_KEYPAD) indev->group = group;
} }
@@ -150,7 +150,7 @@ void lv_indev_set_group(lv_indev_t *indev, lv_group_t *group)
* @param indev pointer to an input device * @param indev pointer to an input device
* @param group point to a group * @param group point to a group
*/ */
void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points) void lv_indev_set_button_points(lv_indev_t * indev, lv_point_t * points)
{ {
if(indev->driver.type == LV_INDEV_TYPE_BUTTON) indev->btn_points = points; if(indev->driver.type == LV_INDEV_TYPE_BUTTON) indev->btn_points = points;
} }
@@ -210,7 +210,7 @@ uint32_t lv_indev_get_inactive_time(lv_indev_t * indev)
if(indev) return t = lv_tick_elaps(indev->last_activity_time); if(indev) return t = lv_tick_elaps(indev->last_activity_time);
lv_indev_t *i; lv_indev_t * i;
t = UINT16_MAX; t = UINT16_MAX;
i = lv_indev_next(NULL); i = lv_indev_next(NULL);
while(i) { while(i) {
@@ -266,12 +266,10 @@ static void indev_proc_task(void * param)
} }
if(i->driver.type == LV_INDEV_TYPE_POINTER) { if(i->driver.type == LV_INDEV_TYPE_POINTER) {
indev_pointer_proc(i,&data); indev_pointer_proc(i, &data);
} } else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
indev_keypad_proc(i, &data); indev_keypad_proc(i, &data);
} } else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
indev_button_proc(i, &data); indev_button_proc(i, &data);
} }
/*Handle reset query if it happened in during processing*/ /*Handle reset query if it happened in during processing*/
@@ -294,24 +292,23 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
{ {
/*Move the cursor if set and moved*/ /*Move the cursor if set and moved*/
if(i->cursor != NULL && if(i->cursor != NULL &&
(i->proc.last_point.x != data->point.x || (i->proc.last_point.x != data->point.x ||
i->proc.last_point.y != data->point.y)) i->proc.last_point.y != data->point.y)) {
{
lv_obj_set_pos(i->cursor, data->point.x, data->point.y); lv_obj_set_pos(i->cursor, data->point.x, data->point.y);
} }
i->proc.act_point.x = data->point.x; i->proc.act_point.x = data->point.x;
i->proc.act_point.y = data->point.y; i->proc.act_point.y = data->point.y;
if(i->proc.state == LV_INDEV_STATE_PR){ if(i->proc.state == LV_INDEV_STATE_PR) {
#if LV_INDEV_POINT_MARKER != 0 #if LV_INDEV_POINT_MARKER != 0
lv_area_t area; lv_area_t area;
area.x1 = i->proc.act_point.x - (LV_INDEV_POINT_MARKER >> 1); area.x1 = i->proc.act_point.x - (LV_INDEV_POINT_MARKER >> 1);
area.y1 = i->proc.act_point.y - (LV_INDEV_POINT_MARKER >> 1); area.y1 = i->proc.act_point.y - (LV_INDEV_POINT_MARKER >> 1);
area.x2 = i->proc.act_point.x + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); area.x2 = i->proc.act_point.x + ((LV_INDEV_POINT_MARKER >> 1) | 0x1);
area.y2 = i->proc.act_point.y + ((LV_INDEV_POINT_MARKER >> 1) | 0x1); area.y2 = i->proc.act_point.y + ((LV_INDEV_POINT_MARKER >> 1) | 0x1);
lv_rfill(&area, NULL, LV_COLOR_MAKE(0xFF, 0, 0), LV_OPA_COVER); lv_rfill(&area, NULL, LV_COLOR_MAKE(0xFF, 0, 0), LV_OPA_COVER);
#endif #endif
indev_proc_press(&i->proc); indev_proc_press(&i->proc);
} else { } else {
indev_proc_release(&i->proc); indev_proc_release(&i->proc);
@@ -333,16 +330,14 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Key press happened*/ /*Key press happened*/
if(data->state == LV_INDEV_STATE_PR && if(data->state == LV_INDEV_STATE_PR &&
i->proc.last_state == LV_INDEV_STATE_REL) i->proc.last_state == LV_INDEV_STATE_REL) {
{
i->proc.pr_timestamp = lv_tick_get(); i->proc.pr_timestamp = lv_tick_get();
} }
/*Pressing*/ /*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) { else if(data->state == LV_INDEV_STATE_PR && i->proc.last_state == LV_INDEV_STATE_PR) {
if(data->key == LV_GROUP_KEY_ENTER && if(data->key == LV_GROUP_KEY_ENTER &&
i->proc.long_pr_sent == 0 && i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
{
lv_group_send_data(i->group, LV_GROUP_KEY_ENTER_LONG); lv_group_send_data(i->group, LV_GROUP_KEY_ENTER_LONG);
i->proc.long_pr_sent = 1; i->proc.long_pr_sent = 1;
@@ -350,24 +345,21 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
} }
} }
/*Release happened*/ /*Release happened*/
else if(data->state == LV_INDEV_STATE_REL && i->proc.last_state == LV_INDEV_STATE_PR) else if(data->state == LV_INDEV_STATE_REL && i->proc.last_state == LV_INDEV_STATE_PR) {
{
/*The user might clear the key it was released. Always release the pressed key*/ /*The user might clear the key it was released. Always release the pressed key*/
data->key = i->proc.last_key; data->key = i->proc.last_key;
if(data->key == LV_GROUP_KEY_NEXT) { if(data->key == LV_GROUP_KEY_NEXT) {
lv_group_focus_next(i->group); lv_group_focus_next(i->group);
} } else if(data->key == LV_GROUP_KEY_PREV) {
else if(data->key == LV_GROUP_KEY_PREV) {
lv_group_focus_prev(i->group); lv_group_focus_prev(i->group);
} } else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) {
else if(data->key == LV_GROUP_KEY_ENTER && i->proc.long_pr_sent) {
/*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/ /*Do nothing. Don't send the ENTER if ENTER_LONG was sent*/
} else { } else {
lv_group_send_data(i->group, data->key); lv_group_send_data(i->group, data->key);
} }
if(i->proc.reset_query) return; /*The object might be deleted in `focus_cb` or due to any other user event*/ if(i->proc.reset_query) return; /*The object might be deleted in `focus_cb` or due to any other user event*/
i->proc.pr_timestamp = 0; i->proc.pr_timestamp = 0;
i->proc.long_pr_sent = 0; i->proc.long_pr_sent = 0;
@@ -392,8 +384,8 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Still the same point is pressed*/ /*Still the same point is pressed*/
if(i->proc.last_point.x == i->proc.act_point.x && if(i->proc.last_point.x == i->proc.act_point.x &&
i->proc.last_point.y == i->proc.act_point.y && i->proc.last_point.y == i->proc.act_point.y &&
data->state == LV_INDEV_STATE_PR) { data->state == LV_INDEV_STATE_PR) {
#if LV_INDEV_POINT_MARKER != 0 #if LV_INDEV_POINT_MARKER != 0
lv_area_t area; lv_area_t area;
area.x1 = i->proc.act_point.x - (LV_INDEV_POINT_MARKER >> 1); area.x1 = i->proc.act_point.x - (LV_INDEV_POINT_MARKER >> 1);
@@ -463,15 +455,15 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*Search for 'top' attribute*/ /*Search for 'top' attribute*/
lv_obj_t * i = pr_obj; lv_obj_t * i = pr_obj;
lv_obj_t * last_top = NULL; lv_obj_t * last_top = NULL;
while(i != NULL){ while(i != NULL) {
if(i->top != 0) last_top = i; if(i->top != 0) last_top = i;
i = lv_obj_get_parent(i); i = lv_obj_get_parent(i);
} }
if(last_top != NULL) { if(last_top != NULL) {
/*Move the last_top object to the foreground*/ /*Move the last_top object to the foreground*/
lv_obj_t * par = lv_obj_get_parent(last_top); lv_obj_t * par = lv_obj_get_parent(last_top);
/*After list change it will be the new head*/ /*After list change it will be the new head*/
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top); lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
lv_obj_invalidate(last_top); lv_obj_invalidate(last_top);
} }
@@ -604,13 +596,13 @@ static lv_obj_t * indev_search_obj(const lv_indev_proc_t * indev, lv_obj_t * obj
/*If then the children was not ok, and this obj is clickable /*If then the children was not ok, and this obj is clickable
* and it or its parent is not hidden then save this object*/ * and it or its parent is not hidden then save this object*/
if(found_p == NULL && lv_obj_get_click(obj) != false) { if(found_p == NULL && lv_obj_get_click(obj) != false) {
lv_obj_t * hidden_i = obj; lv_obj_t * hidden_i = obj;
while(hidden_i != NULL) { while(hidden_i != NULL) {
if(lv_obj_get_hidden(hidden_i) == true) break; if(lv_obj_get_hidden(hidden_i) == true) break;
hidden_i = lv_obj_get_parent(hidden_i); hidden_i = lv_obj_get_parent(hidden_i);
} }
/*No parent found with hidden == true*/ /*No parent found with hidden == true*/
if(hidden_i == NULL) found_p = obj; if(hidden_i == NULL) found_p = obj;
} }
} }
@@ -627,12 +619,12 @@ static void indev_drag(lv_indev_proc_t * state)
lv_obj_t * drag_obj = state->act_obj; lv_obj_t * drag_obj = state->act_obj;
/*If drag parent is active check recursively the drag_parent attribute*/ /*If drag parent is active check recursively the drag_parent attribute*/
while(lv_obj_get_drag_parent(drag_obj) != false && while(lv_obj_get_drag_parent(drag_obj) != false &&
drag_obj != NULL) { drag_obj != NULL) {
drag_obj = lv_obj_get_parent(drag_obj); drag_obj = lv_obj_get_parent(drag_obj);
} }
if(drag_obj == NULL) return; if(drag_obj == NULL) return;
if(lv_obj_get_drag(drag_obj) == false) return; if(lv_obj_get_drag(drag_obj) == false) return;
@@ -643,17 +635,16 @@ static void indev_drag(lv_indev_proc_t * state)
/*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/
if(LV_MATH_ABS(state->drag_sum.x) >= LV_INDEV_DRAG_LIMIT || if(LV_MATH_ABS(state->drag_sum.x) >= LV_INDEV_DRAG_LIMIT ||
LV_MATH_ABS(state->drag_sum.y) >= LV_INDEV_DRAG_LIMIT) LV_MATH_ABS(state->drag_sum.y) >= LV_INDEV_DRAG_LIMIT) {
{ state->drag_range_out = 1;
state->drag_range_out = 1; }
}
} }
/*If the drag limit is stepped over then handle the dragging*/ /*If the drag limit is stepped over then handle the dragging*/
if(state->drag_range_out != 0) { if(state->drag_range_out != 0) {
/*Set new position if the vector is not zero*/ /*Set new position if the vector is not zero*/
if(state->vect.x != 0 || if(state->vect.x != 0 ||
state->vect.y != 0) { state->vect.y != 0) {
/*Get the coordinates of the object and modify them*/ /*Get the coordinates of the object and modify them*/
lv_coord_t act_x = lv_obj_get_x(drag_obj); lv_coord_t act_x = lv_obj_get_x(drag_obj);
lv_coord_t act_y = lv_obj_get_y(drag_obj); lv_coord_t act_y = lv_obj_get_y(drag_obj);
@@ -688,33 +679,32 @@ static void indev_drag(lv_indev_proc_t * state)
*/ */
static void indev_drag_throw(lv_indev_proc_t * state) static void indev_drag_throw(lv_indev_proc_t * state)
{ {
if(state->drag_in_prog == 0) return; if(state->drag_in_prog == 0) return;
/*Set new position if the vector is not zero*/ /*Set new position if the vector is not zero*/
lv_obj_t * drag_obj = state->last_obj; lv_obj_t * drag_obj = state->last_obj;
/*If drag parent is active check recursively the drag_parent attribute*/ /*If drag parent is active check recursively the drag_parent attribute*/
while(lv_obj_get_drag_parent(drag_obj) != false && while(lv_obj_get_drag_parent(drag_obj) != false &&
drag_obj != NULL) { drag_obj != NULL) {
drag_obj = lv_obj_get_parent(drag_obj); drag_obj = lv_obj_get_parent(drag_obj);
} }
if(drag_obj == NULL) return; if(drag_obj == NULL) return;
/*Return if the drag throw is not enabled*/ /*Return if the drag throw is not enabled*/
if(lv_obj_get_drag_throw(drag_obj) == false ){ if(lv_obj_get_drag_throw(drag_obj) == false) {
state->drag_in_prog = 0; state->drag_in_prog = 0;
drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_END, indev_act); drag_obj->signal_func(drag_obj, LV_SIGNAL_DRAG_END, indev_act);
return; return;
} }
/*Reduce the vectors*/ /*Reduce the vectors*/
state->vect.x = state->vect.x * (100 -LV_INDEV_DRAG_THROW) / 100; state->vect.x = state->vect.x * (100 - LV_INDEV_DRAG_THROW) / 100;
state->vect.y = state->vect.y * (100 -LV_INDEV_DRAG_THROW) / 100; state->vect.y = state->vect.y * (100 - LV_INDEV_DRAG_THROW) / 100;
if(state->vect.x != 0 || if(state->vect.x != 0 ||
state->vect.y != 0) state->vect.y != 0) {
{
/*Get the coordinates and modify them*/ /*Get the coordinates and modify them*/
lv_coord_t act_x = lv_obj_get_x(drag_obj) + state->vect.x; lv_coord_t act_x = lv_obj_get_x(drag_obj) + state->vect.x;
lv_coord_t act_y = lv_obj_get_y(drag_obj) + state->vect.y; lv_coord_t act_y = lv_obj_get_y(drag_obj) + state->vect.y;
@@ -722,7 +712,7 @@ static void indev_drag_throw(lv_indev_proc_t * state)
/*If non of the coordinates are changed then do not continue throwing*/ /*If non of the coordinates are changed then do not continue throwing*/
if((lv_obj_get_x(drag_obj) != act_x || state->vect.x == 0) && if((lv_obj_get_x(drag_obj) != act_x || state->vect.x == 0) &&
(lv_obj_get_y(drag_obj) != act_y || state->vect.y == 0)) { (lv_obj_get_y(drag_obj) != act_y || state->vect.y == 0)) {
state->drag_in_prog = 0; state->drag_in_prog = 0;
state->vect.x = 0; state->vect.x = 0;
state->vect.y = 0; state->vect.y = 0;
+188 -195
View File
File diff suppressed because it is too large Load Diff
+29 -29
View File
@@ -48,9 +48,9 @@ extern "C" {
#endif #endif
#define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/ #define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
#define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/ #define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
#define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/ #define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/
#define LV_MAX_ANCESTOR_NUM 8 #define LV_MAX_ANCESTOR_NUM 8
/********************** /**********************
@@ -64,7 +64,7 @@ typedef enum
LV_DESIGN_DRAW_MAIN, LV_DESIGN_DRAW_MAIN,
LV_DESIGN_DRAW_POST, LV_DESIGN_DRAW_POST,
LV_DESIGN_COVER_CHK, LV_DESIGN_COVER_CHK,
}lv_design_mode_t; } lv_design_mode_t;
typedef bool (* lv_design_func_t) (struct _lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode); typedef bool (* lv_design_func_t) (struct _lv_obj_t * obj, const lv_area_t * mask_p, lv_design_mode_t mode);
@@ -72,19 +72,19 @@ typedef enum
{ {
LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/ LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK, /*The object is valid (no deleted) after the action*/ LV_RES_OK, /*The object is valid (no deleted) after the action*/
}lv_res_t; } lv_res_t;
typedef enum typedef enum
{ {
/*General signals*/ /*General signals*/
LV_SIGNAL_CLEANUP, LV_SIGNAL_CLEANUP,
LV_SIGNAL_CHILD_CHG, LV_SIGNAL_CHILD_CHG,
LV_SIGNAL_CORD_CHG, LV_SIGNAL_CORD_CHG,
LV_SIGNAL_STYLE_CHG, LV_SIGNAL_STYLE_CHG,
LV_SIGNAL_REFR_EXT_SIZE, LV_SIGNAL_REFR_EXT_SIZE,
LV_SIGNAL_GET_TYPE, LV_SIGNAL_GET_TYPE,
/*Input device related*/ /*Input device related*/
LV_SIGNAL_PRESSED, LV_SIGNAL_PRESSED,
LV_SIGNAL_PRESSING, LV_SIGNAL_PRESSING,
LV_SIGNAL_PRESS_LOST, LV_SIGNAL_PRESS_LOST,
@@ -94,11 +94,11 @@ typedef enum
LV_SIGNAL_DRAG_BEGIN, LV_SIGNAL_DRAG_BEGIN,
LV_SIGNAL_DRAG_END, LV_SIGNAL_DRAG_END,
/*Group related*/ /*Group related*/
LV_SIGNAL_FOCUS, LV_SIGNAL_FOCUS,
LV_SIGNAL_DEFOCUS, LV_SIGNAL_DEFOCUS,
LV_SIGNAL_CONTROLL, LV_SIGNAL_CONTROLL,
}lv_signal_t; } lv_signal_t;
typedef lv_res_t (* lv_signal_func_t) (struct _lv_obj_t * obj, lv_signal_t sign, void * param); typedef lv_res_t (* lv_signal_func_t) (struct _lv_obj_t * obj, lv_signal_t sign, void * param);
@@ -124,21 +124,21 @@ typedef struct _lv_obj_t
#endif #endif
/*Attributes and states*/ /*Attributes and states*/
uint8_t click :1; /*1: Can be pressed by an input device*/ uint8_t click :1; /*1: Can be pressed by an input device*/
uint8_t drag :1; /*1: Enable the dragging*/ uint8_t drag :1; /*1: Enable the dragging*/
uint8_t drag_throw :1; /*1: Enable throwing with drag*/ uint8_t drag_throw :1; /*1: Enable throwing with drag*/
uint8_t drag_parent :1; /*1: Parent will be dragged instead*/ uint8_t drag_parent :1; /*1: Parent will be dragged instead*/
uint8_t hidden :1; /*1: Object is hidden*/ uint8_t hidden :1; /*1: Object is hidden*/
uint8_t top :1; /*1: If the object or its children is clicked it goes to the foreground*/ uint8_t top :1; /*1: If the object or its children is clicked it goes to the foreground*/
uint8_t opa_scale_en :1; /*1: opa_scale is set*/ uint8_t opa_scale_en :1; /*1: opa_scale is set*/
lv_opa_t opa_scale; /*Scale down the opacity by this factor. Effects all children as well*/ lv_opa_t opa_scale; /*Scale down the opacity by this factor. Effects all children as well*/
uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/ uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/
lv_coord_t ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/ lv_coord_t ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/
#ifdef LV_OBJ_FREE_NUM_TYPE #ifdef LV_OBJ_FREE_NUM_TYPE
LV_OBJ_FREE_NUM_TYPE free_num; /*Application specific identifier (set it freely)*/ LV_OBJ_FREE_NUM_TYPE free_num; /*Application specific identifier (set it freely)*/
#endif #endif
}lv_obj_t; } lv_obj_t;
typedef lv_res_t (*lv_action_t) (struct _lv_obj_t * obj); typedef lv_res_t (*lv_action_t) (struct _lv_obj_t * obj);
@@ -151,13 +151,13 @@ typedef enum
LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/ LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/
LV_PROTECT_FOLLOW = 0x08, /*Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)*/ LV_PROTECT_FOLLOW = 0x08, /*Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)*/
LV_PROTECT_PRESS_LOST= 0x10, /*TODO */ LV_PROTECT_PRESS_LOST= 0x10, /*TODO */
}lv_protect_t; } lv_protect_t;
/*Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/ /*Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/
typedef struct { typedef struct {
const char * type[LV_MAX_ANCESTOR_NUM]; /*[0]: the actual type, [1]: ancestor, [2] #1's ancestor ... [x]: "lv_obj" */ const char * type[LV_MAX_ANCESTOR_NUM]; /*[0]: the actual type, [1]: ancestor, [2] #1's ancestor ... [x]: "lv_obj" */
}lv_obj_type_t; } lv_obj_type_t;
typedef enum typedef enum
{ {
@@ -182,18 +182,18 @@ typedef enum
LV_ALIGN_OUT_RIGHT_TOP, LV_ALIGN_OUT_RIGHT_TOP,
LV_ALIGN_OUT_RIGHT_MID, LV_ALIGN_OUT_RIGHT_MID,
LV_ALIGN_OUT_RIGHT_BOTTOM, LV_ALIGN_OUT_RIGHT_BOTTOM,
}lv_align_t; } lv_align_t;
typedef enum typedef enum
{ {
LV_ANIM_NONE = 0, LV_ANIM_NONE = 0,
LV_ANIM_FLOAT_TOP, /*Float from/to the top*/ LV_ANIM_FLOAT_TOP, /*Float from/to the top*/
LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/ LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/
LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/ LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/
LV_ANIM_FLOAT_RIGHT, /*Float from/to the right*/ LV_ANIM_FLOAT_RIGHT, /*Float from/to the right*/
LV_ANIM_GROW_H, /*Grow/shrink horizontally*/ LV_ANIM_GROW_H, /*Grow/shrink horizontally*/
LV_ANIM_GROW_V, /*Grow/shrink vertically*/ LV_ANIM_GROW_V, /*Grow/shrink vertically*/
}lv_anim_builtin_t; } lv_anim_builtin_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
+43 -47
View File
@@ -21,11 +21,10 @@
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
typedef struct typedef struct {
{
lv_area_t area; lv_area_t area;
uint8_t joined; uint8_t joined;
}lv_join_t; } lv_join_t;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
@@ -49,7 +48,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p);
static lv_join_t inv_buf[LV_INV_FIFO_SIZE]; static lv_join_t inv_buf[LV_INV_FIFO_SIZE];
static uint16_t inv_buf_p; static uint16_t inv_buf_p;
static void (*monitor_cb)(uint32_t, uint32_t); /*Monitor the rendering time*/ static void (*monitor_cb)(uint32_t, uint32_t); /*Monitor the rendering time*/
static void (*round_cb)(lv_area_t*); /*If set then called to modify invalidated areas for special display controllers*/ static void (*round_cb)(lv_area_t *); /*If set then called to modify invalidated areas for special display controllers*/
static uint32_t px_num; static uint32_t px_num;
/********************** /**********************
@@ -68,7 +67,7 @@ void lv_refr_init(void)
inv_buf_p = 0; inv_buf_p = 0;
memset(inv_buf, 0, sizeof(inv_buf)); memset(inv_buf, 0, sizeof(inv_buf));
lv_task_t* task; lv_task_t * task;
task = lv_task_create(lv_refr_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL); task = lv_task_create(lv_refr_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
lv_task_ready(task); /*Be sure the screen will be refreshed immediately on start up*/ lv_task_ready(task); /*Be sure the screen will be refreshed immediately on start up*/
} }
@@ -100,20 +99,20 @@ void lv_inv_area(const lv_area_t * area_p)
if(suc != false) { if(suc != false) {
if(round_cb) round_cb(&com_area); if(round_cb) round_cb(&com_area);
/*Save only if this area is not in one of the saved areas*/ /*Save only if this area is not in one of the saved areas*/
uint16_t i; uint16_t i;
for(i = 0; i < inv_buf_p; i++) { for(i = 0; i < inv_buf_p; i++) {
if(lv_area_is_in(&com_area, &inv_buf[i].area) != false) return; if(lv_area_is_in(&com_area, &inv_buf[i].area) != false) return;
} }
/*Save the area*/ /*Save the area*/
if(inv_buf_p < LV_INV_FIFO_SIZE) { if(inv_buf_p < LV_INV_FIFO_SIZE) {
lv_area_copy(&inv_buf[inv_buf_p].area,&com_area); lv_area_copy(&inv_buf[inv_buf_p].area, &com_area);
} else {/*If no place for the area add the screen*/ } else {/*If no place for the area add the screen*/
inv_buf_p = 0; inv_buf_p = 0;
lv_area_copy(&inv_buf[inv_buf_p].area,&scr_area); lv_area_copy(&inv_buf[inv_buf_p].area, &scr_area);
} }
inv_buf_p ++; inv_buf_p ++;
} }
} }
@@ -134,7 +133,7 @@ void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t))
* Special display controllers may require special coordinate rounding * Special display controllers may require special coordinate rounding
* @param cb pointer to the a function which will modify the area * @param cb pointer to the a function which will modify the area
*/ */
void lv_refr_set_round_cb(void(*cb)(lv_area_t*)) void lv_refr_set_round_cb(void(*cb)(lv_area_t *))
{ {
round_cb = cb; round_cb = cb;
} }
@@ -211,17 +210,16 @@ static void lv_refr_join_area(void)
/*Check if the areas are on each other*/ /*Check if the areas are on each other*/
if(lv_area_is_on(&inv_buf[join_in].area, if(lv_area_is_on(&inv_buf[join_in].area,
&inv_buf[join_from].area) == false) &inv_buf[join_from].area) == false) {
{
continue; continue;
} }
lv_area_join(&joined_area, &inv_buf[join_in].area, lv_area_join(&joined_area, &inv_buf[join_in].area,
&inv_buf[join_from].area); &inv_buf[join_from].area);
/*Join two area only if the joined area size is smaller*/ /*Join two area only if the joined area size is smaller*/
if(lv_area_get_size(&joined_area) < if(lv_area_get_size(&joined_area) <
(lv_area_get_size(&inv_buf[join_in].area) + lv_area_get_size(&inv_buf[join_from].area))) { (lv_area_get_size(&inv_buf[join_in].area) + lv_area_get_size(&inv_buf[join_from].area))) {
lv_area_copy(&inv_buf[join_in].area, &joined_area); lv_area_copy(&inv_buf[join_in].area, &joined_area);
/*Mark 'join_form' is joined into 'join_in'*/ /*Mark 'join_form' is joined into 'join_in'*/
@@ -360,8 +358,7 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
lv_obj_t * found_p = NULL; lv_obj_t * found_p = NULL;
/*If this object is fully cover the draw area check the children too */ /*If this object is fully cover the draw area check the children too */
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
{
LL_READ(obj->child_ll, i) { LL_READ(obj->child_ll, i) {
found_p = lv_refr_get_top_obj(area_p, i); found_p = lv_refr_get_top_obj(area_p, i);
@@ -375,8 +372,8 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
if(found_p == NULL) { if(found_p == NULL) {
lv_style_t * style = lv_obj_get_style(obj); lv_style_t * style = lv_obj_get_style(obj);
if(style->body.opa == LV_OPA_COVER && if(style->body.opa == LV_OPA_COVER &&
obj->design_func(obj, area_p, LV_DESIGN_COVER_CHK) != false && obj->design_func(obj, area_p, LV_DESIGN_COVER_CHK) != false &&
lv_obj_get_opa_scale(obj) == LV_OPA_COVER) { lv_obj_get_opa_scale(obj) == LV_OPA_COVER) {
found_p = obj; found_p = obj;
} }
} }
@@ -471,32 +468,31 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
lv_obj_get_coords(obj, &obj_area); lv_obj_get_coords(obj, &obj_area);
union_ok = lv_area_union(&obj_mask, mask_ori_p, &obj_area); union_ok = lv_area_union(&obj_mask, mask_ori_p, &obj_area);
if(union_ok != false) { if(union_ok != false) {
lv_area_t mask_child; /*Mask from obj and its child*/ lv_area_t mask_child; /*Mask from obj and its child*/
lv_obj_t * child_p; lv_obj_t * child_p;
lv_area_t child_area; lv_area_t child_area;
LL_READ_BACK(obj->child_ll, child_p) LL_READ_BACK(obj->child_ll, child_p) {
{ lv_obj_get_coords(child_p, &child_area);
lv_obj_get_coords(child_p, &child_area); ext_size = child_p->ext_size;
ext_size = child_p->ext_size; child_area.x1 -= ext_size;
child_area.x1 -= ext_size; child_area.y1 -= ext_size;
child_area.y1 -= ext_size; child_area.x2 += ext_size;
child_area.x2 += ext_size; child_area.y2 += ext_size;
child_area.y2 += ext_size; /* Get the union (common parts) of original mask (from obj)
/* Get the union (common parts) of original mask (from obj) * and its child */
* and its child */ union_ok = lv_area_union(&mask_child, &obj_mask, &child_area);
union_ok = lv_area_union(&mask_child, &obj_mask, &child_area);
/*If the parent and the child has common area then refresh the child */ /*If the parent and the child has common area then refresh the child */
if(union_ok) { if(union_ok) {
/*Refresh the next children*/ /*Refresh the next children*/
lv_refr_obj(child_p, &mask_child); lv_refr_obj(child_p, &mask_child);
} }
} }
} }
/* If all the children are redrawn make 'post draw' design */ /* If all the children are redrawn make 'post draw' design */
if(style->body.opa != LV_OPA_TRANSP) { if(style->body.opa != LV_OPA_TRANSP) {
obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST); obj->design_func(obj, &obj_ext_mask, LV_DESIGN_DRAW_POST);
} }
} }
} }
+7 -7
View File
@@ -29,9 +29,9 @@
typedef struct { typedef struct {
lv_style_t style_start; /*Save not only pointers because can be same as 'style_anim' then it will be modified too*/ lv_style_t style_start; /*Save not only pointers because can be same as 'style_anim' then it will be modified too*/
lv_style_t style_end; lv_style_t style_end;
lv_style_t *style_anim; lv_style_t * style_anim;
void (*end_cb)(void *); void (*end_cb)(void *);
}lv_style_anim_dsc_t; } lv_style_anim_dsc_t;
#endif #endif
/********************** /**********************
@@ -39,7 +39,7 @@ typedef struct {
**********************/ **********************/
#if USE_LV_ANIMATION #if USE_LV_ANIMATION
static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val); static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val);
static void style_animation_common_end_cb(void *ptr); static void style_animation_common_end_cb(void * ptr);
#endif #endif
/********************** /**********************
@@ -70,7 +70,7 @@ lv_style_t lv_style_btn_ina;
/** /**
* Init the basic styles * Init the basic styles
*/ */
void lv_style_init (void) void lv_style_init(void)
{ {
/* Not White/Black/Gray colors are created by HSV model with /* Not White/Black/Gray colors are created by HSV model with
* HUE = 210*/ * HUE = 210*/
@@ -236,7 +236,7 @@ void * lv_style_anim_create(lv_style_anim_t * anim)
lv_anim_t a; lv_anim_t a;
a.var = (void*)dsc; a.var = (void *)dsc;
a.start = 0; a.start = 0;
a.end = LV_STYLE_ANIM_RES; a.end = LV_STYLE_ANIM_RES;
a.fp = (lv_anim_fp_t)style_animator; a.fp = (lv_anim_fp_t)style_animator;
@@ -317,9 +317,9 @@ static void style_animator(lv_style_anim_dsc_t * dsc, int32_t val)
* It called the user defined call back and free the allocated memories * It called the user defined call back and free the allocated memories
* @param ptr the 'animated variable' set by lv_style_anim_create() * @param ptr the 'animated variable' set by lv_style_anim_create()
*/ */
static void style_animation_common_end_cb(void *ptr) static void style_animation_common_end_cb(void * ptr)
{ {
lv_style_anim_dsc_t *dsc = ptr; /*To avoid casting*/ lv_style_anim_dsc_t * dsc = ptr; /*To avoid casting*/
if(dsc->end_cb) dsc->end_cb(dsc); if(dsc->end_cb) dsc->end_cb(dsc);
+15 -15
View File
@@ -37,27 +37,27 @@ typedef enum
LV_BORDER_LEFT = 0x04, LV_BORDER_LEFT = 0x04,
LV_BORDER_RIGHT = 0x08, LV_BORDER_RIGHT = 0x08,
LV_BORDER_FULL = 0x0F, LV_BORDER_FULL = 0x0F,
}lv_border_part_t; } lv_border_part_t;
/*Shadow types*/ /*Shadow types*/
typedef enum typedef enum
{ {
LV_SHADOW_BOTTOM = 0, LV_SHADOW_BOTTOM = 0,
LV_SHADOW_FULL, LV_SHADOW_FULL,
}lv_shadow_type_t; } lv_shadow_type_t;
typedef struct typedef struct
{ {
uint8_t glass :1; /*1: Do not inherit this style*/ uint8_t glass :1; /*1: Do not inherit this style*/
struct { struct {
lv_color_t main_color; lv_color_t main_color;
union { union {
lv_color_t grad_color; /*`grad_color` will be removed in v6.0, use `aux_color` instead*/ lv_color_t grad_color; /*`grad_color` will be removed in v6.0, use `aux_color` instead*/
lv_color_t aux_color; lv_color_t aux_color;
}; };
lv_coord_t radius; lv_coord_t radius;
lv_coord_t thickness; /*Depending on the object type thickness of something*/ lv_coord_t thickness; /*Depending on the object type thickness of something*/
lv_opa_t opa; lv_opa_t opa;
struct { struct {
@@ -65,22 +65,22 @@ typedef struct
lv_coord_t width; lv_coord_t width;
lv_border_part_t part; lv_border_part_t part;
lv_opa_t opa; lv_opa_t opa;
}border; } border;
struct { struct {
lv_color_t color; lv_color_t color;
lv_coord_t width; lv_coord_t width;
uint8_t type; uint8_t type;
}shadow; } shadow;
struct { struct {
lv_coord_t ver; lv_coord_t ver;
lv_coord_t hor; lv_coord_t hor;
lv_coord_t inner; lv_coord_t inner;
}padding; } padding;
uint8_t empty :1; /*Transparent background (border still drawn)*/ uint8_t empty :1; /*Transparent background (border still drawn)*/
}body; } body;
struct { struct {
@@ -89,20 +89,20 @@ typedef struct
lv_coord_t letter_space; lv_coord_t letter_space;
lv_coord_t line_space; lv_coord_t line_space;
lv_opa_t opa; lv_opa_t opa;
}text; } text;
struct { struct {
lv_color_t color; lv_color_t color;
lv_opa_t intense; lv_opa_t intense;
lv_opa_t opa; lv_opa_t opa;
}image; } image;
struct { struct {
lv_color_t color; lv_color_t color;
lv_coord_t width; lv_coord_t width;
lv_opa_t opa; lv_opa_t opa;
}line; } line;
}lv_style_t; } lv_style_t;
#if USE_LV_ANIMATION #if USE_LV_ANIMATION
typedef struct { typedef struct {
@@ -116,7 +116,7 @@ typedef struct {
uint16_t repeat_pause; /*Wait before repeat*/ uint16_t repeat_pause; /*Wait before repeat*/
uint8_t playback :1; /*When the animation is ready play it back*/ uint8_t playback :1; /*When the animation is ready play it back*/
uint8_t repeat :1; /*Repeat the animation infinitely*/ uint8_t repeat :1; /*Repeat the animation infinitely*/
}lv_style_anim_t; } lv_style_anim_t;
/* Example initialization /* Example initialization
lv_style_anim_t a; lv_style_anim_t a;
+16 -16
View File
@@ -36,27 +36,27 @@ typedef enum {
#if LV_VDB_DOUBLE == 0 #if LV_VDB_DOUBLE == 0
/*Simple VDB*/ /*Simple VDB*/
static volatile lv_vdb_state_t vdb_state = LV_VDB_STATE_ACTIVE; static volatile lv_vdb_state_t vdb_state = LV_VDB_STATE_ACTIVE;
# if LV_VDB_ADR == 0 # if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/ /*If the buffer address is not specified simply allocate it*/
static lv_color_t vdb_buf[LV_VDB_SIZE]; static lv_color_t vdb_buf[LV_VDB_SIZE];
static lv_vdb_t vdb = {.buf = vdb_buf}; static lv_vdb_t vdb = {.buf = vdb_buf};
# else # else
/*If the buffer address is specified use that address*/ /*If the buffer address is specified use that address*/
static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR}; static lv_vdb_t vdb = {.buf = (lv_color_t *)LV_VDB_ADR};
# endif # endif
#else #else
/*Double VDB*/ /*Double VDB*/
static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_FREE}; static volatile lv_vdb_state_t vdb_state[2] = {LV_VDB_STATE_FREE, LV_VDB_STATE_FREE};
# if LV_VDB_ADR == 0 # if LV_VDB_ADR == 0
/*If the buffer address is not specified simply allocate it*/ /*If the buffer address is not specified simply allocate it*/
static lv_color_t vdb_buf1[LV_VDB_SIZE]; static lv_color_t vdb_buf1[LV_VDB_SIZE];
static lv_color_t vdb_buf2[LV_VDB_SIZE]; static lv_color_t vdb_buf2[LV_VDB_SIZE];
static lv_vdb_t vdb[2] = {{.buf = vdb_buf1}, {.buf = vdb_buf2}}; static lv_vdb_t vdb[2] = {{.buf = vdb_buf1}, {.buf = vdb_buf2}};
# else # else
/*If the buffer address is specified use that address*/ /*If the buffer address is specified use that address*/
static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *)LV_VDB_ADR}, {.buf = (lv_color_t *)LV_VDB2_ADR}}; static lv_vdb_t vdb[2] = {{.buf = (lv_color_t *)LV_VDB_ADR}, {.buf = (lv_color_t *)LV_VDB2_ADR}};
# endif # endif
#endif #endif
@@ -120,7 +120,7 @@ void lv_vdb_flush(void)
#endif #endif
/*Flush the rendered content to the display*/ /*Flush the rendered content to the display*/
lv_disp_flush(vdb_act->area.x1, vdb_act->area.y1, vdb_act->area.x2, vdb_act->area.y2, vdb_act->buf); lv_disp_flush(vdb_act->area.x1, vdb_act->area.y1, vdb_act->area.x2, vdb_act->area.y2, vdb_act->buf);
} }
+1 -1
View File
@@ -32,7 +32,7 @@ typedef struct
{ {
lv_area_t area; lv_area_t area;
lv_color_t *buf; lv_color_t *buf;
}lv_vdb_t; } lv_vdb_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
+87 -86
View File
@@ -40,8 +40,8 @@ void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t col
void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter; void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_vletter;
# if USE_LV_IMG # if USE_LV_IMG
void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p, void (*map_fp)(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap; lv_color_t recolor, lv_opa_t recolor_opa) = lv_vmap;
# endif /*USE_LV_IMG*/ # endif /*USE_LV_IMG*/
#elif USE_LV_REAL_DRAW != 0 #elif USE_LV_REAL_DRAW != 0
/* px_fp used only by shadow drawing and anti aliasing /* px_fp used only by shadow drawing and anti aliasing
@@ -51,8 +51,8 @@ static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_colo
static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter; static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = lv_rletter;
# if USE_LV_IMG # if USE_LV_IMG
static void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p, static void (*map_fp)(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap; lv_color_t recolor, lv_opa_t recolor_opa) = lv_rmap;
# endif /*USE_LV_IMG*/ # endif /*USE_LV_IMG*/
#else #else
/*Invalid settings. Compiler error will be thrown*/ /*Invalid settings. Compiler error will be thrown*/
@@ -60,8 +60,8 @@ static void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_colo
static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = NULL; static void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) = NULL;
static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = NULL; static void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa) = NULL;
static void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p, static void (*map_fp)(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) = NULL; lv_color_t recolor, lv_opa_t recolor_opa) = NULL;
#endif #endif
@@ -77,7 +77,7 @@ static void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
#if LV_ANTIALIAS != 0 #if LV_ANTIALIAS != 0
/** /**
* Get the opacity of a pixel based it's position in a line segment * Get the opacity of a pixel based it's position in a line segment
@@ -86,94 +86,95 @@ static void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p,
* @param base_opa the base opacity * @param base_opa the base opacity
* @return the opacity of the given pixel * @return the opacity of the given pixel
*/ */
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa) lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa)
{ {
/* How to calculate the opacity of pixels on the edges which makes the anti-aliasing? /* How to calculate the opacity of pixels on the edges which makes the anti-aliasing?
* For example we have a line like this (y = -0.5 * x): * For example we have a line like this (y = -0.5 * x):
* *
* | _ _ * | _ _
* * * | * * * |
* *
* Anti-aliased pixels come to the '*' characters * Anti-aliased pixels come to the '*' characters
* Calculate what percentage of the pixels should be covered if real line (not rasterized) would be drawn: * Calculate what percentage of the pixels should be covered if real line (not rasterized) would be drawn:
* 1. A real line should start on (0;0) and end on (2;1) * 1. A real line should start on (0;0) and end on (2;1)
* 2. So the line intersection coordinates on the first pixel: (0;0) (1;0.5) -> 25% covered pixel in average * 2. So the line intersection coordinates on the first pixel: (0;0) (1;0.5) -> 25% covered pixel in average
* 3. For the second pixel: (1;0.5) (2;1) -> 75% covered pixel in average * 3. For the second pixel: (1;0.5) (2;1) -> 75% covered pixel in average
* 4. The equation: (px_id * 2 + 1) / (segment_width * 2) * 4. The equation: (px_id * 2 + 1) / (segment_width * 2)
* segment_width: the line segment which is being anti-aliased (was 2 in the example) * segment_width: the line segment which is being anti-aliased (was 2 in the example)
* px_id: pixel ID from 0 to (segment_width - 1) * px_id: pixel ID from 0 to (segment_width - 1)
* result: [0..1] coverage of the pixel * result: [0..1] coverage of the pixel
*/ */
/*Accelerate the common segment sizes to avoid division*/ /*Accelerate the common segment sizes to avoid division*/
static const lv_opa_t seg1[1] = {128}; static const lv_opa_t seg1[1] = {128};
static const lv_opa_t seg2[2] = {64, 192}; static const lv_opa_t seg2[2] = {64, 192};
static const lv_opa_t seg3[3] = {42, 128, 212}; static const lv_opa_t seg3[3] = {42, 128, 212};
static const lv_opa_t seg4[4] = {32, 96, 159, 223}; static const lv_opa_t seg4[4] = {32, 96, 159, 223};
static const lv_opa_t seg5[5] = {26, 76, 128, 178, 230}; static const lv_opa_t seg5[5] = {26, 76, 128, 178, 230};
static const lv_opa_t seg6[6] = {21, 64, 106, 148, 191, 234}; static const lv_opa_t seg6[6] = {21, 64, 106, 148, 191, 234};
static const lv_opa_t seg7[7] = {18, 55, 91, 128, 164, 200, 237}; static const lv_opa_t seg7[7] = {18, 55, 91, 128, 164, 200, 237};
static const lv_opa_t seg8[8] = {16, 48, 80, 112, 143, 175, 207, 239}; static const lv_opa_t seg8[8] = {16, 48, 80, 112, 143, 175, 207, 239};
static const lv_opa_t * seg_map[] = {seg1, seg2, seg3, seg4, static const lv_opa_t * seg_map[] = {seg1, seg2, seg3, seg4,
seg5, seg6, seg7, seg8}; seg5, seg6, seg7, seg8
};
if(seg == 0) return LV_OPA_TRANSP; if(seg == 0) return LV_OPA_TRANSP;
else if(seg < 8) return (uint32_t)((uint32_t)seg_map[seg - 1][px_id] * base_opa) >> 8; else if(seg < 8) return (uint32_t)((uint32_t)seg_map[seg - 1][px_id] * base_opa) >> 8;
else { else {
return ((px_id * 2 + 1) * base_opa) / (2 * seg); return ((px_id * 2 + 1) * base_opa) / (2 * seg);
} }
} }
/** /**
* Add a vertical anti-aliasing segment (pixels with decreasing opacity) * Add a vertical anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate * @param x start point x coordinate
* @param y start point y coordinate * @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity) * @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area * @param mask draw only in this area
* @param color color of pixels * @param color color of pixels
* @param opa maximum opacity * @param opa maximum opacity
*/ */
void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) void lv_draw_aa_ver_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa)
{ {
bool aa_inv = false; bool aa_inv = false;
if(length < 0) { if(length < 0) {
aa_inv = true; aa_inv = true;
length = -length; length = -length;
} }
lv_coord_t i; lv_coord_t i;
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa); lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa; if(aa_inv) px_opa = opa - px_opa;
px_fp(x, y + i, mask, color, px_opa); px_fp(x, y + i, mask, color, px_opa);
} }
} }
/** /**
* Add a horizontal anti-aliasing segment (pixels with decreasing opacity) * Add a horizontal anti-aliasing segment (pixels with decreasing opacity)
* @param x start point x coordinate * @param x start point x coordinate
* @param y start point y coordinate * @param y start point y coordinate
* @param length length of segment (negative value to start from 0 opacity) * @param length length of segment (negative value to start from 0 opacity)
* @param mask draw only in this area * @param mask draw only in this area
* @param color color of pixels * @param color color of pixels
* @param opa maximum opacity * @param opa maximum opacity
*/ */
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa) void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color, lv_opa_t opa)
{ {
bool aa_inv = false; bool aa_inv = false;
if(length < 0) { if(length < 0) {
aa_inv = true; aa_inv = true;
length = -length; length = -length;
} }
lv_coord_t i; lv_coord_t i;
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa); lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
if(aa_inv) px_opa = opa - px_opa; if(aa_inv) px_opa = opa - px_opa;
px_fp(x + i, y, mask, color, px_opa); px_fp(x + i, y, mask, color, px_opa);
} }
} }
#endif #endif
+8 -8
View File
@@ -36,14 +36,14 @@ extern "C" {
* the result image converter utility*/ * the result image converter utility*/
typedef struct typedef struct
{ {
union{ union {
struct { struct {
uint32_t chroma_keyed:1; /*1: The image contains transparent pixels with LV_COLOR_TRANSP color*/ uint32_t chroma_keyed:1; /*1: The image contains transparent pixels with LV_COLOR_TRANSP color*/
uint32_t alpha_byte :1; /*Every pixel is extended with a 8 bit alpha channel*/ uint32_t alpha_byte :1; /*Every pixel is extended with a 8 bit alpha channel*/
uint32_t format :6; /*See: lv_img_px_format*/ uint32_t format :6; /*See: lv_img_px_format*/
uint32_t w:12; /*Width of the image map*/ uint32_t w:12; /*Width of the image map*/
uint32_t h:12; /*Height of the image map*/ uint32_t h:12; /*Height of the image map*/
}header; } header;
uint8_t src_type; uint8_t src_type;
}; };
@@ -51,7 +51,7 @@ typedef struct
const uint8_t * pixel_map; /*For internal images (c arrays) pointer to the pixels array*/ const uint8_t * pixel_map; /*For internal images (c arrays) pointer to the pixels array*/
uint8_t first_pixel; /*For external images (binary) the first byte of the pixels (just for convenient)*/ uint8_t first_pixel; /*For external images (binary) the first byte of the pixels (just for convenient)*/
}; };
}lv_img_t; } lv_img_t;
typedef enum { typedef enum {
LV_IMG_FORMAT_UNKOWN = 0, LV_IMG_FORMAT_UNKOWN = 0,
@@ -59,7 +59,7 @@ typedef enum {
LV_IMG_FORMAT_FILE_RAW_RGB332, /*8 bit*/ LV_IMG_FORMAT_FILE_RAW_RGB332, /*8 bit*/
LV_IMG_FORMAT_FILE_RAW_RGB565, /*16 bit*/ LV_IMG_FORMAT_FILE_RAW_RGB565, /*16 bit*/
LV_IMG_FORMAT_FILE_RAW_RGB888, /*24 bit (stored on 32 bit)*/ LV_IMG_FORMAT_FILE_RAW_RGB888, /*24 bit (stored on 32 bit)*/
}lv_img_format_t; } lv_img_format_t;
typedef enum { typedef enum {
@@ -67,7 +67,7 @@ typedef enum {
LV_IMG_SRC_FILE, LV_IMG_SRC_FILE,
LV_IMG_SRC_SYMBOL, LV_IMG_SRC_SYMBOL,
LV_IMG_SRC_UNKNOWN, LV_IMG_SRC_UNKNOWN,
}lv_img_src_t; } lv_img_src_t;
/********************** /**********************
@@ -83,7 +83,7 @@ typedef enum {
* @param base_opa the base opacity * @param base_opa the base opacity
* @return the opacity of the given pixel * @return the opacity of the given pixel
*/ */
lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa); lv_opa_t lv_draw_aa_get_opa(lv_coord_t seg, lv_coord_t px_id, lv_opa_t base_opa);
/** /**
* Add a vertical anti-aliasing segment (pixels with decreasing opacity) * Add a vertical anti-aliasing segment (pixels with decreasing opacity)
@@ -115,8 +115,8 @@ void (*px_fp)(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_color_t col
void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa); void (*fill_fp)(const lv_area_t * coords, const lv_area_t * mask, lv_color_t color, lv_opa_t opa);
void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa); void (*letter_fp)(const lv_point_t * pos_p, const lv_area_t * mask, const lv_font_t * font_p, uint32_t letter, lv_color_t color, lv_opa_t opa);
void (*map_fp)(const lv_area_t * cords_p, const lv_area_t * mask_p, void (*map_fp)(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa); lv_color_t recolor, lv_opa_t recolor_opa);
/********************** /**********************
* MACROS * MACROS
+116 -128
View File
@@ -50,10 +50,10 @@ static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end);
* @param opa_scale scale down all opacities by the factor * @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask, void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask,
uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale) uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale)
{ {
lv_coord_t thickness = style->body.thickness; lv_coord_t thickness = style->body.thickness;
if(thickness > radius) thickness = radius; if(thickness > radius) thickness = radius;
lv_coord_t r_out = radius; lv_coord_t r_out = radius;
lv_coord_t r_in = r_out - thickness; lv_coord_t r_in = r_out - thickness;
@@ -72,13 +72,13 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, cons
// Good, may not be the fastest // Good, may not be the fastest
// Does not draw overlapping pixels // Does not draw overlapping pixels
if (deg_test(270, start_angle, end_angle)) hor_line(center_x - r_out + 1, center_y, mask, thickness - 1, color, opa); // Left Middle if(deg_test(270, start_angle, end_angle)) hor_line(center_x - r_out + 1, center_y, mask, thickness - 1, color, opa); // Left Middle
if (deg_test(90, start_angle, end_angle)) hor_line(center_x + r_in, center_y, mask, thickness - 1, color, opa); // Right Middle if(deg_test(90, start_angle, end_angle)) hor_line(center_x + r_in, center_y, mask, thickness - 1, color, opa); // Right Middle
if (deg_test(180, start_angle, end_angle)) ver_line(center_x, center_y - r_out + 1, mask, thickness - 1, color, opa); // Top Middle if(deg_test(180, start_angle, end_angle)) ver_line(center_x, center_y - r_out + 1, mask, thickness - 1, color, opa); // Top Middle
if (deg_test(0, start_angle, end_angle)) ver_line(center_x, center_y + r_in, mask, thickness - 1, color, opa); // Bottom middle if(deg_test(0, start_angle, end_angle)) ver_line(center_x, center_y + r_in, mask, thickness - 1, color, opa); // Bottom middle
lv_point_t last_corner_out = {-r_out, -r_out}; lv_point_t last_corner_out = { -r_out, -r_out};
uint32_t r_out_sqr = r_out * r_out; uint32_t r_out_sqr = r_out * r_out;
uint32_t r_in_sqr = r_in * r_in; uint32_t r_in_sqr = r_in * r_in;
int16_t xi; int16_t xi;
@@ -92,64 +92,64 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, cons
x_end[1] = LV_COORD_MIN; x_end[1] = LV_COORD_MIN;
x_end[2] = LV_COORD_MIN; x_end[2] = LV_COORD_MIN;
x_end[3] = LV_COORD_MIN; x_end[3] = LV_COORD_MIN;
for(xi= -r_out; xi < 0; xi++) { for(xi = -r_out; xi < 0; xi++) {
uint32_t r_act_sqr = xi * xi + yi * yi; uint32_t r_act_sqr = xi * xi + yi * yi;
if(r_act_sqr > r_out_sqr) continue; if(r_act_sqr > r_out_sqr) continue;
deg_base = fast_atan2(xi, yi) - 180; deg_base = fast_atan2(xi, yi) - 180;
deg = 180 + deg_base; deg = 180 + deg_base;
if (deg_test(deg, start_angle, end_angle)) { if(deg_test(deg, start_angle, end_angle)) {
if(x_start[0] == LV_COORD_MIN) x_start[0] = xi; if(x_start[0] == LV_COORD_MIN) x_start[0] = xi;
} else if(x_start[0] != LV_COORD_MIN && x_end[0] == LV_COORD_MIN) { } else if(x_start[0] != LV_COORD_MIN && x_end[0] == LV_COORD_MIN) {
x_end[0] = xi - 1; x_end[0] = xi - 1;
} }
deg = 360 - deg_base; deg = 360 - deg_base;
if (deg_test(deg, start_angle, end_angle)) { if(deg_test(deg, start_angle, end_angle)) {
if(x_start[1] == LV_COORD_MIN) x_start[1] = xi; if(x_start[1] == LV_COORD_MIN) x_start[1] = xi;
} else if(x_start[1] != LV_COORD_MIN && x_end[1] == LV_COORD_MIN) { } else if(x_start[1] != LV_COORD_MIN && x_end[1] == LV_COORD_MIN) {
x_end[1] = xi - 1; x_end[1] = xi - 1;
} }
deg = 180 - deg_base; deg = 180 - deg_base;
if (deg_test(deg, start_angle, end_angle)) { if(deg_test(deg, start_angle, end_angle)) {
if(x_start[2] == LV_COORD_MIN) x_start[2] = xi; if(x_start[2] == LV_COORD_MIN) x_start[2] = xi;
} else if(x_start[2] != LV_COORD_MIN && x_end[2] == LV_COORD_MIN) { } else if(x_start[2] != LV_COORD_MIN && x_end[2] == LV_COORD_MIN) {
x_end[2] = xi - 1; x_end[2] = xi - 1;
} }
deg = deg_base; deg = deg_base;
if (deg_test(deg, start_angle, end_angle)) { if(deg_test(deg, start_angle, end_angle)) {
if(x_start[3] == LV_COORD_MIN) x_start[3] = xi; if(x_start[3] == LV_COORD_MIN) x_start[3] = xi;
} else if(x_start[3] != LV_COORD_MIN && x_end[3] == LV_COORD_MIN) { } else if(x_start[3] != LV_COORD_MIN && x_end[3] == LV_COORD_MIN) {
x_end[3] = xi - 1; x_end[3] = xi - 1;
} }
if(r_act_sqr < r_in_sqr) break; /*No need to continue the iteration in x once we found the inner edge of the arc*/ if(r_act_sqr < r_in_sqr) break; /*No need to continue the iteration in x once we found the inner edge of the arc*/
} }
if(x_start[0] != LV_COORD_MIN) { if(x_start[0] != LV_COORD_MIN) {
if(x_end[0] == LV_COORD_MIN) x_end[0] = xi - 1; if(x_end[0] == LV_COORD_MIN) x_end[0] = xi - 1;
hor_line(center_x+x_start[0], center_y+yi, mask, x_end[0] - x_start[0], color, opa); hor_line(center_x + x_start[0], center_y + yi, mask, x_end[0] - x_start[0], color, opa);
} }
if(x_start[1] != LV_COORD_MIN) { if(x_start[1] != LV_COORD_MIN) {
if(x_end[1] == LV_COORD_MIN) x_end[1] = xi - 1; if(x_end[1] == LV_COORD_MIN) x_end[1] = xi - 1;
hor_line(center_x+x_start[1], center_y-yi, mask, x_end[1] - x_start[1], color, opa); hor_line(center_x + x_start[1], center_y - yi, mask, x_end[1] - x_start[1], color, opa);
} }
if(x_start[2] != LV_COORD_MIN) { if(x_start[2] != LV_COORD_MIN) {
if(x_end[2] == LV_COORD_MIN) x_end[2] = xi - 1; if(x_end[2] == LV_COORD_MIN) x_end[2] = xi - 1;
hor_line(center_x-x_end[2], center_y+yi, mask, LV_MATH_ABS(x_end[2] - x_start[2]), color, opa); hor_line(center_x - x_end[2], center_y + yi, mask, LV_MATH_ABS(x_end[2] - x_start[2]), color, opa);
} }
if(x_start[3] != LV_COORD_MIN) { if(x_start[3] != LV_COORD_MIN) {
if(x_end[3] == LV_COORD_MIN) x_end[3] = xi - 1; if(x_end[3] == LV_COORD_MIN) x_end[3] = xi - 1;
hor_line(center_x-x_end[3], center_y-yi, mask, LV_MATH_ABS(x_end[3] - x_start[3]), color, opa); hor_line(center_x - x_end[3], center_y - yi, mask, LV_MATH_ABS(x_end[3] - x_start[3]), color, opa);
} }
#if LV_ANTIALIAS #if LV_ANTIALIAS
@@ -172,78 +172,67 @@ static uint16_t fast_atan2(int x, int y)
// Any values of X and Y are usable including negative values provided // Any values of X and Y are usable including negative values provided
// they are between -1456 and 1456 so the 16bit multiply does not overflow. // they are between -1456 and 1456 so the 16bit multiply does not overflow.
unsigned char negflag; unsigned char negflag;
unsigned char tempdegree; unsigned char tempdegree;
unsigned char comp; unsigned char comp;
unsigned int degree; // this will hold the result unsigned int degree; // this will hold the result
//signed int x; // these hold the XY vector at the start //signed int x; // these hold the XY vector at the start
//signed int y; // (and they will be destroyed) //signed int y; // (and they will be destroyed)
unsigned int ux; unsigned int ux;
unsigned int uy; unsigned int uy;
// Save the sign flags then remove signs and get XY as unsigned ints // Save the sign flags then remove signs and get XY as unsigned ints
negflag = 0; negflag = 0;
if(x < 0) if(x < 0) {
{ negflag += 0x01; // x flag bit
negflag += 0x01; // x flag bit x = (0 - x); // is now +
x = (0 - x); // is now + }
} ux = x; // copy to unsigned var before multiply
ux = x; // copy to unsigned var before multiply if(y < 0) {
if(y < 0) negflag += 0x02; // y flag bit
{ y = (0 - y); // is now +
negflag += 0x02; // y flag bit }
y = (0 - y); // is now + uy = y; // copy to unsigned var before multiply
}
uy = y; // copy to unsigned var before multiply
// 1. Calc the scaled "degrees" // 1. Calc the scaled "degrees"
if(ux > uy) if(ux > uy) {
{ degree = (uy * 45) / ux; // degree result will be 0-45 range
degree = (uy * 45) / ux; // degree result will be 0-45 range negflag += 0x10; // octant flag bit
negflag += 0x10; // octant flag bit } else {
} degree = (ux * 45) / uy; // degree result will be 0-45 range
else }
{
degree = (ux * 45) / uy; // degree result will be 0-45 range
}
// 2. Compensate for the 4 degree error curve // 2. Compensate for the 4 degree error curve
comp = 0; comp = 0;
tempdegree = degree; // use an unsigned char for speed! tempdegree = degree; // use an unsigned char for speed!
if(tempdegree > 22) // if top half of range if(tempdegree > 22) { // if top half of range
{ if(tempdegree <= 44) comp++;
if(tempdegree <= 44) comp++; if(tempdegree <= 41) comp++;
if(tempdegree <= 41) comp++; if(tempdegree <= 37) comp++;
if(tempdegree <= 37) comp++; if(tempdegree <= 32) comp++; // max is 4 degrees compensated
if(tempdegree <= 32) comp++; // max is 4 degrees compensated } else { // else is lower half of range
} if(tempdegree >= 2) comp++;
else // else is lower half of range if(tempdegree >= 6) comp++;
{ if(tempdegree >= 10) comp++;
if(tempdegree >= 2) comp++; if(tempdegree >= 15) comp++; // max is 4 degrees compensated
if(tempdegree >= 6) comp++; }
if(tempdegree >= 10) comp++; degree += comp; // degree is now accurate to +/- 1 degree!
if(tempdegree >= 15) comp++; // max is 4 degrees compensated
}
degree += comp; // degree is now accurate to +/- 1 degree!
// Invert degree if it was X>Y octant, makes 0-45 into 90-45 // Invert degree if it was X>Y octant, makes 0-45 into 90-45
if(negflag & 0x10) degree = (90 - degree); if(negflag & 0x10) degree = (90 - degree);
// 3. Degree is now 0-90 range for this quadrant, // 3. Degree is now 0-90 range for this quadrant,
// need to invert it for whichever quadrant it was in // need to invert it for whichever quadrant it was in
if(negflag & 0x02) // if -Y if(negflag & 0x02) { // if -Y
{ if(negflag & 0x01) // if -Y -X
if(negflag & 0x01) // if -Y -X degree = (180 + degree);
degree = (180 + degree); else // else is -Y +X
else // else is -Y +X degree = (180 - degree);
degree = (180 - degree); } else { // else is +Y
} if(negflag & 0x01) // if +Y -X
else // else is +Y degree = (360 - degree);
{ }
if(negflag & 0x01) // if +Y -X return degree;
degree = (360 - degree);
}
return degree;
} }
/********************** /**********************
@@ -251,30 +240,29 @@ static uint16_t fast_atan2(int x, int y)
**********************/ **********************/
static void ver_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa) static void ver_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa)
{ {
lv_area_t area; lv_area_t area;
lv_area_set(&area, x, y, x, y + len); lv_area_set(&area, x, y, x, y + len);
fill_fp(&area, mask, color, opa); fill_fp(&area, mask, color, opa);
} }
static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa) static void hor_line(lv_coord_t x, lv_coord_t y, const lv_area_t * mask, lv_coord_t len, lv_color_t color, lv_opa_t opa)
{ {
lv_area_t area; lv_area_t area;
lv_area_set(&area, x, y, x + len, y); lv_area_set(&area, x, y, x + len, y);
fill_fp(&area, mask, color, opa); fill_fp(&area, mask, color, opa);
} }
static bool deg_test_norm(uint16_t deg, uint16_t start, uint16_t end) static bool deg_test_norm(uint16_t deg, uint16_t start, uint16_t end)
{ {
if(deg >= start && deg <= end) return true; if(deg >= start && deg <= end) return true;
else return false; else return false;
} }
static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end) static bool deg_test_inv(uint16_t deg, uint16_t start, uint16_t end)
{ {
if(deg >= start || deg <= end) { if(deg >= start || deg <= end) {
return true; return true;
} } else return false;
else return false;
} }
+1 -1
View File
@@ -39,7 +39,7 @@ extern "C" {
* @param opa_scale scale down all opacities by the factor * @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask, void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, const lv_area_t * mask,
uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale); uint16_t start_angle, uint16_t end_angle, const lv_style_t * style, lv_opa_t opa_scale);
/********************** /**********************
* MACROS * MACROS
+15 -9
View File
@@ -43,7 +43,7 @@
* @param opa_scale scale down all opacities by the factor * @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
const void * src, const lv_style_t * style, lv_opa_t opa_scale) const void * src, const lv_style_t * style, lv_opa_t opa_scale)
{ {
if(src == NULL) { if(src == NULL) {
@@ -55,7 +55,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
lv_opa_t opa = (uint16_t)((uint16_t) style->image.opa * opa_scale) >> 8; lv_opa_t opa = (uint16_t)((uint16_t) style->image.opa * opa_scale) >> 8;
const uint8_t * u8_p = (uint8_t*) src; const uint8_t * u8_p = (uint8_t *) src;
if(u8_p[0] >= 'A' && u8_p[0] <= 'Z') { /*It will be a path of a file*/ if(u8_p[0] >= 'A' && u8_p[0] <= 'Z') { /*It will be a path of a file*/
#if USE_LV_FILESYSTEM #if USE_LV_FILESYSTEM
lv_fs_file_t file; lv_fs_file_t file;
@@ -75,10 +75,17 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
uint8_t px_size = 0; uint8_t px_size = 0;
switch(img_data.header.format) { switch(img_data.header.format) {
case LV_IMG_FORMAT_FILE_RAW_RGB332: px_size = 1; break; case LV_IMG_FORMAT_FILE_RAW_RGB332:
case LV_IMG_FORMAT_FILE_RAW_RGB565: px_size = 2; break; px_size = 1;
case LV_IMG_FORMAT_FILE_RAW_RGB888: px_size = 4; break; break;
default: return; case LV_IMG_FORMAT_FILE_RAW_RGB565:
px_size = 2;
break;
case LV_IMG_FORMAT_FILE_RAW_RGB888:
px_size = 4;
break;
default:
return;
} }
if(img_data.header.alpha_byte) { /*Correction with the alpha byte*/ if(img_data.header.alpha_byte) { /*Correction with the alpha byte*/
@@ -115,7 +122,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
res = lv_fs_read(&file, buf, useful_data, &br); res = lv_fs_read(&file, buf, useful_data, &br);
map_fp(&line, &mask_com, (uint8_t *)buf, opa, img_data.header.chroma_keyed, img_data.header.alpha_byte, map_fp(&line, &mask_com, (uint8_t *)buf, opa, img_data.header.chroma_keyed, img_data.header.alpha_byte,
style->image.color, style->image.intense); style->image.color, style->image.intense);
lv_fs_tell(&file, &act_pos); lv_fs_tell(&file, &act_pos);
lv_fs_seek(&file, act_pos + next_row); lv_fs_seek(&file, act_pos + next_row);
@@ -131,8 +138,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
} }
} }
#endif #endif
} } else {
else {
const lv_img_t * img_var = src; const lv_img_t * img_var = src;
lv_area_t mask_com; /*Common area of mask and coords*/ lv_area_t mask_com; /*Common area of mask and coords*/
bool union_ok; bool union_ok;
+1 -1
View File
@@ -38,7 +38,7 @@ extern "C" {
* @param opa_scale scale down all opacities by the factor * @param opa_scale scale down all opacities by the factor
*/ */
void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
const void * src, const lv_style_t * style, lv_opa_t opa_scale); const void * src, const lv_style_t * style, lv_opa_t opa_scale);
#endif #endif
+22 -16
View File
@@ -17,12 +17,11 @@
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
typedef enum typedef enum {
{
CMD_STATE_WAIT, CMD_STATE_WAIT,
CMD_STATE_PAR, CMD_STATE_PAR,
CMD_STATE_IN, CMD_STATE_IN,
}cmd_state_t; } cmd_state_t;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
@@ -53,8 +52,8 @@ static uint8_t hex_char_to_num(char hex);
* @param offset text offset in x and y direction (NULL if unused) * @param offset text offset in x and y direction (NULL if unused)
* *
*/ */
void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset) const char * txt, lv_txt_flag_t flag, lv_point_t * offset)
{ {
const lv_font_t * font = style->text.font; const lv_font_t * font = style->text.font;
lv_coord_t w; lv_coord_t w;
@@ -78,7 +77,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
/*Align the line to middle if enabled*/ /*Align the line to middle if enabled*/
if(flag & LV_TXT_FLAG_CENTER) { if(flag & LV_TXT_FLAG_CENTER) {
line_length = lv_txt_get_width(&txt[line_start], line_end - line_start, line_length = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag); font, style->text.letter_space, flag);
pos.x += (w - line_length) / 2; pos.x += (w - line_length) / 2;
} }
@@ -123,7 +122,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
continue; continue;
} else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */ } else if(cmd_state == CMD_STATE_PAR) { /*Other start char in parameter escaped cmd. char */
cmd_state = CMD_STATE_WAIT; cmd_state = CMD_STATE_WAIT;
}else if(cmd_state == CMD_STATE_IN) { /*Command end */ } else if(cmd_state == CMD_STATE_IN) { /*Command end */
cmd_state = CMD_STATE_WAIT; cmd_state = CMD_STATE_WAIT;
continue; continue;
} }
@@ -137,7 +136,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
char buf[LABEL_RECOLOR_PAR_LENGTH + 1]; char buf[LABEL_RECOLOR_PAR_LENGTH + 1];
memcpy(buf, &txt[par_start], LABEL_RECOLOR_PAR_LENGTH); memcpy(buf, &txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
buf[LABEL_RECOLOR_PAR_LENGTH] = '\0'; buf[LABEL_RECOLOR_PAR_LENGTH] = '\0';
int r,g,b; int r, g, b;
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]); r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]); g = (hex_char_to_num(buf[2]) << 4) + hex_char_to_num(buf[3]);
b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]); b = (hex_char_to_num(buf[4]) << 4) + hex_char_to_num(buf[5]);
@@ -168,7 +167,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
/*Align to middle*/ /*Align to middle*/
if(flag & LV_TXT_FLAG_CENTER) { if(flag & LV_TXT_FLAG_CENTER) {
line_length = lv_txt_get_width(&txt[line_start], line_end - line_start, line_length = lv_txt_get_width(&txt[line_start], line_end - line_start,
font, style->text.letter_space, flag); font, style->text.letter_space, flag);
pos.x += (w - line_length) / 2; pos.x += (w - line_length) / 2;
} }
/*Go the next line position*/ /*Go the next line position*/
@@ -195,13 +194,20 @@ static uint8_t hex_char_to_num(char hex)
if(hex >= 'a') hex -= 'a' - 'A'; /*Convert to upper case*/ if(hex >= 'a') hex -= 'a' - 'A'; /*Convert to upper case*/
switch(hex) { switch(hex) {
case 'A': return 10; case 'A':
case 'B': return 11; return 10;
case 'C': return 12; case 'B':
case 'D': return 13; return 11;
case 'E': return 14; case 'C':
case 'F': return 15; return 12;
default: return 0; case 'D':
return 13;
case 'E':
return 14;
case 'F':
return 15;
default:
return 0;
} }
return 0; return 0;
+1 -1
View File
@@ -39,7 +39,7 @@ extern "C" {
* *
*/ */
void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale, void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale,
const char * txt, lv_txt_flag_t flag, lv_point_t * offset); const char * txt, lv_txt_flag_t flag, lv_point_t * offset);
/********************** /**********************
* MACROS * MACROS
+311 -312
View File
File diff suppressed because it is too large Load Diff
+32 -19
View File
@@ -83,8 +83,8 @@ void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
union_ok = lv_area_union(&masked_area, cords_p, &scr_area); union_ok = lv_area_union(&masked_area, cords_p, &scr_area);
} }
if(union_ok != false){ if(union_ok != false) {
lv_disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color); lv_disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color);
} }
} }
@@ -98,33 +98,47 @@ void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
* @param opa opacity of letter (ignored, only for compatibility with lv_vletter) * @param opa opacity of letter (ignored, only for compatibility with lv_vletter)
*/ */
void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p, void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter, const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
(void)opa; /*Opa is used only for compatibility with lv_vletter*/ (void)opa; /*Opa is used only for compatibility with lv_vletter*/
static uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/ static uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
static uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/ static uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/ static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 68, 85, 102, 119,
136, 153, 170, 187, 136, 153, 170, 187,
204, 221, 238, 255}; 204, 221, 238, 255
};
if(font_p == NULL) return; if(font_p == NULL) return;
uint8_t letter_w = lv_font_get_width(font_p, letter); uint8_t letter_w = lv_font_get_width(font_p, letter);
uint8_t letter_h = lv_font_get_height(font_p); uint8_t letter_h = lv_font_get_height(font_p);
uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/ uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/
uint8_t *bpp_opa_table; uint8_t * bpp_opa_table;
uint8_t mask_init; uint8_t mask_init;
uint8_t mask; uint8_t mask;
switch(bpp) { switch(bpp) {
case 1: bpp_opa_table = bpp1_opa_table; mask_init = 0x80; break; case 1:
case 2: bpp_opa_table = bpp2_opa_table; mask_init = 0xC0; break; bpp_opa_table = bpp1_opa_table;
case 4: bpp_opa_table = bpp4_opa_table; mask_init = 0xF0; break; mask_init = 0x80;
case 8: bpp_opa_table = NULL; mask_init = 0xFF; break; /*No opa table, pixel value will be used directly*/ break;
default: return; /*Invalid bpp. Can't render the letter*/ case 2:
bpp_opa_table = bpp2_opa_table;
mask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
mask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
mask_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_bitmap(font_p, letter); const uint8_t * map_p = lv_font_get_bitmap(font_p, letter);
@@ -133,7 +147,7 @@ void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
/*If the letter is completely out of mask don't draw it */ /*If the letter is completely out of mask don't draw it */
if(pos_p->x + letter_w < mask_p->x1 || pos_p->x > mask_p->x2 || if(pos_p->x + letter_w < mask_p->x1 || pos_p->x > mask_p->x2 ||
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return; pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
lv_coord_t col, row; lv_coord_t col, row;
uint8_t col_bit; uint8_t col_bit;
@@ -166,8 +180,7 @@ void lv_rletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
if(col_bit < 8 - bpp) { if(col_bit < 8 - bpp) {
col_bit += bpp; col_bit += bpp;
mask = mask >> bpp; mask = mask >> bpp;
} } else {
else {
col_bit = 0; col_bit = 0;
col_byte_cnt ++; col_byte_cnt ++;
mask = mask_init; mask = mask_init;
@@ -200,8 +213,8 @@ void lv_rletter_set_background(lv_color_t color)
* @param recolor_opa the intense of recoloring * @param recolor_opa the intense of recoloring
*/ */
void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_rmap(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa) lv_color_t recolor, lv_opa_t recolor_opa)
{ {
if(alpha_byte) return; /*Pixel level opacity i not supported in real map drawing*/ if(alpha_byte) return; /*Pixel level opacity i not supported in real map drawing*/
@@ -223,7 +236,7 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
if(recolor_opa == LV_OPA_TRANSP && chroma_key == false) { if(recolor_opa == LV_OPA_TRANSP && chroma_key == false) {
lv_coord_t mask_w = lv_area_get_width(&masked_a) - 1; lv_coord_t mask_w = lv_area_get_width(&masked_a) - 1;
for(row = masked_a.y1; row <= masked_a.y2; row++) { for(row = masked_a.y1; row <= masked_a.y2; row++) {
lv_disp_map(masked_a.x1, row, masked_a.x1 + mask_w, row, (lv_color_t*)map_p); lv_disp_map(masked_a.x1, row, masked_a.x1 + mask_w, row, (lv_color_t *)map_p);
map_p += map_width * sizeof(lv_color_t); /*Next row on the map*/ map_p += map_width * sizeof(lv_color_t); /*Next row on the map*/
} }
} else { } else {
+3 -3
View File
@@ -42,7 +42,7 @@ void lv_rpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
* @param opa opacity (ignored, only for compatibility with lv_vfill) * @param opa opacity (ignored, only for compatibility with lv_vfill)
*/ */
void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa); lv_color_t color, lv_opa_t opa);
/** /**
* Draw a letter to the display * Draw a letter to the display
@@ -76,8 +76,8 @@ void lv_rletter_set_background(lv_color_t color);
* @param recolor_opa the intense of recoloring * @param recolor_opa the intense of recoloring
*/ */
void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_rmap(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa); lv_color_t recolor, lv_opa_t recolor_opa);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
+160 -162
View File
File diff suppressed because it is too large Load Diff
+7 -8
View File
@@ -103,21 +103,20 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo
/*Calc. the next point of edge1*/ /*Calc. the next point of edge1*/
y1_tmp = edge1.y; y1_tmp = edge1.y;
do { do {
if (edge1.x == tri[1].x && edge1.y == tri[1].y) { if(edge1.x == tri[1].x && edge1.y == tri[1].y) {
dx1 = LV_MATH_ABS(tri[1].x - tri[2].x); dx1 = LV_MATH_ABS(tri[1].x - tri[2].x);
sx1 = tri[1].x < tri[2].x ? 1 : -1; sx1 = tri[1].x < tri[2].x ? 1 : -1;
dy1 = LV_MATH_ABS(tri[1].y - tri[2].y); dy1 = LV_MATH_ABS(tri[1].y - tri[2].y);
sy1 = tri[1].y < tri[2].y ? 1 : -1; sy1 = tri[1].y < tri[2].y ? 1 : -1;
err1 = (dx1 > dy1 ? dx1 : -dy1) / 2; err1 = (dx1 > dy1 ? dx1 : -dy1) / 2;
} } else if(edge1.x == tri[2].x && edge1.y == tri[2].y) return;
else if (edge1.x == tri[2].x && edge1.y == tri[2].y) return;
err_tmp1 = err1; err_tmp1 = err1;
if (err_tmp1 >-dx1) { if(err_tmp1 > -dx1) {
err1 -= dy1; err1 -= dy1;
edge1.x += sx1; edge1.x += sx1;
} }
if (err_tmp1 < dy1) { if(err_tmp1 < dy1) {
err1 += dx1; err1 += dx1;
edge1.y += sy1; edge1.y += sy1;
} }
@@ -126,13 +125,13 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, lv_colo
/*Calc. the next point of edge2*/ /*Calc. the next point of edge2*/
y2_tmp = edge2.y; y2_tmp = edge2.y;
do { do {
if (edge2.x == tri[2].x && edge2.y == tri[2].y) return; if(edge2.x == tri[2].x && edge2.y == tri[2].y) return;
err_tmp2 = err2; err_tmp2 = err2;
if (err_tmp2 > -dx2) { if(err_tmp2 > -dx2) {
err2 -= dy2; err2 -= dy2;
edge2.x += sx2; edge2.x += sx2;
} }
if (err_tmp2 < dy2) { if(err_tmp2 < dy2) {
err2 += dx2; err2 += dx2;
edge2.y += sy2; edge2.y += sy2;
} }
+47 -37
View File
@@ -65,21 +65,20 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
/*Pixel out of the mask*/ /*Pixel out of the mask*/
if(x < mask_p->x1 || x > mask_p->x2 || if(x < mask_p->x1 || x > mask_p->x2 ||
y < mask_p->y1 || y > mask_p->y2) { y < mask_p->y1 || y > mask_p->y2) {
return; return;
} }
uint32_t vdb_width = lv_area_get_width(&vdb_p->area); uint32_t vdb_width = lv_area_get_width(&vdb_p->area);
/*Make the coordinates relative to VDB*/ /*Make the coordinates relative to VDB*/
x-=vdb_p->area.x1; x -= vdb_p->area.x1;
y-=vdb_p->area.y1; y -= vdb_p->area.y1;
lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x; lv_color_t * vdb_px_p = vdb_p->buf + y * vdb_width + x;
if(opa == LV_OPA_COVER) { if(opa == LV_OPA_COVER) {
*vdb_px_p = color; *vdb_px_p = color;
} } else {
else { *vdb_px_p = lv_color_mix(color, *vdb_px_p, opa);
*vdb_px_p = lv_color_mix(color,*vdb_px_p, opa);
} }
} }
@@ -93,7 +92,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
* @param opa opacity of the area (0..255) * @param opa opacity of the area (0..255)
*/ */
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
lv_area_t res_a; lv_area_t res_a;
bool union_ok; bool union_ok;
@@ -133,15 +132,14 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
/*Use hw fill if present*/ /*Use hw fill if present*/
if(lv_disp_is_mem_fill_supported()) { if(lv_disp_is_mem_fill_supported()) {
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) { for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
lv_disp_mem_fill(&vdb_buf_tmp[vdb_rel_a.x1], w, color); lv_disp_mem_fill(&vdb_buf_tmp[vdb_rel_a.x1], w, color);
vdb_buf_tmp += vdb_width; vdb_buf_tmp += vdb_width;
} }
} }
/*Use hw blend if present and the area is not too small*/ /*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 && else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
lv_disp_is_mem_blend_supported()) lv_disp_is_mem_blend_supported()) {
{
/*Fill a one line sized buffer with a color and blend this later*/ /*Fill a one line sized buffer with a color and blend this later*/
if(color_array_tmp[0].full != color.full || last_width != w) { if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i; uint16_t i;
@@ -153,7 +151,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
/*Blend the filled line to every line VDB line-by-line*/ /*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) { for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width; vdb_buf_tmp += vdb_width;
} }
@@ -178,7 +176,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
last_width = w; last_width = w;
} }
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) { for(row = vdb_rel_a.y1; row <= vdb_rel_a.y2; row++) {
lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa); lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);
vdb_buf_tmp += vdb_width; vdb_buf_tmp += vdb_width;
} }
@@ -205,32 +203,46 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
* @param opa opacity of letter (0..255) * @param opa opacity of letter (0..255)
*/ */
void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p, void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
const lv_font_t * font_p, uint32_t letter, const lv_font_t * font_p, uint32_t letter,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
static uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/ static uint8_t bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with bpp = 1 (Just for compatibility)*/
static uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/ static uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/ static uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119, 68, 85, 102, 119,
136, 153, 170, 187, 136, 153, 170, 187,
204, 221, 238, 255}; 204, 221, 238, 255
};
if(font_p == NULL) return; if(font_p == NULL) return;
uint8_t letter_w = lv_font_get_width(font_p, letter); uint8_t letter_w = lv_font_get_width(font_p, letter);
uint8_t letter_h = lv_font_get_height(font_p); uint8_t letter_h = lv_font_get_height(font_p);
uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/ uint8_t bpp = lv_font_get_bpp(font_p, letter); /*Bit per pixel (1,2, 4 or 8)*/
uint8_t *bpp_opa_table; uint8_t * bpp_opa_table;
uint8_t mask_init; uint8_t mask_init;
uint8_t mask; uint8_t mask;
switch(bpp) { switch(bpp) {
case 1: bpp_opa_table = bpp1_opa_table; mask_init = 0x80; break; case 1:
case 2: bpp_opa_table = bpp2_opa_table; mask_init = 0xC0; break; bpp_opa_table = bpp1_opa_table;
case 4: bpp_opa_table = bpp4_opa_table; mask_init = 0xF0; break; mask_init = 0x80;
case 8: bpp_opa_table = NULL; mask_init = 0xFF; break; /*No opa table, pixel value will be used directly*/ break;
default: return; /*Invalid bpp. Can't render the letter*/ case 2:
bpp_opa_table = bpp2_opa_table;
mask_init = 0xC0;
break;
case 4:
bpp_opa_table = bpp4_opa_table;
mask_init = 0xF0;
break;
case 8:
bpp_opa_table = NULL;
mask_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_bitmap(font_p, letter); const uint8_t * map_p = lv_font_get_bitmap(font_p, letter);
@@ -239,7 +251,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
/*If the letter is completely out of mask don't draw it */ /*If the letter is completely out of mask don't draw it */
if(pos_p->x + letter_w < mask_p->x1 || pos_p->x > mask_p->x2 || if(pos_p->x + letter_w < mask_p->x1 || pos_p->x > mask_p->x2 ||
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return; pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();
lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area); lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area);
@@ -260,7 +272,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
/*Set a pointer on VDB to the first pixel of the letter*/ /*Set a pointer on VDB to the first pixel of the letter*/
vdb_buf_tmp += ((pos_p->y - vdb_p->area.y1) * vdb_width) vdb_buf_tmp += ((pos_p->y - vdb_p->area.y1) * vdb_width)
+ pos_p->x - vdb_p->area.x1; + pos_p->x - vdb_p->area.x1;
/*If the letter is partially out of mask the move there on VDB*/ /*If the letter is partially out of mask the move there on VDB*/
vdb_buf_tmp += (row_start * vdb_width) + col_start; vdb_buf_tmp += (row_start * vdb_width) + col_start;
@@ -280,8 +292,8 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
*vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, bpp == 8 ? letter_px : bpp_opa_table[letter_px]); *vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, bpp == 8 ? letter_px : bpp_opa_table[letter_px]);
} else { } else {
*vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, bpp == 8 ? *vdb_buf_tmp = lv_color_mix(color, *vdb_buf_tmp, bpp == 8 ?
(uint16_t)((uint16_t)letter_px * opa) >> 8 : (uint16_t)((uint16_t)letter_px * opa) >> 8 :
(uint16_t)((uint16_t)bpp_opa_table[letter_px] * opa) >> 8); (uint16_t)((uint16_t)bpp_opa_table[letter_px] * opa) >> 8);
} }
} }
@@ -290,8 +302,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
if(col_bit < 8 - bpp) { if(col_bit < 8 - bpp) {
col_bit += bpp; col_bit += bpp;
mask = mask >> bpp; mask = mask >> bpp;
} } else {
else {
col_bit = 0; col_bit = 0;
col_byte_cnt ++; col_byte_cnt ++;
mask = mask_init; mask = mask_init;
@@ -390,19 +401,18 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
/*Calculate with the pixel level alpha*/ /*Calculate with the pixel level alpha*/
if(alpha_byte) { if(alpha_byte) {
#if LV_COLOR_DEPTH == 8 #if LV_COLOR_DEPTH == 8
px_color.full = px_color_p[0]; px_color.full = px_color_p[0];
#elif LV_COLOR_DEPTH == 16 #elif LV_COLOR_DEPTH == 16
/*Because of Alpha byte 16 bit color can start on odd address which can cause crash*/ /*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); px_color.full = px_color_p[0] + (px_color_p[1] << 8);
#elif LV_COLOR_DEPTH == 24 #elif LV_COLOR_DEPTH == 24
px_color = *((lv_color_t*)px_color_p); px_color = *((lv_color_t *)px_color_p);
#endif #endif
lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1); lv_opa_t px_opa = *(px_color_p + LV_IMG_PX_SIZE_ALPHA_BYTE - 1);
if(px_opa == LV_OPA_TRANSP) continue; 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 if(px_opa != LV_OPA_COVER) opa_result = (uint32_t)((uint32_t)px_opa * opa_result) >> 8;
} } else {
else { px_color = *((lv_color_t *)px_color_p);
px_color = *((lv_color_t*)px_color_p);
} }
/*Handle chroma key*/ /*Handle chroma key*/
@@ -483,7 +493,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_
/*Copy the first row to all other rows*/ /*Copy the first row to all other rows*/
lv_color_t * mem_first = &mem[fill_area->x1]; 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); lv_coord_t copy_size = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t);
mem += mem_width; mem += mem_width;
for(row = fill_area->y1 + 1; row <= fill_area->y2; row++) { for(row = fill_area->y1 + 1; row <= fill_area->y2; row++) {
+3 -3
View File
@@ -42,7 +42,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
* @param opa opacity of the area (0..255) * @param opa opacity of the area (0..255)
*/ */
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa); lv_color_t color, lv_opa_t opa);
/** /**
* Draw a letter in the Virtual Display Buffer * Draw a letter in the Virtual Display Buffer
@@ -69,8 +69,8 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
* @param recolor_opa the intense of recoloring * @param recolor_opa the intense of recoloring
*/ */
void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vmap(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, const uint8_t * map_p, lv_opa_t opa, bool chroma_key, bool alpha_byte,
lv_color_t recolor, lv_opa_t recolor_opa); lv_color_t recolor, lv_opa_t recolor_opa);
/** /**
+9 -9
View File
@@ -30,8 +30,8 @@
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_disp_t *disp_list = NULL; static lv_disp_t * disp_list = NULL;
static lv_disp_t *active; static lv_disp_t * active;
/********************** /**********************
* MACROS * MACROS
@@ -47,7 +47,7 @@ static lv_disp_t *active;
* After it you can set the fields. * After it you can set the fields.
* @param driver pointer to driver variable to initialize * @param driver pointer to driver variable to initialize
*/ */
void lv_disp_drv_init(lv_disp_drv_t *driver) void lv_disp_drv_init(lv_disp_drv_t * driver)
{ {
driver->disp_fill = NULL; driver->disp_fill = NULL;
driver->disp_map = NULL; driver->disp_map = NULL;
@@ -65,18 +65,18 @@ void lv_disp_drv_init(lv_disp_drv_t *driver)
* @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable) * @param driver pointer to an initialized 'lv_disp_drv_t' variable (can be local variable)
* @return pointer to the new display or NULL on error * @return pointer to the new display or NULL on error
*/ */
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver) lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
{ {
lv_disp_t *node; lv_disp_t * node;
node = lv_mem_alloc(sizeof(lv_disp_t)); node = lv_mem_alloc(sizeof(lv_disp_t));
if (!node) return NULL; if(!node) return NULL;
memcpy(&node->driver,driver, sizeof(lv_disp_drv_t)); memcpy(&node->driver, driver, sizeof(lv_disp_drv_t));
node->next = NULL; node->next = NULL;
/* Set first display as active by default */ /* Set first display as active by default */
if (disp_list == NULL) { if(disp_list == NULL) {
disp_list = node; disp_list = node;
active = node; active = node;
lv_obj_invalidate(lv_scr_act()); lv_obj_invalidate(lv_scr_act());
@@ -144,7 +144,7 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col
* @param y2 bottom coordinate of the rectangle * @param y2 bottom coordinate of the rectangle
* @param color_p pointer to an array of colors * @param color_p pointer to an array of colors
*/ */
void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t *color_p) void lv_disp_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t * color_p)
{ {
if(active == NULL) return; if(active == NULL) return;
if(active->driver.disp_flush != NULL) active->driver.disp_flush(x1, y1, x2, y2, color_p); if(active->driver.disp_flush != NULL) active->driver.disp_flush(x1, y1, x2, y2, color_p);
+9 -9
View File
@@ -22,7 +22,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_indev_t *indev_list = NULL; static lv_indev_t * indev_list = NULL;
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -42,7 +42,7 @@ static lv_indev_t *indev_list = NULL;
* After it you can set the fields. * After it you can set the fields.
* @param driver pointer to driver variable to initialize * @param driver pointer to driver variable to initialize
*/ */
void lv_indev_drv_init(lv_indev_drv_t *driver) void lv_indev_drv_init(lv_indev_drv_t * driver)
{ {
driver->read = NULL; driver->read = NULL;
driver->type = LV_INDEV_TYPE_NONE; driver->type = LV_INDEV_TYPE_NONE;
@@ -54,12 +54,12 @@ void lv_indev_drv_init(lv_indev_drv_t *driver)
* @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable) * @param driver pointer to an initialized 'lv_indev_drv_t' variable (can be local variable)
* @return pointer to the new input device or NULL on error * @return pointer to the new input device or NULL on error
*/ */
lv_indev_t * lv_indev_drv_register(lv_indev_drv_t *driver) lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
{ {
lv_indev_t *node; lv_indev_t * node;
node = lv_mem_alloc(sizeof(lv_indev_t)); node = lv_mem_alloc(sizeof(lv_indev_t));
if (!node) return NULL; if(!node) return NULL;
memset(node, 0, sizeof(lv_indev_t)); memset(node, 0, sizeof(lv_indev_t));
memcpy(&node->driver, driver, sizeof(lv_indev_drv_t)); memcpy(&node->driver, driver, sizeof(lv_indev_drv_t));
@@ -70,11 +70,11 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t *driver)
node->group = NULL; node->group = NULL;
node->btn_points = NULL; node->btn_points = NULL;
if (indev_list == NULL) { if(indev_list == NULL) {
indev_list = node; indev_list = node;
} else { } else {
lv_indev_t *last = indev_list; lv_indev_t * last = indev_list;
while (last->next) while(last->next)
last = last->next; last = last->next;
last->next = node; last->next = node;
@@ -105,7 +105,7 @@ lv_indev_t * lv_indev_next(lv_indev_t * indev)
* @param data input device will write its data here * @param data input device will write its data here
* @return false: no more data; true: there more data to read (buffered) * @return false: no more data; true: there more data to read (buffered)
*/ */
bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t *data) bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
{ {
bool cont = false; bool cont = false;
+5 -5
View File
@@ -40,7 +40,7 @@ typedef enum {
typedef enum { typedef enum {
LV_INDEV_STATE_REL = 0, LV_INDEV_STATE_REL = 0,
LV_INDEV_STATE_PR LV_INDEV_STATE_PR
}lv_indev_state_t; } lv_indev_state_t;
/*Data type when an input device is read */ /*Data type when an input device is read */
typedef struct { typedef struct {
@@ -51,14 +51,14 @@ typedef struct {
}; };
lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/ lv_indev_state_t state; /*LV_INDEV_EVENT_REL or LV_INDEV_EVENT_PR*/
void *user_data; /*'lv_indev_drv_t.priv' for this driver*/ void *user_data; /*'lv_indev_drv_t.priv' for this driver*/
}lv_indev_data_t; } lv_indev_data_t;
/*Initialized by the user and registered by 'lv_indev_add()'*/ /*Initialized by the user and registered by 'lv_indev_add()'*/
typedef struct { typedef struct {
lv_hal_indev_type_t type; /*Input device type*/ lv_hal_indev_type_t type; /*Input device type*/
bool (*read)(lv_indev_data_t *data); /*Function pointer to read data. Return 'true' if there is still data to be read (buffered)*/ bool (*read)(lv_indev_data_t *data); /*Function pointer to read data. Return 'true' if there is still data to be read (buffered)*/
void *user_data; /*Pointer to user defined data, passed in 'lv_indev_data_t' on read*/ void *user_data; /*Pointer to user defined data, passed in 'lv_indev_data_t' on read*/
}lv_indev_drv_t; } lv_indev_drv_t;
struct _lv_obj_t; struct _lv_obj_t;
@@ -70,7 +70,7 @@ typedef struct _lv_indev_proc_t {
lv_point_t act_point; lv_point_t act_point;
lv_point_t last_point; lv_point_t last_point;
lv_point_t vect; lv_point_t vect;
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DRAG_LIMIT*/ lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DRAG_LIMIT*/
struct _lv_obj_t * act_obj; struct _lv_obj_t * act_obj;
struct _lv_obj_t * last_obj; struct _lv_obj_t * last_obj;
@@ -92,7 +92,7 @@ typedef struct _lv_indev_proc_t {
uint8_t long_pr_sent :1; uint8_t long_pr_sent :1;
uint8_t reset_query :1; uint8_t reset_query :1;
uint8_t disabled :1; uint8_t disabled :1;
}lv_indev_proc_t; } lv_indev_proc_t;
struct _lv_obj_t; struct _lv_obj_t;
+9 -9
View File
@@ -68,17 +68,17 @@ uint32_t lv_tick_get(void)
*/ */
uint32_t lv_tick_elaps(uint32_t prev_tick) uint32_t lv_tick_elaps(uint32_t prev_tick)
{ {
uint32_t act_time = lv_tick_get(); uint32_t act_time = lv_tick_get();
/*If there is no overflow in sys_time simple subtract*/ /*If there is no overflow in sys_time simple subtract*/
if(act_time >= prev_tick) { if(act_time >= prev_tick) {
prev_tick = act_time - prev_tick; prev_tick = act_time - prev_tick;
} else { } else {
prev_tick = UINT32_MAX - prev_tick + 1; prev_tick = UINT32_MAX - prev_tick + 1;
prev_tick += act_time; prev_tick += act_time;
} }
return prev_tick; return prev_tick;
} }
/********************** /**********************
+17 -17
View File
@@ -28,7 +28,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void anim_task (void * param); static void anim_task(void * param);
static bool anim_ready_handler(lv_anim_t * a); static bool anim_ready_handler(lv_anim_t * a);
/********************** /**********************
@@ -131,7 +131,7 @@ uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
* @param a pointer to an animation * @param a pointer to an animation
* @return the current value to set * @return the current value to set
*/ */
int32_t lv_anim_path_linear(const lv_anim_t *a) int32_t lv_anim_path_linear(const lv_anim_t * a)
{ {
/*Calculate the current step*/ /*Calculate the current step*/
@@ -142,7 +142,7 @@ int32_t lv_anim_path_linear(const lv_anim_t *a)
/* Get the new value which will be proportional to `step` /* Get the new value which will be proportional to `step`
* and the `start` and `end` values*/ * and the `start` and `end` values*/
int32_t new_value; int32_t new_value;
new_value = (int32_t) step * (a->end - a->start); new_value = (int32_t) step * (a->end - a->start);
new_value = new_value >> LV_ANIM_RES_SHIFT; new_value = new_value >> LV_ANIM_RES_SHIFT;
new_value += a->start; new_value += a->start;
@@ -154,23 +154,23 @@ int32_t lv_anim_path_linear(const lv_anim_t *a)
* @param a pointer to an animation * @param a pointer to an animation
* @return the current value to set * @return the current value to set
*/ */
int32_t lv_anim_path_ease_in_out(const lv_anim_t *a) int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
{ {
/*Calculate the current step*/ /*Calculate the current step*/
uint32_t t; uint32_t t;
if(a->time == a->act_time) t = 1024; if(a->time == a->act_time) t = 1024;
else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
int32_t step = lv_bezier3(t, 0, 100, 924, 1024); int32_t step = lv_bezier3(t, 0, 100, 924, 1024);
int32_t new_value; int32_t new_value;
new_value = (int32_t) step * (a->end - a->start); new_value = (int32_t) step * (a->end - a->start);
new_value = new_value >> 10; new_value = new_value >> 10;
new_value += a->start; new_value += a->start;
return new_value; return new_value;
} }
/** /**
@@ -179,7 +179,7 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t *a)
* @param a pointer to an animation * @param a pointer to an animation
* @return the current value to set * @return the current value to set
*/ */
int32_t lv_anim_path_step(const lv_anim_t *a) int32_t lv_anim_path_step(const lv_anim_t * a)
{ {
if(a->act_time >= a->time) return a->end; if(a->act_time >= a->time) return a->end;
else return a->start; else return a->start;
@@ -193,7 +193,7 @@ int32_t lv_anim_path_step(const lv_anim_t *a)
* Periodically handle the animations. * Periodically handle the animations.
* @param param unused * @param param unused
*/ */
static void anim_task (void * param) static void anim_task(void * param)
{ {
(void)param; (void)param;
@@ -243,7 +243,7 @@ static bool anim_ready_handler(lv_anim_t * a)
* - no repeat, play back is enabled and play back is ready */ * - no repeat, play back is enabled and play back is ready */
if((a->repeat == 0 && a->playback == 0) || if((a->repeat == 0 && a->playback == 0) ||
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) { (a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
void (*cb) (void *) = a->end_cb; void (*cb)(void *) = a->end_cb;
void * p = a->var; void * p = a->var;
lv_ll_rem(&anim_ll, a); lv_ll_rem(&anim_ll, a);
lv_mem_free(a); lv_mem_free(a);
@@ -263,7 +263,7 @@ static bool anim_ready_handler(lv_anim_t * a)
if(a->playback_now == 0) a->act_time = - a->playback_pause; if(a->playback_now == 0) a->act_time = - a->playback_pause;
/*Toggle the play back state*/ /*Toggle the play back state*/
a->playback_now = a->playback_now == 0 ? 1: 0; a->playback_now = a->playback_now == 0 ? 1 : 0;
/*Swap the start and end values*/ /*Swap the start and end values*/
int32_t tmp; int32_t tmp;
tmp = a->start; tmp = a->start;
+15 -15
View File
@@ -37,21 +37,21 @@ typedef void (*lv_anim_cb_t)(void *);
typedef struct _lv_anim_t typedef struct _lv_anim_t
{ {
void * var; /*Variable to animate*/ void * var; /*Variable to animate*/
lv_anim_fp_t fp; /*Animator function*/ lv_anim_fp_t fp; /*Animator function*/
lv_anim_cb_t end_cb; /*Call it when the animation is ready*/ lv_anim_cb_t end_cb; /*Call it when the animation is ready*/
lv_anim_path_t path; /*An array with the steps of animations*/ lv_anim_path_t path; /*An array with the steps of animations*/
int32_t start; /*Start value*/ int32_t start; /*Start value*/
int32_t end; /*End value*/ int32_t end; /*End value*/
uint16_t time; /*Animation time in ms*/ uint16_t time; /*Animation time in ms*/
int16_t act_time; /*Current time in animation. Set to negative to make delay.*/ int16_t act_time; /*Current time in animation. Set to negative to make delay.*/
uint16_t playback_pause; /*Wait before play back*/ uint16_t playback_pause; /*Wait before play back*/
uint16_t repeat_pause; /*Wait before repeat*/ uint16_t repeat_pause; /*Wait before repeat*/
uint8_t playback :1; /*When the animation is ready play it back*/ uint8_t playback :1; /*When the animation is ready play it back*/
uint8_t repeat :1; /*Repeat the animation infinitely*/ uint8_t repeat :1; /*Repeat the animation infinitely*/
/*Animation system use these - user shouldn't set*/ /*Animation system use these - user shouldn't set*/
uint8_t playback_now :1; /*Play back is in progress*/ uint8_t playback_now :1; /*Play back is in progress*/
}lv_anim_t; } lv_anim_t;
/*Example initialization /*Example initialization
lv_anim_t a; lv_anim_t a;
+17 -21
View File
@@ -56,7 +56,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2
*/ */
void lv_area_set_width(lv_area_t * area_p, lv_coord_t w) void lv_area_set_width(lv_area_t * area_p, lv_coord_t w)
{ {
area_p->x2 = area_p->x1 + w - 1; area_p->x2 = area_p->x1 + w - 1;
} }
/** /**
@@ -66,7 +66,7 @@ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w)
*/ */
void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) void lv_area_set_height(lv_area_t * area_p, lv_coord_t h)
{ {
area_p->y2 = area_p->y1 + h - 1; area_p->y2 = area_p->y1 + h - 1;
} }
/** /**
@@ -77,12 +77,12 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h)
*/ */
void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y)
{ {
lv_coord_t w = lv_area_get_width(area_p); lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p); lv_coord_t h = lv_area_get_height(area_p);
area_p->x1 = x; area_p->x1 = x;
area_p->y1 = y; area_p->y1 = y;
lv_area_set_width(area_p, w); lv_area_set_width(area_p, w);
lv_area_set_height(area_p, h); lv_area_set_height(area_p, h);
} }
/** /**
@@ -95,7 +95,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p)
uint32_t size; uint32_t size;
size = (uint32_t)(area_p->x2 - area_p->x1 + 1) * size = (uint32_t)(area_p->x2 - area_p->x1 + 1) *
(area_p->y2 - area_p->y1 + 1); (area_p->y2 - area_p->y1 + 1);
return size; return size;
} }
@@ -118,8 +118,7 @@ bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t *
/*If x1 or y1 greater then x2 or y2 then the areas union is empty*/ /*If x1 or y1 greater then x2 or y2 then the areas union is empty*/
bool union_ok = true; bool union_ok = true;
if((res_p->x1 > res_p->x2) || if((res_p->x1 > res_p->x2) ||
(res_p->y1 > res_p->y2)) (res_p->y1 > res_p->y2)) {
{
union_ok = false; union_ok = false;
} }
@@ -150,8 +149,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p)
bool is_on = false; bool is_on = false;
if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) && if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) &&
((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) ((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) {
{
is_on = true; is_on = true;
} }
@@ -167,10 +165,9 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p)
bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
{ {
if((a1_p->x1 <= a2_p->x2) && if((a1_p->x1 <= a2_p->x2) &&
(a1_p->x2 >= a2_p->x1) && (a1_p->x2 >= a2_p->x1) &&
(a1_p->y1 <= a2_p->y2) && (a1_p->y1 <= a2_p->y2) &&
(a1_p->y2 >= a2_p->y1)) (a1_p->y2 >= a2_p->y1)) {
{
return true; return true;
} else { } else {
return false; return false;
@@ -189,10 +186,9 @@ bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p)
bool is_in = false; bool is_in = false;
if(ain_p->x1 >= aholder_p->x1 && if(ain_p->x1 >= aholder_p->x1 &&
ain_p->y1 >= aholder_p->y1 && ain_p->y1 >= aholder_p->y1 &&
ain_p->x2 <= aholder_p->x2 && ain_p->x2 <= aholder_p->x2 &&
ain_p->y2 <= aholder_p->y2) ain_p->y2 <= aholder_p->y2) {
{
is_in = true; is_in = true;
} }
+2 -2
View File
@@ -33,7 +33,7 @@ typedef struct
{ {
lv_coord_t x; lv_coord_t x;
lv_coord_t y; lv_coord_t y;
}lv_point_t; } lv_point_t;
typedef struct typedef struct
{ {
@@ -41,7 +41,7 @@ typedef struct
lv_coord_t y1; lv_coord_t y1;
lv_coord_t x2; lv_coord_t x2;
lv_coord_t y2; lv_coord_t y2;
}lv_area_t; } lv_area_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
+4 -4
View File
@@ -66,11 +66,11 @@ void lv_circ_next(lv_point_t * c, lv_coord_t * tmp)
{ {
c->y++; c->y++;
if (*tmp <= 0) { if(*tmp <= 0) {
(*tmp) += 2 * c->y + 1; // Change in decision criterion for y -> y+1 (*tmp) += 2 * c->y + 1; // Change in decision criterion for y -> y+1
} else { } else {
c->x--; c->x--;
(*tmp) += 2 * (c->y - c->x) + 1; // Change for y -> y+1, x -> x-1 (*tmp) += 2 * (c->y - c->x) + 1; // Change for y -> y+1, x -> x-1
} }
} }
+24 -16
View File
@@ -53,8 +53,7 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
uint8_t region, remainder, p, q, t; uint8_t region, remainder, p, q, t;
if (s == 0) if(s == 0) {
{
r = v; r = v;
g = v; g = v;
b = v; b = v;
@@ -68,25 +67,36 @@ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
q = (v * (255 - ((s * remainder) >> 8))) >> 8; q = (v * (255 - ((s * remainder) >> 8))) >> 8;
t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8; t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;
switch (region) switch(region) {
{
case 0: case 0:
r = v; g = t; b = p; r = v;
g = t;
b = p;
break; break;
case 1: case 1:
r = q; g = v; b = p; r = q;
g = v;
b = p;
break; break;
case 2: case 2:
r = p; g = v; b = t; r = p;
g = v;
b = t;
break; break;
case 3: case 3:
r = p; g = q; b = v; r = p;
g = q;
b = v;
break; break;
case 4: case 4:
r = t; g = p; b = v; r = t;
g = p;
b = v;
break; break;
default: default:
r = v; g = p; b = q; r = v;
g = p;
b = q;
break; break;
} }
@@ -110,23 +120,21 @@ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r, uint8_t g, uint8_t b)
rgbMax = r > g ? (r > b ? r : b) : (g > b ? g : b); rgbMax = r > g ? (r > b ? r : b) : (g > b ? g : b);
hsv.v = rgbMax; hsv.v = rgbMax;
if (hsv.v == 0) if(hsv.v == 0) {
{
hsv.h = 0; hsv.h = 0;
hsv.s = 0; hsv.s = 0;
return hsv; return hsv;
} }
hsv.s = 255 * (long)(rgbMax - rgbMin) / hsv.v; hsv.s = 255 * (long)(rgbMax - rgbMin) / hsv.v;
if (hsv.s == 0) if(hsv.s == 0) {
{
hsv.h = 0; hsv.h = 0;
return hsv; return hsv;
} }
if (rgbMax == r) if(rgbMax == r)
hsv.h = 0 + 43 * (g - b) / (rgbMax - rgbMin); hsv.h = 0 + 43 * (g - b) / (rgbMax - rgbMin);
else if (rgbMax == g) else if(rgbMax == g)
hsv.h = 85 + 43 * (b - r) / (rgbMax - rgbMin); hsv.h = 85 + 43 * (b - r) / (rgbMax - rgbMin);
else else
hsv.h = 171 + 43 * (r - g) / (rgbMax - rgbMin); hsv.h = 171 + 43 * (r - g) / (rgbMax - rgbMin);
+17 -17
View File
@@ -64,7 +64,7 @@ typedef union
uint8_t green :1; uint8_t green :1;
uint8_t red :1; uint8_t red :1;
uint8_t full :1; uint8_t full :1;
}lv_color1_t; } lv_color1_t;
typedef union typedef union
{ {
@@ -75,7 +75,7 @@ typedef union
uint8_t red :3; uint8_t red :3;
}; };
uint8_t full; uint8_t full;
}lv_color8_t; } lv_color8_t;
typedef union typedef union
{ {
@@ -86,7 +86,7 @@ typedef union
uint16_t red :5; uint16_t red :5;
}; };
uint16_t full; uint16_t full;
}lv_color16_t; } lv_color16_t;
typedef union typedef union
{ {
@@ -98,7 +98,7 @@ typedef union
uint8_t alpha; uint8_t alpha;
}; };
uint32_t full; uint32_t full;
}lv_color24_t; } lv_color24_t;
#if LV_COLOR_DEPTH == 1 #if LV_COLOR_DEPTH == 1
typedef uint8_t lv_color_int_t; typedef uint8_t lv_color_int_t;
@@ -146,30 +146,30 @@ typedef struct
static inline uint8_t lv_color_to1(lv_color_t color) static inline uint8_t lv_color_to1(lv_color_t color)
{ {
#if LV_COLOR_DEPTH == 1 #if LV_COLOR_DEPTH == 1
return color.full; return color.full;
#elif LV_COLOR_DEPTH == 8 #elif LV_COLOR_DEPTH == 8
if((color.red & 0x4) || if((color.red & 0x4) ||
(color.green & 0x4) || (color.green & 0x4) ||
(color.blue & 0x2)) { (color.blue & 0x2)) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
#elif LV_COLOR_DEPTH == 16 #elif LV_COLOR_DEPTH == 16
if((color.red & 0x10) || if((color.red & 0x10) ||
(color.green & 0x20) || (color.green & 0x20) ||
(color.blue & 0x10)) { (color.blue & 0x10)) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
#elif LV_COLOR_DEPTH == 24 #elif LV_COLOR_DEPTH == 24
if((color.red & 0x80) || if((color.red & 0x80) ||
(color.green & 0x80) || (color.green & 0x80) ||
(color.blue & 0x80)) { (color.blue & 0x80)) {
return 1; return 1;
} else { } else {
return 0; return 0;
} }
#endif #endif
} }
+7 -7
View File
@@ -22,7 +22,7 @@ typedef struct {
uint32_t glyph_index; uint32_t glyph_index;
uint32_t unicode; uint32_t unicode;
uint8_t w_px; uint8_t w_px;
}asd_glyph_dsc_t; } asd_glyph_dsc_t;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
@@ -179,7 +179,7 @@ void lv_font_init(void)
* @param dsc_get_fp the font descriptor get function * @param dsc_get_fp the font descriptor get function
* @param parent add this font as charter set extension of 'parent' * @param parent add this font as charter set extension of 'parent'
*/ */
void lv_font_add(lv_font_t *child, lv_font_t *parent) void lv_font_add(lv_font_t * child, lv_font_t * parent)
{ {
if(parent == NULL) return; if(parent == NULL) return;
@@ -240,13 +240,13 @@ uint8_t lv_font_get_bpp(const lv_font_t * font, uint32_t letter)
{ {
const lv_font_t * font_i = font; const lv_font_t * font_i = font;
while(font_i != NULL) { while(font_i != NULL) {
if(letter >= font_i->unicode_first && letter <= font_i->unicode_last) { if(letter >= font_i->unicode_first && letter <= font_i->unicode_last) {
return font_i->bpp; return font_i->bpp;
}
font_i = font_i->next_page;
} }
font_i = font_i->next_page;
}
return 0; return 0;
} }
+3 -3
View File
@@ -33,13 +33,13 @@ typedef struct
{ {
uint32_t w_px :8; uint32_t w_px :8;
uint32_t glyph_index :24; uint32_t glyph_index :24;
}lv_font_glyph_dsc_t; } lv_font_glyph_dsc_t;
typedef struct typedef struct
{ {
uint32_t unicode :21; uint32_t unicode :21;
uint32_t glyph_dsc_index :11; uint32_t glyph_dsc_index :11;
}lv_font_unicode_map_t; } lv_font_unicode_map_t;
typedef struct _lv_font_struct typedef struct _lv_font_struct
{ {
@@ -53,7 +53,7 @@ typedef struct _lv_font_struct
int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/ int16_t (*get_width)(const struct _lv_font_struct * ,uint32_t); /*Get a glyph's with with a given font*/
struct _lv_font_struct * next_page; /*Pointer to a font extension*/ struct _lv_font_struct * next_page; /*Pointer to a font extension*/
uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/ uint32_t bpp :4; /*Bit per pixel: 1, 2 or 4*/
}lv_font_t; } lv_font_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More