LCL: Use IntegerList in PostScriptCanvas.

git-svn-id: trunk@56394 -
This commit is contained in:
juha 2017-11-13 17:33:34 +00:00
parent ce074563bb
commit 08cbd1a2bc

View File

@ -48,7 +48,7 @@ uses
Graphics, Forms, GraphMath, GraphType, IntfGraphics, Printers, Graphics, Forms, GraphMath, GraphType, IntfGraphics, Printers,
LCLType, LCLIntf, LCLProc, PostScriptUnicode, LCLType, LCLIntf, LCLProc, PostScriptUnicode,
// LazUtils // LazUtils
LazFileUtils, LazUTF8, LazUTF8Classes; LazFileUtils, IntegerList, LazUTF8, LazUTF8Classes;
Type Type
@ -2386,7 +2386,7 @@ var
end; end;
var var
LinesList: TFPList; LinesList: TIntegerList;
LineStart, LineEnd, LineLen: integer; LineStart, LineEnd, LineLen: integer;
ArraySize, TotalSize: integer; ArraySize, TotalSize: integer;
i: integer; i: integer;
@ -2399,15 +2399,15 @@ var
LineCount := 0; LineCount := 0;
exit; exit;
end; end;
LinesList := TFPList.Create; LinesList := TIntegerList.Create;
LineStart := 0; LineStart := 0;
// find all line starts and line ends // find all line starts and line ends
repeat repeat
LinesList.Add({%H-}Pointer(PtrInt(LineStart))); LinesList.Add(LineStart);
// find line end // find line end
LineEnd := FindLineEnd(LineStart); LineEnd := FindLineEnd(LineStart);
LinesList.Add({%H-}Pointer(PtrInt(LineEnd))); LinesList.Add(LineEnd);
// find next line start // find next line start
LineStart := LineEnd; LineStart := LineEnd;
if AText[LineStart] in [#10, #13] then if AText[LineStart] in [#10, #13] then
@ -2434,7 +2434,7 @@ var
while i < LinesList.Count do while i < LinesList.Count do
begin begin
// add LineEnd - LineStart + 1 for the #0 // add LineEnd - LineStart + 1 for the #0
LineLen :={%H-}PtrUInt(LinesList[i + 1]) -{%H-}PtrUInt(LinesList[i]) + 1; LineLen := LinesList[i + 1] - LinesList[i] + 1;
Inc(TotalSize, LineLen); Inc(TotalSize, LineLen);
Inc(i, 2); Inc(i, 2);
end; end;
@ -2450,8 +2450,8 @@ var
// set the pointer to the start of the current line // set the pointer to the start of the current line
CurLineEntry[i shr 1] := CurLineStart; CurLineEntry[i shr 1] := CurLineStart;
// copy the line // copy the line
LineStart := integer({%H-}PtrUInt(LinesList[i])); LineStart := LinesList[i];
LineEnd := integer({%H-}PtrUInt(LinesList[i + 1])); LineEnd := LinesList[i + 1];
LineLen := LineEnd - LineStart; LineLen := LineEnd - LineStart;
if LineLen > 0 then if LineLen > 0 then
Move(AText[LineStart], CurLineStart^, LineLen); Move(AText[LineStart], CurLineStart^, LineLen);