2005-09-11 06:20:56 -04:00
|
|
|
unit BucketFillerThread;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
Classes, Windows,
|
2006-08-22 09:35:52 -04:00
|
|
|
ControlPoint, Render, XForm, RenderTypes;
|
2005-09-11 06:20:56 -04:00
|
|
|
|
|
|
|
type
|
|
|
|
TBucketFillerThread = class(TThread)
|
2006-08-22 09:35:52 -04:00
|
|
|
|
2005-09-11 06:20:56 -04:00
|
|
|
private
|
|
|
|
fcp: TControlPoint;
|
|
|
|
points: TPointsArray;
|
2006-08-22 09:35:52 -04:00
|
|
|
|
2005-09-11 06:20:56 -04:00
|
|
|
public
|
|
|
|
nrbatches: integer;
|
|
|
|
batchcounter: Pinteger;
|
|
|
|
|
|
|
|
ColorMap: TColorMapArray;
|
|
|
|
CriticalSection: TRTLCriticalSection;
|
|
|
|
|
2006-08-22 09:35:52 -04:00
|
|
|
AddPointsProc: procedure (const points: TPointsArray) of object;
|
|
|
|
|
2005-09-11 06:20:56 -04:00
|
|
|
constructor Create(cp: TControlPoint);
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
|
|
procedure Execute; override;
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
constructor TBucketFillerThread.Create(cp: TControlPoint);
|
|
|
|
begin
|
|
|
|
inherited Create(True);
|
|
|
|
Self.FreeOnTerminate := True;
|
|
|
|
|
|
|
|
Fcp := cp.Clone;
|
|
|
|
|
|
|
|
SetLength(Points, SUB_BATCH_SIZE);
|
2006-03-02 12:27:20 -05:00
|
|
|
|
2006-03-06 10:34:54 -05:00
|
|
|
fcp.Prepare;
|
2005-09-11 06:20:56 -04:00
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
destructor TBucketFillerThread.Destroy;
|
|
|
|
begin
|
2006-03-08 09:21:36 -05:00
|
|
|
FCP.Free;
|
2005-09-11 06:20:56 -04:00
|
|
|
|
|
|
|
inherited;
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
procedure TBucketFillerThread.Execute;
|
|
|
|
var
|
|
|
|
bc: integer;
|
|
|
|
begin
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
bc := 0;
|
|
|
|
while (not Terminated) and (bc < Nrbatches) do begin
|
|
|
|
fcp.iterateXYC(SUB_BATCH_SIZE, points);
|
2006-08-22 09:35:52 -04:00
|
|
|
|
2005-09-11 06:20:56 -04:00
|
|
|
try
|
|
|
|
EnterCriticalSection(CriticalSection);
|
|
|
|
|
2006-03-02 12:27:20 -05:00
|
|
|
AddPointsProc(Points);
|
2005-09-11 06:20:56 -04:00
|
|
|
|
|
|
|
Inc(batchcounter^);
|
|
|
|
bc := batchcounter^
|
|
|
|
finally
|
|
|
|
LeaveCriticalSection(CriticalSection);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2006-08-22 09:35:52 -04:00
|
|
|
|
|
|
|
{ -- RENDER THREAD MUST *NOT* KNOW ANYTHING ABOUT BUCKETS!!! -- }
|
|
|
|
|
2005-09-11 06:20:56 -04:00
|
|
|
end.
|