mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 09:59:08 +02:00
* micro optimization in the putpixel routines of the msdos graph unit: perform
clipping before switching to global coordinates, as the comparisons are then simpler git-svn-id: trunk@30263 -
This commit is contained in:
parent
a5a61243b8
commit
50fd91b3e1
@ -216,16 +216,16 @@ var
|
|||||||
Offset: Word;
|
Offset: Word;
|
||||||
B, Mask, Shift: Byte;
|
B, Mask, Shift: Byte;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Offset := (Y shr 2) * 90 + (X shr 3) + VideoOfs;
|
Offset := (Y shr 2) * 90 + (X shr 3) + VideoOfs;
|
||||||
case Y and 3 of
|
case Y and 3 of
|
||||||
1: Inc(Offset, $2000);
|
1: Inc(Offset, $2000);
|
||||||
@ -620,16 +620,16 @@ var
|
|||||||
Offset: Word;
|
Offset: Word;
|
||||||
B, Mask, Shift: Byte;
|
B, Mask, Shift: Byte;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Offset := (Y shr 1) * 80 + (X shr 2);
|
Offset := (Y shr 1) * 80 + (X shr 2);
|
||||||
if (Y and 1) <> 0 then
|
if (Y and 1) <> 0 then
|
||||||
Inc(Offset, 8192);
|
Inc(Offset, 8192);
|
||||||
@ -930,16 +930,16 @@ var
|
|||||||
Offset: Word;
|
Offset: Word;
|
||||||
B, Mask, Shift: Byte;
|
B, Mask, Shift: Byte;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Offset := (Y shr 1) * 80 + (X shr 3);
|
Offset := (Y shr 1) * 80 + (X shr 3);
|
||||||
if (Y and 1) <> 0 then
|
if (Y and 1) <> 0 then
|
||||||
Inc(Offset, 8192);
|
Inc(Offset, 8192);
|
||||||
@ -1238,16 +1238,16 @@ var
|
|||||||
Offset: Word;
|
Offset: Word;
|
||||||
B, Mask, Shift: Byte;
|
B, Mask, Shift: Byte;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Offset := Y * 80 + (X shr 3);
|
Offset := Y * 80 + (X shr 3);
|
||||||
Shift := 7 - (X and 7);
|
Shift := 7 - (X and 7);
|
||||||
Mask := 1 shl Shift;
|
Mask := 1 shl Shift;
|
||||||
@ -1548,16 +1548,16 @@ end;
|
|||||||
dummy: byte;
|
dummy: byte;
|
||||||
{$endif asmgraph}
|
{$endif asmgraph}
|
||||||
Begin
|
Begin
|
||||||
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
|
if ClipPixels then
|
||||||
|
begin
|
||||||
|
if (X < 0) or (X > ViewWidth) then
|
||||||
|
exit;
|
||||||
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
X:= X + StartXViewPort;
|
X:= X + StartXViewPort;
|
||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
|
||||||
Begin
|
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
|
||||||
exit;
|
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{$ifndef asmgraph}
|
{$ifndef asmgraph}
|
||||||
offset := y * 80 + (x shr 3) + VideoOfs;
|
offset := y * 80 + (x shr 3) + VideoOfs;
|
||||||
PortW[$3ce] := $0f01; { Index 01 : Enable ops on all 4 planes }
|
PortW[$3ce] := $0f01; { Index 01 : Enable ops on all 4 planes }
|
||||||
@ -2363,16 +2363,16 @@ End;
|
|||||||
Procedure PutPixel320(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
Procedure PutPixel320(X,Y : smallint; Pixel: Word); {$ifndef fpc}far;{$endif fpc}
|
||||||
{ x,y -> must be in local coordinates. Clipping if required. }
|
{ x,y -> must be in local coordinates. Clipping if required. }
|
||||||
Begin
|
Begin
|
||||||
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
|
if ClipPixels then
|
||||||
|
begin
|
||||||
|
if (X < 0) or (X > ViewWidth) then
|
||||||
|
exit;
|
||||||
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
X:= X + StartXViewPort;
|
X:= X + StartXViewPort;
|
||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
|
||||||
Begin
|
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
|
||||||
exit;
|
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
asm
|
asm
|
||||||
mov es, [SegA000]
|
mov es, [SegA000]
|
||||||
mov ax, [Y]
|
mov ax, [Y]
|
||||||
@ -2706,16 +2706,16 @@ const CrtAddress: word = 0;
|
|||||||
var offset: word;
|
var offset: word;
|
||||||
{$endif asmgraph}
|
{$endif asmgraph}
|
||||||
begin
|
begin
|
||||||
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
|
if ClipPixels then
|
||||||
|
begin
|
||||||
|
if (X < 0) or (X > ViewWidth) then
|
||||||
|
exit;
|
||||||
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
X:= X + StartXViewPort;
|
X:= X + StartXViewPort;
|
||||||
Y:= Y + StartYViewPort;
|
Y:= Y + StartYViewPort;
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
|
||||||
Begin
|
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
|
||||||
exit;
|
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
{$ifndef asmgraph}
|
{$ifndef asmgraph}
|
||||||
offset := y * 80 + x shr 2 + VideoOfs;
|
offset := y * 80 + x shr 2 + VideoOfs;
|
||||||
PortW[$3c4] := (hi(word(FirstPlane)) shl 8) shl (x and 3)+ lo(word(FirstPlane));
|
PortW[$3c4] := (hi(word(FirstPlane)) shl 8) shl (x and 3)+ lo(word(FirstPlane));
|
||||||
|
@ -221,16 +221,16 @@ end;
|
|||||||
var
|
var
|
||||||
offs : longint;
|
offs : longint;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
Begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
||||||
offs := longint(y) * BytesPerLine + x;
|
offs := longint(y) * BytesPerLine + x;
|
||||||
begin
|
begin
|
||||||
@ -993,16 +993,16 @@ end;
|
|||||||
{$ifdef logging}
|
{$ifdef logging}
|
||||||
logln('putpixvesa32kor64k('+strf(x)+','+strf(y)+')');
|
logln('putpixvesa32kor64k('+strf(x)+','+strf(y)+')');
|
||||||
{$endif logging}
|
{$endif logging}
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
|
||||||
if ClipPixels then
|
if ClipPixels then
|
||||||
Begin
|
begin
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
||||||
offs := longint(y) * BytesPerLine + 2*x;
|
offs := longint(y) * BytesPerLine + 2*x;
|
||||||
bank := offs div 65536;
|
bank := offs div 65536;
|
||||||
@ -1398,16 +1398,16 @@ end;
|
|||||||
offs : longint;
|
offs : longint;
|
||||||
dummy : byte;
|
dummy : byte;
|
||||||
begin
|
begin
|
||||||
X:= X + StartXViewPort;
|
{ verify clipping and then convert to absolute coordinates...}
|
||||||
Y:= Y + StartYViewPort;
|
if ClipPixels then
|
||||||
{ convert to absolute coordinates and then verify clipping...}
|
begin
|
||||||
if ClipPixels then
|
if (X < 0) or (X > ViewWidth) then
|
||||||
Begin
|
|
||||||
if (X < StartXViewPort) or (X > (StartXViewPort + ViewWidth)) then
|
|
||||||
exit;
|
exit;
|
||||||
if (Y < StartYViewPort) or (Y > (StartYViewPort + ViewHeight)) then
|
if (Y < 0) or (Y > ViewHeight) then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
X:= X + StartXViewPort;
|
||||||
|
Y:= Y + StartYViewPort;
|
||||||
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
Y := Y + YOffset; { adjust pixel for correct virtual page }
|
||||||
{ }
|
{ }
|
||||||
offs := longint(y) * BytesPerLine + (x div 8);
|
offs := longint(y) * BytesPerLine + (x div 8);
|
||||||
|
Loading…
Reference in New Issue
Block a user