mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 09:36:10 +02:00
TAChart: Extract CopyPoints function
git-svn-id: trunk@30203 -
This commit is contained in:
parent
80cc108bec
commit
4d9fc7f139
@ -80,7 +80,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils {$IFDEF USE_FTFONT}, TAGeometry{$ENDIF};
|
SysUtils, TAGeometry;
|
||||||
|
|
||||||
type
|
type
|
||||||
TFPCanvasHelperCrack = class(TFPCanvasHelper);
|
TFPCanvasHelperCrack = class(TFPCanvasHelper);
|
||||||
@ -92,16 +92,6 @@ begin
|
|||||||
d.DoCopyProps(ASrc);
|
d.DoCopyProps(ASrc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CopyArray(
|
|
||||||
const A: array of TPoint; AStart, ACount: Integer): TPointArray;
|
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
SetLength(Result, ACount);
|
|
||||||
for i := 0 to ACount - 1 do
|
|
||||||
Result[i] := A[i + AStart];
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TFPCanvasDrawer }
|
{ TFPCanvasDrawer }
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.AddToFontOrientation(ADelta: Integer);
|
procedure TFPCanvasDrawer.AddToFontOrientation(ADelta: Integer);
|
||||||
@ -202,7 +192,7 @@ begin
|
|||||||
if (ANumPts < 0) and (AStartIndex = 0) then
|
if (ANumPts < 0) and (AStartIndex = 0) then
|
||||||
FCanvas.Polygon(APoints)
|
FCanvas.Polygon(APoints)
|
||||||
else
|
else
|
||||||
FCanvas.Polygon(CopyArray(APoints, AStartIndex, ANumPts));
|
FCanvas.Polygon(CopyPoints(APoints, AStartIndex, ANumPts));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.Polyline(
|
procedure TFPCanvasDrawer.Polyline(
|
||||||
@ -213,7 +203,7 @@ begin
|
|||||||
if (ANumPts < 0) and (AStartIndex = 0) then
|
if (ANumPts < 0) and (AStartIndex = 0) then
|
||||||
FCanvas.Polyline(APoints)
|
FCanvas.Polyline(APoints)
|
||||||
else
|
else
|
||||||
FCanvas.Polyline(CopyArray(APoints, AStartIndex, ANumPts));
|
FCanvas.Polyline(CopyPoints(APoints, AStartIndex, ANumPts));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.PrepareSimplePen(AColor: TChartColor);
|
procedure TFPCanvasDrawer.PrepareSimplePen(AColor: TChartColor);
|
||||||
|
@ -23,6 +23,8 @@ interface
|
|||||||
uses
|
uses
|
||||||
TAChartUtils, Types;
|
TAChartUtils, Types;
|
||||||
|
|
||||||
|
function CopyPoints(
|
||||||
|
APoints: array of TPoint; AStartIndex, ANumPts: Integer): TPointArray;
|
||||||
function DoublePoint(AX, AY: Double): TDoublePoint; inline;
|
function DoublePoint(AX, AY: Double): TDoublePoint; inline;
|
||||||
function DoubleRect(AX1, AY1, AX2, AY2: Double): TDoubleRect; inline;
|
function DoubleRect(AX1, AY1, AX2, AY2: Double): TDoubleRect; inline;
|
||||||
procedure ExpandRect(var ARect: TDoubleRect; const APoint: TDoublePoint); inline;
|
procedure ExpandRect(var ARect: TDoubleRect; const APoint: TDoublePoint); inline;
|
||||||
@ -78,6 +80,18 @@ uses
|
|||||||
|
|
||||||
function PointLineSide(AP, A1, A2: TPoint): TValueSign; forward;
|
function PointLineSide(AP, A1, A2: TPoint): TValueSign; forward;
|
||||||
|
|
||||||
|
function CopyPoints(
|
||||||
|
APoints: array of TPoint; AStartIndex, ANumPts: Integer): TPointArray;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if ANumPts = -1 then
|
||||||
|
ANumPts := Length(APoints) - AStartIndex;
|
||||||
|
SetLength(Result, ANumPts);
|
||||||
|
for i := 0 to ANumPts - 1 do
|
||||||
|
Result[i] := APoints[i + AStartIndex];
|
||||||
|
end;
|
||||||
|
|
||||||
function DoublePoint(AX, AY: Double): TDoublePoint; inline;
|
function DoublePoint(AX, AY: Double): TDoublePoint; inline;
|
||||||
begin
|
begin
|
||||||
Result.X := AX;
|
Result.X := AX;
|
||||||
|
Loading…
Reference in New Issue
Block a user