mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Merge 1bc1d278eb7595181655e6e9754461718dc4b4e2 into dev
This commit is contained in:
commit
2afd887fdf
@ -94,16 +94,28 @@ void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_are
|
||||
int32_t i_next_right;
|
||||
uint32_t mask_cnt = 0;
|
||||
|
||||
/* Check if the order of points is inverted or not.
|
||||
* The normal case is when the left point is on `y_min_i - 1`*/
|
||||
/*Get the index of the left and right points*/
|
||||
i_next_left = y_min_i - 1;
|
||||
if(i_next_left < 0) i_next_left = point_cnt + i_next_left;
|
||||
|
||||
i_next_right = y_min_i + 1;
|
||||
if(i_next_right > point_cnt - 1) i_next_right = 0;
|
||||
|
||||
|
||||
/* Check if the order of points is inverted or not.
|
||||
* The normal case is when the left point is on `y_min_i - 1`
|
||||
* Explanation:
|
||||
* if angle(p_left) < angle(p_right) -> inverted
|
||||
* dy_left/dx_left < dy_right/dx_right
|
||||
* dy_left * dx_right < dy_right * dx_left
|
||||
*/
|
||||
lv_coord_t dxl = points[i_next_left].x - points[y_min_i].x;
|
||||
lv_coord_t dxr = points[i_next_right].x - points[y_min_i].x;
|
||||
lv_coord_t dyl = points[i_next_left].y - points[y_min_i].y;
|
||||
lv_coord_t dyr = points[i_next_right].y - points[y_min_i].y;
|
||||
|
||||
bool inv = false;
|
||||
if(points[i_next_left].x > points[i_next_right].x && points[i_next_left].y < points[i_next_right].y) inv = true;
|
||||
if(dyl*dxr < dyr*dxl) inv = true;
|
||||
|
||||
do {
|
||||
if(!inv) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user