mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 11:58:13 +02:00
LCL/Graphics: Avoid separate calculation of sin and cos in AngleArc(). Issue #39983.
This commit is contained in:
parent
58c3995804
commit
1799775107
@ -681,12 +681,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCanvas.AngleArc(X, Y: Integer; Radius: Longword; StartAngle, SweepAngle: Single);
|
procedure TCanvas.AngleArc(X, Y: Integer; Radius: Longword; StartAngle, SweepAngle: Single);
|
||||||
var x1, y1, x2, y2: integer;
|
var
|
||||||
|
x1, y1, x2, y2: integer;
|
||||||
|
sinStartAngle, cosStartAngle, sinEndAngle, cosEndAngle: Single;
|
||||||
begin
|
begin
|
||||||
x1:=trunc(x+cos(pi*StartAngle/180)*Radius);
|
SinCos(pi * StartAngle / 180, sinStartAngle, cosStartAngle);
|
||||||
y1:=trunc(y-sin(pi*StartAngle/180)*Radius);
|
SinCos(pi * (StartAngle + SweepAngle) / 180, sinEndAngle, cosEndAngle);
|
||||||
x2:=trunc(x+cos(pi*(StartAngle+SweepAngle)/180)*Radius);
|
x1:=trunc(x+cosStartAngle*Radius);
|
||||||
y2:=trunc(y-sin(pi*(StartAngle+SweepAngle)/180)*Radius);
|
y1:=trunc(y-sinStartAngle*Radius);
|
||||||
|
x2:=trunc(x+cosEndAngle*Radius);
|
||||||
|
y2:=trunc(y-sinEndAngle*Radius);
|
||||||
LineTo(x1,y1);
|
LineTo(x1,y1);
|
||||||
if SweepAngle>0 then
|
if SweepAngle>0 then
|
||||||
Arc(x-Radius, y-Radius, x+Radius, y+Radius, x1, y1, x2, y2)
|
Arc(x-Radius, y-Radius, x+Radius, y+Radius, x1, y1, x2, y2)
|
||||||
|
Loading…
Reference in New Issue
Block a user