mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:26:15 +02:00
* some more procedures can be now hooked by the OS specific implementation
This commit is contained in:
parent
2c210cd7ee
commit
b8faf9a8a3
@ -1400,7 +1400,8 @@ end;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure DrawBitmapCharHorizDefault(x,y : longint;charsize : word;const s : string);forward;
|
procedure OutTextXYDefault(x,y : smallint;const TextString : string);forward;
|
||||||
|
procedure CircleDefault(X, Y: smallint; Radius:Word);forward;
|
||||||
|
|
||||||
Procedure DefaultHooks;
|
Procedure DefaultHooks;
|
||||||
{********************************************************}
|
{********************************************************}
|
||||||
@ -1435,7 +1436,8 @@ end;
|
|||||||
PatternLine := {$ifdef fpc}@{$endif}PatternLineDefault;
|
PatternLine := {$ifdef fpc}@{$endif}PatternLineDefault;
|
||||||
HLine := {$ifdef fpc}@{$endif}HLineDefault;
|
HLine := {$ifdef fpc}@{$endif}HLineDefault;
|
||||||
VLine := {$ifdef fpc}@{$endif}VLineDefault;
|
VLine := {$ifdef fpc}@{$endif}VLineDefault;
|
||||||
DrawBitmapCharHoriz := {$ifdef fpc}@{$endif}DrawBitmapCharHorizDefault;
|
OuttextXY := {$ifdef fpc}@{$endif}OuttextXYDefault;
|
||||||
|
Circle := {$ifdef fpc}@{$endif}CircleDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure InitVars;
|
Procedure InitVars;
|
||||||
@ -1526,7 +1528,7 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure Circle(X, Y: smallint; Radius:Word);
|
procedure CircleDefault(X, Y: smallint; Radius:Word);
|
||||||
{********************************************************}
|
{********************************************************}
|
||||||
{ Draws a circle centered at X,Y with the given Radius. }
|
{ Draws a circle centered at X,Y with the given Radius. }
|
||||||
{********************************************************}
|
{********************************************************}
|
||||||
@ -2317,7 +2319,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.30 2000-03-24 18:16:32 florian
|
Revision 1.31 2000-04-02 12:13:36 florian
|
||||||
|
* some more procedures can be now hooked by the OS specific implementation
|
||||||
|
|
||||||
|
Revision 1.30 2000/03/24 18:16:32 florian
|
||||||
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
||||||
win32
|
win32
|
||||||
|
|
||||||
|
@ -505,8 +505,9 @@ TYPE
|
|||||||
procedure(ColorNum: smallint; var
|
procedure(ColorNum: smallint; var
|
||||||
RedValue, GreenValue, BlueValue: smallint);
|
RedValue, GreenValue, BlueValue: smallint);
|
||||||
|
|
||||||
{ allows to speed up the drawing of bitmap font }
|
OutTextXYProc = procedure(x,y : SmallInt;const TextString : string);
|
||||||
DrawBitmapCharHorizProc = procedure(x,y : longint;charsize : word;const s : string);
|
|
||||||
|
CircleProc = procedure(X, Y: smallint; Radius:Word);
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
@ -553,8 +554,9 @@ TYPE
|
|||||||
PatternLine : PatternLineProc;
|
PatternLine : PatternLineProc;
|
||||||
HLine : HLineProc;
|
HLine : HLineProc;
|
||||||
VLine : VLineProc;
|
VLine : VLineProc;
|
||||||
|
Circle : CircleProc;
|
||||||
InitMode : InitModeProc;
|
InitMode : InitModeProc;
|
||||||
DrawBitmapCharHoriz : DrawBitmapCharHorizProc;
|
OutTextXY : OutTextXYProc;
|
||||||
next: PModeInfo;
|
next: PModeInfo;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -562,7 +564,6 @@ TYPE
|
|||||||
|
|
||||||
VAR
|
VAR
|
||||||
DirectPutPixel : DefPixelProc;
|
DirectPutPixel : DefPixelProc;
|
||||||
DrawBitmapCharHoriz : DrawBitmapCharHorizProc;
|
|
||||||
ClearViewPort : ClrViewProc;
|
ClearViewPort : ClrViewProc;
|
||||||
PutPixel : PutPixelProc;
|
PutPixel : PutPixelProc;
|
||||||
PutImage : PutImageProc;
|
PutImage : PutImageProc;
|
||||||
@ -573,6 +574,7 @@ VAR
|
|||||||
SetActivePage : SetActivePageProc;
|
SetActivePage : SetActivePageProc;
|
||||||
SetRGBPalette : SetRGBPaletteProc;
|
SetRGBPalette : SetRGBPaletteProc;
|
||||||
GetRGBPalette : GetRGBPaletteProc;
|
GetRGBPalette : GetRGBPaletteProc;
|
||||||
|
OutTextXY : OutTextXYProc;
|
||||||
|
|
||||||
GraphFreeMemPtr: graphfreememprc;
|
GraphFreeMemPtr: graphfreememprc;
|
||||||
GraphGetMemPtr : graphgetmemprc;
|
GraphGetMemPtr : graphgetmemprc;
|
||||||
@ -583,6 +585,7 @@ VAR
|
|||||||
PatternLine : PatternLineProc;
|
PatternLine : PatternLineProc;
|
||||||
HLine : HLineProc;
|
HLine : HLineProc;
|
||||||
VLine : VLineProc;
|
VLine : VLineProc;
|
||||||
|
Circle : CircleProc;
|
||||||
|
|
||||||
SaveVideoState : SaveStateProc;
|
SaveVideoState : SaveStateProc;
|
||||||
RestoreVideoState: RestoreStateProc;
|
RestoreVideoState: RestoreStateProc;
|
||||||
@ -658,7 +661,6 @@ Function GetDriverName: string;
|
|||||||
procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
|
procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
|
||||||
procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
|
procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: Word);
|
||||||
procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
|
procedure FillEllipse(X, Y: smallint; XRadius, YRadius: Word);
|
||||||
procedure Circle(X, Y: smallint; Radius:Word);
|
|
||||||
procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
|
procedure Sector(x, y: smallint; StAngle,EndAngle, XRadius, YRadius: Word);
|
||||||
procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
|
procedure Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
|
||||||
YRadius: word);
|
YRadius: word);
|
||||||
@ -673,13 +675,15 @@ Function GetDriverName: string;
|
|||||||
procedure SetTextStyle(font,direction : word;charsize : word);
|
procedure SetTextStyle(font,direction : word;charsize : word);
|
||||||
procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
|
procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
|
||||||
|
|
||||||
procedure OutTextXY(x,y : smallint;const TextString : string);
|
|
||||||
procedure OutText(const TextString : string);
|
procedure OutText(const TextString : string);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 2000-03-24 18:16:33 florian
|
Revision 1.3 2000-04-02 12:13:36 florian
|
||||||
|
* some more procedures can be now hooked by the OS specific implementation
|
||||||
|
|
||||||
|
Revision 1.2 2000/03/24 18:16:33 florian
|
||||||
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
||||||
win32
|
win32
|
||||||
|
|
||||||
|
@ -352,61 +352,7 @@
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawBitmapCharHorizDefault(x,y : longint;charsize : word;const s : string);
|
procedure OutTextXYDefault(x,y : smallint;const TextString : string);
|
||||||
|
|
||||||
var
|
|
||||||
cnt1,cnt2,cnt3,cnt4,j,k,i,xpos,c : longint;
|
|
||||||
fontbitmap : TBitmapChar;
|
|
||||||
|
|
||||||
begin
|
|
||||||
c:=length(s);
|
|
||||||
for i:=0 to c-1 do
|
|
||||||
begin
|
|
||||||
xpos:=x+(i*8)*Charsize;
|
|
||||||
{ we copy the character bitmap before accessing it }
|
|
||||||
{ this improves speed on non optimizing compilers }
|
|
||||||
{ since it is one less address calculation. }
|
|
||||||
Fontbitmap:=TBitmapChar(DefaultFontData[s[i+1]]);
|
|
||||||
{ no scaling }
|
|
||||||
if CharSize = 1 then
|
|
||||||
Begin
|
|
||||||
for j:=0 to 7 do
|
|
||||||
for k:=0 to 7 do
|
|
||||||
if Fontbitmap[j,k]<>0 then
|
|
||||||
PutPixel(xpos+k,j+y,CurrentColor);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
{ perform scaling of bitmap font }
|
|
||||||
Begin
|
|
||||||
j:=0;
|
|
||||||
cnt3:=0;
|
|
||||||
|
|
||||||
while j <= 7 do
|
|
||||||
begin
|
|
||||||
{ X-axis scaling }
|
|
||||||
for cnt4 := 0 to charsize-1 do
|
|
||||||
begin
|
|
||||||
k:=0;
|
|
||||||
cnt2 := 0;
|
|
||||||
while k <= 7 do
|
|
||||||
begin
|
|
||||||
for cnt1 := 0 to charsize-1 do
|
|
||||||
begin
|
|
||||||
If FontBitmap[j,k] <> 0 then
|
|
||||||
PutPixel(xpos+cnt1+cnt2,y+cnt3+cnt4,CurrentColor);
|
|
||||||
end;
|
|
||||||
Inc(k);
|
|
||||||
Inc(cnt2,charsize);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
Inc(j);
|
|
||||||
Inc(cnt3,charsize);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure OutTextXY(x,y : smallint;const TextString : string);
|
|
||||||
|
|
||||||
type
|
type
|
||||||
Tpoint = record
|
Tpoint = record
|
||||||
@ -424,6 +370,8 @@
|
|||||||
oldvalues : linesettingstype;
|
oldvalues : linesettingstype;
|
||||||
fontbitmap : TBitmapChar;
|
fontbitmap : TBitmapChar;
|
||||||
chr : char;
|
chr : char;
|
||||||
|
curx2i,cury2i,
|
||||||
|
xpos2i,ypos2i : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ save current write mode }
|
{ save current write mode }
|
||||||
@ -437,17 +385,58 @@
|
|||||||
if Currenttextinfo.font=DefaultFont then
|
if Currenttextinfo.font=DefaultFont then
|
||||||
begin
|
begin
|
||||||
c:=length(textstring);
|
c:=length(textstring);
|
||||||
{ We must a length strength which is ZERO based }
|
|
||||||
{ if c is a byte and length is zero, this is }
|
|
||||||
{ dangerous, fixed }
|
|
||||||
Dec(c);
|
|
||||||
if CurrentTextInfo.direction=HorizDir then
|
if CurrentTextInfo.direction=HorizDir then
|
||||||
{ Horizontal direction }
|
{ Horizontal direction }
|
||||||
DrawBitmapCharHoriz(x,y,charsize,TextString)
|
begin
|
||||||
|
for i:=0 to c-1 do
|
||||||
|
begin
|
||||||
|
xpos:=x+(i*8)*Charsize;
|
||||||
|
{ we copy the character bitmap before accessing it }
|
||||||
|
{ this improves speed on non optimizing compilers }
|
||||||
|
{ since it is one less address calculation. }
|
||||||
|
Fontbitmap:=TBitmapChar(DefaultFontData[TextString[i+1]]);
|
||||||
|
{ no scaling }
|
||||||
|
if CharSize = 1 then
|
||||||
|
Begin
|
||||||
|
for j:=0 to 7 do
|
||||||
|
for k:=0 to 7 do
|
||||||
|
if Fontbitmap[j,k]<>0 then
|
||||||
|
PutPixel(xpos+k,j+y,CurrentColor);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{ perform scaling of bitmap font }
|
||||||
|
Begin
|
||||||
|
j:=0;
|
||||||
|
cnt3:=0;
|
||||||
|
|
||||||
|
while j <= 7 do
|
||||||
|
begin
|
||||||
|
{ X-axis scaling }
|
||||||
|
for cnt4 := 0 to charsize-1 do
|
||||||
|
begin
|
||||||
|
k:=0;
|
||||||
|
cnt2 := 0;
|
||||||
|
while k <= 7 do
|
||||||
|
begin
|
||||||
|
for cnt1 := 0 to charsize-1 do
|
||||||
|
begin
|
||||||
|
If FontBitmap[j,k] <> 0 then
|
||||||
|
PutPixel(xpos+cnt1+cnt2,y+cnt3+cnt4,CurrentColor);
|
||||||
|
end;
|
||||||
|
Inc(k);
|
||||||
|
Inc(cnt2,charsize);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Inc(j);
|
||||||
|
Inc(cnt3,charsize);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
{ Vertical direction }
|
{ Vertical direction }
|
||||||
begin
|
begin
|
||||||
for i:=0 to c do
|
for i:=0 to c-1 do
|
||||||
begin
|
begin
|
||||||
|
|
||||||
chr := TextString[i+1];
|
chr := TextString[i+1];
|
||||||
@ -534,7 +523,38 @@
|
|||||||
CurY2 := YPos2;
|
CurY2 := YPos2;
|
||||||
end;
|
end;
|
||||||
_DRAW: Begin
|
_DRAW: Begin
|
||||||
Line(trunc(CurX2),trunc(CurY2),trunc(xpos2),trunc(ypos2));
|
curx2i:=trunc(CurX2);
|
||||||
|
cury2i:=trunc(CurY2);
|
||||||
|
xpos2i:=trunc(xpos2);
|
||||||
|
ypos2i:=trunc(ypos2);
|
||||||
|
{ this optimization doesn't matter that much
|
||||||
|
if (curx2i=xpos2i) then
|
||||||
|
begin
|
||||||
|
if (cury2i=ypos2i) then
|
||||||
|
putpixel(curx2i,cury2i,currentcolor)
|
||||||
|
else if (cury2i+1=ypos2i) or
|
||||||
|
(cury2i=ypos2i+1) then
|
||||||
|
begin
|
||||||
|
putpixel(curx2i,cury2i,currentcolor);
|
||||||
|
putpixel(curx2i,ypos2i,currentcolor);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Line(curx2i,cury2i,xpos2i,ypos2i);
|
||||||
|
end
|
||||||
|
else if (cury2i=ypos2i) then
|
||||||
|
begin
|
||||||
|
if (curx2i+1=xpos2i) or
|
||||||
|
(curx2i=xpos2i+1) then
|
||||||
|
begin
|
||||||
|
putpixel(curx2i,cury2i,currentcolor);
|
||||||
|
putpixel(xpos2i,cury2i,currentcolor);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Line(curx2i,cury2i,xpos2i,ypos2i);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
}
|
||||||
|
Line(curx2i,cury2i,xpos2i,ypos2i);
|
||||||
CurX2:=xpos2;
|
CurX2:=xpos2;
|
||||||
CurY2:=ypos2;
|
CurY2:=ypos2;
|
||||||
end;
|
end;
|
||||||
@ -735,7 +755,10 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.16 2000-03-24 18:16:33 florian
|
Revision 1.17 2000-04-02 12:13:36 florian
|
||||||
|
* some more procedures can be now hooked by the OS specific implementation
|
||||||
|
|
||||||
|
Revision 1.16 2000/03/24 18:16:33 florian
|
||||||
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
||||||
win32
|
win32
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@
|
|||||||
SetVisualPage := modeInfo^.SetVisualPage;
|
SetVisualPage := modeInfo^.SetVisualPage;
|
||||||
if assigned(modeInfo^.SetActivePage) then
|
if assigned(modeInfo^.SetActivePage) then
|
||||||
SetActivePage := modeInfo^.SetActivePage;
|
SetActivePage := modeInfo^.SetActivePage;
|
||||||
if assigned(modeInfo^.DrawBitmapCharHoriz) then
|
if assigned(modeInfo^.OutTextXY) then
|
||||||
DrawBitmapCharHoriz:=modeInfo^.DrawBitmapCharHoriz;
|
OutTextXY:=modeInfo^.OutTextXY;
|
||||||
|
|
||||||
IntCurrentMode := modeinfo^.ModeNumber;
|
IntCurrentMode := modeinfo^.ModeNumber;
|
||||||
IntCurrentDriver := modeinfo^.DriverNumber;
|
IntCurrentDriver := modeinfo^.DriverNumber;
|
||||||
@ -363,7 +363,10 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.21 2000-03-24 18:16:33 florian
|
Revision 1.22 2000-04-02 12:13:37 florian
|
||||||
|
* some more procedures can be now hooked by the OS specific implementation
|
||||||
|
|
||||||
|
Revision 1.21 2000/03/24 18:16:33 florian
|
||||||
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
* introduce a DrawBitmapCharHoriz procedure variable to accelerate output on
|
||||||
win32
|
win32
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user