[Refactor] Calculate large arc flag in a more effective way

This commit is contained in:
Gergely Polonkai 2022-05-19 09:19:57 +02:00
parent b07361d392
commit 81907c5842
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4

View File

@ -178,12 +178,6 @@ fn get_range_path(
let end_delta_x = radius * end_deg.to_radians().sin();
let end_delta_y = radius * (1.0 - end_deg.to_radians().cos());
let large_arc_flag = if start_deg < end_deg {
if deg_diff.abs() >= 180.0 { 0 } else { 1 }
} else {
if deg_diff.abs() >= 180.0 { 1 } else { 0 }
};
let path_data = PathData::new()
.move_to((image_width / 2, image_width / 2))
.line_to((
@ -194,7 +188,7 @@ fn get_range_path(
radius,
radius,
deg_diff,
large_arc_flag,
((start_deg < end_deg) ^ (deg_diff.abs() >= 180.0)) as u8,
0,
image_width as f32 / 2.0 - end_delta_x,
image_width as f32 / 2.0 + radius - end_delta_y,