* ClearViewPort was wrong ,and is now 75% faster

* Some clipping added by replacing DirectPutPixel -> PutPixel
This commit is contained in:
carl 1999-04-25 00:31:37 +00:00
parent 28f657b4db
commit a6a9da360d

View File

@ -619,7 +619,6 @@ const
($80,$40,$20,$10,$08,$04,$02,$01);
MaxModes = 13;
{ pre expanded line patterns }
@ -1403,19 +1402,30 @@ var
Procedure ClearViewPortDefault;
var
i,j: integer;
MaxWidth, MaxHeight: Integer;
j: integer;
OldWriteMode, OldCurColor: word;
LineSets : LineSettingsType;
Begin
{ CP is always RELATIVE coordinates }
CurrentX := 0;
CurrentY := 0;
MaxWidth := StartXViewPort + ViewWidth;
MaxHeight := StartYViewPort + ViewHeight;
for J:=StartYViewPort to MaxHeight do
Begin
for i:=StartXViewPort to MaxWidth do
PutPixel(I,J,CurrentBkColor);
end;
{ Save all old settings }
OldCurColor := CurrentColor;
CurrentColor:=CurrentBkColor;
OldWriteMode:=CurrentWriteMode;
GetLineSettings(LineSets);
{ reset to normal line style...}
SetLineStyle(SolidLn, 0, NormWidth);
{ routines are relative here...}
for J:=0 to ViewHeight do
HLine(0, ViewWidth, J);
{ restore old settings...}
SetLineStyle(LineSets.LineStyle, LineSets.Pattern, LineSets.Thickness);
CurrentColor := OldCurColor;
CurrentWriteMode := OldWriteMode;
end;
@ -1696,10 +1706,10 @@ end;
if (Radius = 1) then
begin
OldWriteMode:=CurrentWriteMode;
CurrentWriteMode := NormalPut;
DirectPutPixel(X, Y);
CurrentWriteMode := OldWriteMode;
{ must use clipping ... }
{ don't need to explicitly set NormalPut mode }
{ because PutPixel only supports normal put }
PutPixel(X, Y,CurrentColor);
Exit;
end;
@ -1767,10 +1777,8 @@ end;
if (Radius = 1) then
begin
OldWriteMode := CurrentWriteMode;
CurrentWriteMode := NormalPut;
DirectPutPixel(X, Y);
CurrentWriteMode := OldWriteMode;
{ only normal put mode is supported by a call to PutPixel }
PutPixel(X, Y, CurrentColor);
Exit;
end;
@ -1803,9 +1811,11 @@ end;
Currentwritemode:=normalput;
Line(ArcCall.XStart, ArcCall.YStart, x,y);
Line(x,y,ArcCall.Xend,ArcCall.YEnd);
DirectPutPixel(ArcCall.xstart,ArcCall.ystart);
DirectPutPixel(x,y);
DirectPutPixel(ArcCall.xend,ArcCall.yend);
{ we must take care of clipping so we call PutPixel instead }
{ of DirectPutPixel... }
PutPixel(ArcCall.xstart,ArcCall.ystart,CurrentColor);
PutPixel(x,y,CurrentColor);
PutPixel(ArcCall.xend,ArcCall.yend,CurrentColor);
stangle:=Stangle mod 360; EndAngle:=Endangle mod 360;
if stAngle<=Endangle then
Angle:=(stAngle+EndAngle)/2
@ -1888,12 +1898,14 @@ end;
Lineinfo.thickness:=normwidth;
case Fillsettings.pattern of
EmptyFill : begin
EmptyFill :
begin
Currentcolor:=CurrentBkColor;
for y:=y1 to y2 do
Hline(x1,x2,y);
end;
SolidFill : begin
SolidFill :
begin
CurrentColor:=FillSettings.color;
for y:=y1 to y2 do
Hline(x1,x2,y);
@ -2203,9 +2215,11 @@ end;
Arc(x,y,StAngle,EndAngle,Radius);
Line(ArcCall.XStart, ArcCall.YStart, x,y);
Line(x,y, ArcCall.XEnd, ArcCall.YEnd);
DirectPutPixel(ArcCall.xstart,ArcCall.ystart);
DirectPutPixel(x,y);
DirectPutPixel(ArcCall.xend,ArcCall.yend);
{ must use PutPixel() instead of DirectPutPixel because we need }
{ clipping... }
PutPixel(ArcCall.xstart,ArcCall.ystart,CurrentColor);
PutPixel(x,y,CurrentColor);
PutPixel(ArcCall.xend,ArcCall.yend,CurrentColor);
Stangle:=stAngle mod 360; EndAngle:=Endangle mod 360;
if Stangle<=Endangle then
angle:=(StAngle+EndAngle)/2
@ -2322,14 +2336,6 @@ SetRGBPalette
SetVisualPage
DetectGraph
{ These routine must be hooked for every new platform: }
{ }
{ InitGraph() }
{ PutPixel() }
{ DirectPutPixel() }
{ GetPixel() }
{ CloseGraph() }
{ DetectGraph() }
{ GetPalette() }
{ SetAllPalette() }