* some more procedures can be now hooked by the OS specific implementation

This commit is contained in:
florian 2000-04-02 12:13:36 +00:00
parent 2c210cd7ee
commit b8faf9a8a3
4 changed files with 112 additions and 77 deletions

View File

@ -1400,7 +1400,8 @@ 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;
{********************************************************}
@ -1435,7 +1436,8 @@ end;
PatternLine := {$ifdef fpc}@{$endif}PatternLineDefault;
HLine := {$ifdef fpc}@{$endif}HLineDefault;
VLine := {$ifdef fpc}@{$endif}VLineDefault;
DrawBitmapCharHoriz := {$ifdef fpc}@{$endif}DrawBitmapCharHorizDefault;
OuttextXY := {$ifdef fpc}@{$endif}OuttextXYDefault;
Circle := {$ifdef fpc}@{$endif}CircleDefault;
end;
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. }
{********************************************************}
@ -2317,7 +2319,10 @@ begin
end;
{
$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
win32

View File

@ -505,8 +505,9 @@ TYPE
procedure(ColorNum: smallint; var
RedValue, GreenValue, BlueValue: smallint);
{ allows to speed up the drawing of bitmap font }
DrawBitmapCharHorizProc = procedure(x,y : longint;charsize : word;const s : string);
OutTextXYProc = procedure(x,y : SmallInt;const TextString : string);
CircleProc = procedure(X, Y: smallint; Radius:Word);
TYPE
@ -553,8 +554,9 @@ TYPE
PatternLine : PatternLineProc;
HLine : HLineProc;
VLine : VLineProc;
Circle : CircleProc;
InitMode : InitModeProc;
DrawBitmapCharHoriz : DrawBitmapCharHorizProc;
OutTextXY : OutTextXYProc;
next: PModeInfo;
end;
@ -562,7 +564,6 @@ TYPE
VAR
DirectPutPixel : DefPixelProc;
DrawBitmapCharHoriz : DrawBitmapCharHorizProc;
ClearViewPort : ClrViewProc;
PutPixel : PutPixelProc;
PutImage : PutImageProc;
@ -573,6 +574,7 @@ VAR
SetActivePage : SetActivePageProc;
SetRGBPalette : SetRGBPaletteProc;
GetRGBPalette : GetRGBPaletteProc;
OutTextXY : OutTextXYProc;
GraphFreeMemPtr: graphfreememprc;
GraphGetMemPtr : graphgetmemprc;
@ -583,6 +585,7 @@ VAR
PatternLine : PatternLineProc;
HLine : HLineProc;
VLine : VLineProc;
Circle : CircleProc;
SaveVideoState : SaveStateProc;
RestoreVideoState: RestoreStateProc;
@ -658,7 +661,6 @@ Function GetDriverName: string;
procedure Arc(X,Y : smallint; StAngle,EndAngle,Radius: word);
procedure PieSlice(X,Y,stangle,endAngle:smallint;Radius: 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 Ellipse(X,Y : smallint; stAngle, EndAngle: word; XRadius,
YRadius: word);
@ -673,13 +675,15 @@ Function GetDriverName: string;
procedure SetTextStyle(font,direction : word;charsize : word);
procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
procedure OutTextXY(x,y : smallint;const TextString : string);
procedure OutText(const TextString : string);
{
$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
win32

View File

@ -352,61 +352,7 @@
end;
end;
procedure DrawBitmapCharHorizDefault(x,y : longint;charsize : word;const s : 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);
procedure OutTextXYDefault(x,y : smallint;const TextString : string);
type
Tpoint = record
@ -424,6 +370,8 @@
oldvalues : linesettingstype;
fontbitmap : TBitmapChar;
chr : char;
curx2i,cury2i,
xpos2i,ypos2i : longint;
begin
{ save current write mode }
@ -437,17 +385,58 @@
if Currenttextinfo.font=DefaultFont then
begin
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
{ 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
{ Vertical direction }
begin
for i:=0 to c do
for i:=0 to c-1 do
begin
chr := TextString[i+1];
@ -534,7 +523,38 @@
CurY2 := YPos2;
end;
_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;
CurY2:=ypos2;
end;
@ -735,7 +755,10 @@
{
$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
win32

View File

@ -309,8 +309,8 @@
SetVisualPage := modeInfo^.SetVisualPage;
if assigned(modeInfo^.SetActivePage) then
SetActivePage := modeInfo^.SetActivePage;
if assigned(modeInfo^.DrawBitmapCharHoriz) then
DrawBitmapCharHoriz:=modeInfo^.DrawBitmapCharHoriz;
if assigned(modeInfo^.OutTextXY) then
OutTextXY:=modeInfo^.OutTextXY;
IntCurrentMode := modeinfo^.ModeNumber;
IntCurrentDriver := modeinfo^.DriverNumber;
@ -363,7 +363,10 @@
{
$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
win32