Update lvgl to v8.4.0

This commit is contained in:
lewisxhe
2024-09-13 11:35:47 +08:00
parent 1a57bfcf2b
commit f285d52d61
641 changed files with 25425 additions and 30726 deletions
+124
View File
@@ -143,6 +143,78 @@ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area
return union_ok;
}
/**
* Get resulting sub areas after removing the common parts of two areas from the first area
* @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here
* @param a1_p pointer to the first area
* @param a2_p pointer to the second area
* @return number of results or -1 if no intersect
*/
int8_t _lv_area_diff(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
{
/*Areas have no common parts*/
if(!_lv_area_is_on(a1_p, a2_p)) return -1;
/*No remaining areas after removing common parts*/
if(_lv_area_is_in(a1_p, a2_p, 0)) return 0;
/*Result counter*/
int8_t res_c = 0;
/*Get required information*/
lv_area_t n;
lv_coord_t a1_w = lv_area_get_width(a1_p) - 1;
lv_coord_t a1_h = lv_area_get_height(a1_p) - 1;
/*Compute top rectangle*/
lv_coord_t th = a2_p->y1 - a1_p->y1;
if(th > 0) {
n.x1 = a1_p->x1;
n.y1 = a1_p->y1;
n.x2 = a1_p->x2;
n.y2 = a1_p->y1 + th;
res_p[res_c++] = n;
}
/*Compute the bottom rectangle*/
lv_coord_t bh = a1_h - (a2_p->y2 - a1_p->y1);
if(bh > 0 && a2_p->y2 < a1_p->y2) {
n.x1 = a1_p->x1;
n.y1 = a2_p->y2;
n.x2 = a1_p->x2;
n.y2 = a2_p->y2 + bh;
res_p[res_c++] = n;
}
/*Compute side height*/
lv_coord_t y1 = a2_p->y1 > a1_p->y1 ? a2_p->y1 : a1_p->y1;
lv_coord_t y2 = a2_p->y2 < a1_p->y2 ? a2_p->y2 : a1_p->y2;
lv_coord_t sh = y2 - y1;
/*Compute the left rectangle*/
lv_coord_t lw = a2_p->x1 - a1_p->x1;
if(lw > 0 && sh > 0) {
n.x1 = a1_p->x1;
n.y1 = y1;
n.x2 = a1_p->x1 + lw;
n.y2 = y1 + sh;
res_p[res_c++] = n;
}
/*Compute the right rectangle*/
lv_coord_t rw = a1_w - (a2_p->x2 - a1_p->x1);
if(rw > 0) {
n.x1 = a2_p->x2;
n.y1 = y1;
n.x2 = a2_p->x2 + rw;
n.y2 = y1 + sh;
res_p[res_c++] = n;
}
//Return number of results
return res_c;
}
/**
* Join two areas into a third which involves the other two
* @param res_p pointer to an area, the result will be stored here
@@ -456,6 +528,58 @@ void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t alig
to_align->y2 = to_align->y1 + h - 1;
}
#define _LV_TRANSFORM_TRIGO_SHIFT 10
void lv_point_transform(lv_point_t * p, int32_t angle, int32_t zoom, const lv_point_t * pivot)
{
if(angle == 0 && zoom == 256) {
return;
}
p->x -= pivot->x;
p->y -= pivot->y;
if(angle == 0) {
p->x = (((int32_t)(p->x) * zoom) >> 8) + pivot->x;
p->y = (((int32_t)(p->y) * zoom) >> 8) + pivot->y;
return;
}
static int32_t angle_prev = INT32_MIN;
static int32_t sinma;
static int32_t cosma;
if(angle_prev != angle) {
int32_t angle_limited = angle;
if(angle_limited > 3600) angle_limited -= 3600;
if(angle_limited < 0) angle_limited += 3600;
int32_t angle_low = angle_limited / 10;
int32_t angle_high = angle_low + 1;
int32_t angle_rem = angle_limited - (angle_low * 10);
int32_t s1 = lv_trigo_sin(angle_low);
int32_t s2 = lv_trigo_sin(angle_high);
int32_t c1 = lv_trigo_sin(angle_low + 90);
int32_t c2 = lv_trigo_sin(angle_high + 90);
sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
sinma = sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
cosma = cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
angle_prev = angle;
}
int32_t x = p->x;
int32_t y = p->y;
if(zoom == 256) {
p->x = ((cosma * x - sinma * y) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
p->y = ((sinma * x + cosma * y) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
}
else {
p->x = (((cosma * x - sinma * y) * zoom) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->x;
p->y = (((sinma * x + cosma * y) * zoom) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->y;
}
}
/**********************
* STATIC FUNCTIONS
**********************/