mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 09:29:26 +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;
|
Col: word;
|
||||||
xtmp: integer;
|
xtmp: integer;
|
||||||
Begin
|
Begin
|
||||||
|
|
||||||
{ must we swap the values? }
|
{ must we swap the values? }
|
||||||
if x >= x2 then
|
if x >= x2 then
|
||||||
Begin
|
Begin
|
||||||
@ -713,6 +714,16 @@ var
|
|||||||
x2 := x;
|
x2 := x;
|
||||||
x:= xtmp;
|
x:= xtmp;
|
||||||
end;
|
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
|
for x:= x to x2 do
|
||||||
DirectPutPixel(X,Y);
|
DirectPutPixel(X,Y);
|
||||||
end;
|
end;
|
||||||
@ -731,6 +742,16 @@ var
|
|||||||
y2 := y;
|
y2 := y;
|
||||||
y:= ytmp;
|
y:= ytmp;
|
||||||
end;
|
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)
|
for y := y to y2 do Directputpixel(x,y)
|
||||||
End;
|
End;
|
||||||
|
|
||||||
@ -793,6 +814,18 @@ var
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
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 }
|
{ SLOPED SOLID LINES }
|
||||||
{******************************************}
|
{******************************************}
|
||||||
@ -913,6 +946,19 @@ var
|
|||||||
{ begin patterned lines }
|
{ begin patterned lines }
|
||||||
{******************************************}
|
{******************************************}
|
||||||
Begin
|
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;
|
OldCurrentColor := CurrentColor;
|
||||||
PixelCount:=0;
|
PixelCount:=0;
|
||||||
if y1 = y2 then
|
if y1 = y2 then
|
||||||
@ -1274,6 +1320,15 @@ var
|
|||||||
OldWriteMode : word;
|
OldWriteMode : word;
|
||||||
OldCurrentColor : word;
|
OldCurrentColor : word;
|
||||||
begin
|
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;
|
OldWriteMode := CurrentWriteMode;
|
||||||
CurrentWriteMode := NormalPut;
|
CurrentWriteMode := NormalPut;
|
||||||
|
|
||||||
@ -1287,6 +1342,20 @@ var
|
|||||||
{ [FillSettings.Pattern][(((y+viewport.x1) and $7)+1];}
|
{ [FillSettings.Pattern][(((y+viewport.x1) and $7)+1];}
|
||||||
[FillSettings.Pattern][(y 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
|
For i:= 0 to NrIterations do
|
||||||
Begin
|
Begin
|
||||||
for j:=0 to 7 do
|
for j:=0 to 7 do
|
||||||
@ -1312,6 +1381,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
CurrentWriteMode := OldWriteMode;
|
CurrentWriteMode := OldWriteMode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user