mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 14:29:20 +02:00
* fix several problems with go32v2 graphic support
This commit is contained in:
parent
6944b08646
commit
2673dda4d4
@ -88,11 +88,11 @@ type
|
|||||||
VIDEBuffer : PByteArray;
|
VIDEBuffer : PByteArray;
|
||||||
IDEVideoInfo : TDOSVideoInfo;
|
IDEVideoInfo : TDOSVideoInfo;
|
||||||
ctrl_c_state : boolean;
|
ctrl_c_state : boolean;
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
GraphImageSize : longint;
|
GraphImageSize : longint;
|
||||||
GraphBuffer : pointer;
|
GraphBuffer : pointer;
|
||||||
ConsoleGraphDriver, ConsoleGraphMode : word;
|
ConsoleGraphDriver, ConsoleGraphMode : word;
|
||||||
{$endif TEST_GRAPH_SWITCH}
|
{$endif USE_GRAPH_SWITCH}
|
||||||
function GetLineStartOfs(Line: integer): word;
|
function GetLineStartOfs(Line: integer): word;
|
||||||
procedure GetBuffer(Size: word);
|
procedure GetBuffer(Size: word);
|
||||||
procedure FreeBuffer;
|
procedure FreeBuffer;
|
||||||
@ -183,13 +183,13 @@ uses
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
,Drivers,App
|
,Drivers,App
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
,Graph,VESA
|
,Graph,VESA
|
||||||
{$else not TEST_GRAPH_SWITCH}
|
{$else not USE_GRAPH_SWITCH}
|
||||||
{$ifdef VESA}
|
{$ifdef VESA}
|
||||||
,VESA
|
,VESA
|
||||||
{$endif VESA}
|
{$endif VESA}
|
||||||
{$endif not TEST_GRAPH_SWITCH}
|
{$endif not USE_GRAPH_SWITCH}
|
||||||
;
|
;
|
||||||
|
|
||||||
function TScreen.GetWidth: integer;
|
function TScreen.GetWidth: integer;
|
||||||
@ -283,21 +283,29 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
procedure TDOSScreen.GetLine(Line: integer; var Text, Attr: string);
|
procedure TDOSScreen.GetLine(Line: integer; var Text, Attr: string);
|
||||||
var X: integer;
|
var
|
||||||
W: word;
|
X: integer;
|
||||||
|
W: word;
|
||||||
begin
|
begin
|
||||||
Text:=''; Attr:='';
|
Text:=''; Attr:='';
|
||||||
if Line<GetHeight then
|
{ VBuffer remains empty if in graph mode ... PM }
|
||||||
begin
|
if (Line<GetHeight) and assigned(VBuffer) then
|
||||||
W:=GetLineStartOfs(Line);
|
begin
|
||||||
for X:=0 to GetWidth-1 do
|
W:=GetLineStartOfs(Line);
|
||||||
begin
|
for X:=0 to GetWidth-1 do
|
||||||
{Text:=Text+chr(VBuffer^[W+X*2]);
|
begin
|
||||||
Attr:=Attr+chr(VBuffer^[W+X*2+1]);}
|
{Text:=Text+chr(VBuffer^[W+X*2]);
|
||||||
System.Insert(chr(VBuffer^[W+X*2]),Text,Length(Text)+1);
|
Attr:=Attr+chr(VBuffer^[W+X*2+1]);}
|
||||||
System.Insert(chr(VBuffer^[W+X*2+1]),Attr,Length(Attr)+1);
|
System.Insert(chr(VBuffer^[W+X*2]),Text,Length(Text)+1);
|
||||||
end;
|
System.Insert(chr(VBuffer^[W+X*2+1]),Attr,Length(Attr)+1);
|
||||||
|
end;
|
||||||
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
|
end
|
||||||
|
else if assigned(GraphBuffer) and (Line=0) then
|
||||||
|
Text:='Console in graph mode, use Alt+F5';
|
||||||
|
{$else not USE_GRAPH_SWITCH}
|
||||||
end;
|
end;
|
||||||
|
{$endif USE_GRAPH_SWITCH}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -340,13 +348,13 @@ end;
|
|||||||
procedure TDosScreen.SaveConsoleScreen;
|
procedure TDosScreen.SaveConsoleScreen;
|
||||||
var
|
var
|
||||||
VSeg,SOfs: word;
|
VSeg,SOfs: word;
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
saved : boolean;
|
saved : boolean;
|
||||||
GraphDriver,GraphMode : integer;
|
GraphDriver,GraphMode : integer;
|
||||||
{$endif TEST_GRAPH_SWITCH}
|
{$endif USE_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
GetVideoMode(ConsoleVideoInfo);
|
GetVideoMode(ConsoleVideoInfo);
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
saved:=false;
|
saved:=false;
|
||||||
if assigned(GraphBuffer) then
|
if assigned(GraphBuffer) then
|
||||||
begin
|
begin
|
||||||
@ -391,6 +399,9 @@ begin
|
|||||||
GetMem(GraphBuffer,GraphImageSize);
|
GetMem(GraphBuffer,GraphImageSize);
|
||||||
FillChar(GraphBuffer^,GraphImageSize,#0);
|
FillChar(GraphBuffer^,GraphImageSize,#0);
|
||||||
GetImage(0,0,Graph.GetmaxX,Graph.GetMaxY,GraphBuffer^);
|
GetImage(0,0,Graph.GetmaxX,Graph.GetMaxY,GraphBuffer^);
|
||||||
|
ConsoleVideoInfo.Rows:=Graph.GetMaxY div 8;
|
||||||
|
ConsoleVideoInfo.Cols:=Graph.GetMaxX div 8;
|
||||||
|
FreeBuffer;
|
||||||
saved:=true;
|
saved:=true;
|
||||||
end
|
end
|
||||||
{$ifdef DEBUG}
|
{$ifdef DEBUG}
|
||||||
@ -402,7 +413,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ mode < $100 so use standard Save code }
|
{ mode < $100 so use standard Save code }
|
||||||
if not saved then
|
if not saved then
|
||||||
{$endif TEST_GRAPH_SWITCH}
|
{$endif USE_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
GetBuffer(ConsoleVideoInfo.ScreenSize);
|
GetBuffer(ConsoleVideoInfo.ScreenSize);
|
||||||
if ConsoleVideoInfo.Mode=7 then
|
if ConsoleVideoInfo.Mode=7 then
|
||||||
@ -421,13 +432,13 @@ end;
|
|||||||
procedure TDOSScreen.SwitchToConsoleScreen;
|
procedure TDOSScreen.SwitchToConsoleScreen;
|
||||||
var
|
var
|
||||||
VSeg,SOfs: word;
|
VSeg,SOfs: word;
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
restored : boolean;
|
restored : boolean;
|
||||||
GraphDriver,GraphMode : integer;
|
GraphDriver,GraphMode : integer;
|
||||||
{$endif TEST_GRAPH_SWITCH}
|
{$endif USE_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
SetVideoMode(ConsoleVideoInfo);
|
SetVideoMode(ConsoleVideoInfo);
|
||||||
{$ifdef TEST_GRAPH_SWITCH}
|
{$ifdef USE_GRAPH_SWITCH}
|
||||||
restored:=false;
|
restored:=false;
|
||||||
if assigned(GraphBuffer) then
|
if assigned(GraphBuffer) then
|
||||||
begin
|
begin
|
||||||
@ -466,7 +477,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{ mode < $100 so use standard Save code }
|
{ mode < $100 so use standard Save code }
|
||||||
if not restored then
|
if not restored then
|
||||||
{$endif TEST_GRAPH_SWITCH}
|
{$endif USE_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
if ConsoleVideoInfo.Mode=7 then
|
if ConsoleVideoInfo.Mode=7 then
|
||||||
VSeg:=SegB000
|
VSeg:=SegB000
|
||||||
@ -1226,7 +1237,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.20 2002-09-13 08:15:06 pierre
|
Revision 1.21 2002-09-13 22:27:07 pierre
|
||||||
|
* fix several problems with go32v2 graphic support
|
||||||
|
|
||||||
|
Revision 1.20 2002/09/13 08:15:06 pierre
|
||||||
* fix cursor position for linux vcsa support
|
* fix cursor position for linux vcsa support
|
||||||
|
|
||||||
Revision 1.19 2002/09/13 07:17:33 pierre
|
Revision 1.19 2002/09/13 07:17:33 pierre
|
||||||
|
Loading…
Reference in New Issue
Block a user