mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 02:16:37 +02:00
TAChart: Fix range check error while drawing the stepped line which frequently goes out of the extent, issue #20887
git-svn-id: trunk@34169 -
This commit is contained in:
parent
bd6fd1f10c
commit
0daf02b5a9
@ -419,6 +419,14 @@ var
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure PushPoint(const APoint: TPoint); inline;
|
||||
begin
|
||||
if pointCount > High(points) then
|
||||
SetLength(points, Length(points) * 2);
|
||||
points[pointCount] := APoint;
|
||||
pointCount += 1;
|
||||
end;
|
||||
|
||||
procedure CacheLine(AA, AB: TDoublePoint);
|
||||
var
|
||||
ai, bi: TPoint;
|
||||
@ -434,11 +442,9 @@ var
|
||||
then begin
|
||||
breaks[breakCount] := pointCount;
|
||||
breakCount += 1;
|
||||
points[pointCount] := ai;
|
||||
pointCount += 1;
|
||||
PushPoint(ai);
|
||||
end;
|
||||
points[pointCount] := bi;
|
||||
pointCount += 1;
|
||||
PushPoint(bi);
|
||||
end;
|
||||
|
||||
procedure DrawStep(const AP1, AP2: TDoublePoint);
|
||||
@ -463,7 +469,7 @@ var
|
||||
// For extremely long series (10000 points or more), the Canvas.Line call
|
||||
// becomes a bottleneck. So represent a serie as a sequence of polylines.
|
||||
// This achieves approximately 3x speedup for the typical case.
|
||||
SetLength(points, 2 * Length(FGraphPoints));
|
||||
SetLength(points, Length(FGraphPoints) + 1);
|
||||
SetLength(breaks, Length(FGraphPoints) + 1);
|
||||
pPrevNan := true;
|
||||
// Actually needed only for ltFromOrigin, but moved to silence a warning.
|
||||
|
Loading…
Reference in New Issue
Block a user