mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-21 15:12:51 +02:00
+ Fully implemented clipping
* PatternnLine now calls HLine if the lines to draw are non-patterned (10-15% speedv improvement)
This commit is contained in:
parent
a6a9da360d
commit
23c364f842
@ -706,6 +706,7 @@ var
|
||||
Col: word;
|
||||
xtmp: integer;
|
||||
Begin
|
||||
|
||||
{ must we swap the values? }
|
||||
if x >= x2 then
|
||||
Begin
|
||||
@ -713,6 +714,16 @@ var
|
||||
x2 := x;
|
||||
x:= xtmp;
|
||||
end;
|
||||
{ First convert to global coordinates }
|
||||
X := X + StartXViewPort;
|
||||
X2 := X2 + StartXViewPort;
|
||||
Y := Y + StartYViewPort;
|
||||
if ClipPixels then
|
||||
Begin
|
||||
if LineClipped(x,y,x2,y,StartXViewPort,StartYViewPort,
|
||||
StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
||||
exit;
|
||||
end;
|
||||
for x:= x to x2 do
|
||||
DirectPutPixel(X,Y);
|
||||
end;
|
||||
@ -731,6 +742,16 @@ var
|
||||
y2 := y;
|
||||
y:= ytmp;
|
||||
end;
|
||||
{ First convert to global coordinates }
|
||||
X := X + StartXViewPort;
|
||||
Y2 := Y2 + StartYViewPort;
|
||||
Y := Y + StartYViewPort;
|
||||
if ClipPixels then
|
||||
Begin
|
||||
if LineClipped(x,y,x,y2,StartXViewPort,StartYViewPort,
|
||||
StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
||||
exit;
|
||||
end;
|
||||
for y := y to y2 do Directputpixel(x,y)
|
||||
End;
|
||||
|
||||
@ -793,6 +814,18 @@ var
|
||||
end
|
||||
else
|
||||
begin
|
||||
{ Convert to global coordinates. }
|
||||
x1 := x1 + StartXViewPort;
|
||||
x2 := x2 + StartXViewPort;
|
||||
y1 := y1 + StartYViewPort;
|
||||
y2 := y2 + StartYViewPort;
|
||||
{ if fully clipped then exit... }
|
||||
if ClipPixels then
|
||||
begin
|
||||
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
||||
StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
||||
exit;
|
||||
end;
|
||||
{******************************************}
|
||||
{ SLOPED SOLID LINES }
|
||||
{******************************************}
|
||||
@ -913,6 +946,19 @@ var
|
||||
{ begin patterned lines }
|
||||
{******************************************}
|
||||
Begin
|
||||
{ Convert to global coordinates. }
|
||||
x1 := x1 + StartXViewPort;
|
||||
x2 := x2 + StartXViewPort;
|
||||
y1 := y1 + StartYViewPort;
|
||||
y2 := y2 + StartYViewPort;
|
||||
{ if fully clipped then exit... }
|
||||
if ClipPixels then
|
||||
begin
|
||||
if LineClipped(x1,y1,x2,y2,StartXViewPort, StartYViewPort,
|
||||
StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
||||
exit;
|
||||
end;
|
||||
|
||||
OldCurrentColor := CurrentColor;
|
||||
PixelCount:=0;
|
||||
if y1 = y2 then
|
||||
@ -1274,6 +1320,15 @@ var
|
||||
OldWriteMode : word;
|
||||
OldCurrentColor : word;
|
||||
begin
|
||||
{ convert to global coordinates ... }
|
||||
x1 := x1 + StartXViewPort;
|
||||
x2 := x2 + StartXViewPort;
|
||||
y := y + StartYViewPort;
|
||||
{ if line was fully clipped then exit...}
|
||||
if LineClipped(x1,y,x2,y,StartXViewPort,StartYViewPort,
|
||||
StartXViewPort+ViewWidth, StartYViewPort+ViewHeight) then
|
||||
exit;
|
||||
|
||||
OldWriteMode := CurrentWriteMode;
|
||||
CurrentWriteMode := NormalPut;
|
||||
|
||||
@ -1287,6 +1342,20 @@ var
|
||||
{ [FillSettings.Pattern][(((y+viewport.x1) and $7)+1];}
|
||||
[FillSettings.Pattern][(y and $7)+1];
|
||||
|
||||
if FillSettings.Pattern = EmptyFill then
|
||||
begin
|
||||
OldCurrentColor := CurrentColor;
|
||||
CurrentColor := CurrentBkColor;
|
||||
HLine(x1,x2,y);
|
||||
CurrentColor := OldCurrentColor;
|
||||
end
|
||||
else
|
||||
if FillSettings.Pattern = SolidFill then
|
||||
begin
|
||||
HLine(x1,x2,y);
|
||||
end
|
||||
else
|
||||
begin
|
||||
For i:= 0 to NrIterations do
|
||||
Begin
|
||||
for j:=0 to 7 do
|
||||
@ -1312,6 +1381,7 @@ var
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
CurrentWriteMode := OldWriteMode;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user