[Refactor] Calculate large arc flag in a more effective way
This commit is contained in:
parent
b07361d392
commit
81907c5842
@ -178,12 +178,6 @@ fn get_range_path(
|
|||||||
let end_delta_x = radius * end_deg.to_radians().sin();
|
let end_delta_x = radius * end_deg.to_radians().sin();
|
||||||
let end_delta_y = radius * (1.0 - end_deg.to_radians().cos());
|
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()
|
let path_data = PathData::new()
|
||||||
.move_to((image_width / 2, image_width / 2))
|
.move_to((image_width / 2, image_width / 2))
|
||||||
.line_to((
|
.line_to((
|
||||||
@ -194,7 +188,7 @@ fn get_range_path(
|
|||||||
radius,
|
radius,
|
||||||
radius,
|
radius,
|
||||||
deg_diff,
|
deg_diff,
|
||||||
large_arc_flag,
|
((start_deg < end_deg) ^ (deg_diff.abs() >= 180.0)) as u8,
|
||||||
0,
|
0,
|
||||||
image_width as f32 / 2.0 - end_delta_x,
|
image_width as f32 / 2.0 - end_delta_x,
|
||||||
image_width as f32 / 2.0 + radius - end_delta_y,
|
image_width as f32 / 2.0 + radius - end_delta_y,
|
||||||
|
Loading…
Reference in New Issue
Block a user