mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Make arc() wrap angles mod 2pi
This commit is contained in:
parent
02e3325416
commit
a02daef7b2
1 changed files with 8 additions and 1 deletions
|
@ -488,10 +488,17 @@ impl GenericPathBuilder for PathBuilder {
|
||||||
&mut self,
|
&mut self,
|
||||||
origin: Point2D<f32>,
|
origin: Point2D<f32>,
|
||||||
radius: f32,
|
radius: f32,
|
||||||
start_angle: f32,
|
mut start_angle: f32,
|
||||||
mut end_angle: f32,
|
mut end_angle: f32,
|
||||||
anticlockwise: bool,
|
anticlockwise: bool,
|
||||||
) {
|
) {
|
||||||
|
if (!anticlockwise && start_angle > end_angle + 2. * PI) ||
|
||||||
|
(anticlockwise && end_angle > start_angle + 2. * PI)
|
||||||
|
{
|
||||||
|
start_angle = start_angle % (2. * PI);
|
||||||
|
end_angle = end_angle % (2. * PI);
|
||||||
|
}
|
||||||
|
|
||||||
if (anticlockwise && end_angle > 0.) || (!anticlockwise && end_angle < 0.) {
|
if (anticlockwise && end_angle > 0.) || (!anticlockwise && end_angle < 0.) {
|
||||||
end_angle = -end_angle;
|
end_angle = -end_angle;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue