mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-04 19:09:22 +01:00
+ new test code for go32v2 graphic screen saves (only with -dDEBUG)
This commit is contained in:
parent
d1c1c11f34
commit
7e29d3feeb
159
ide/fpusrscr.pas
159
ide/fpusrscr.pas
@ -81,6 +81,11 @@ type
|
|||||||
VIDEBuffer : PByteArray;
|
VIDEBuffer : PByteArray;
|
||||||
IDEVideoInfo : TDOSVideoInfo;
|
IDEVideoInfo : TDOSVideoInfo;
|
||||||
ctrl_c_state : boolean;
|
ctrl_c_state : boolean;
|
||||||
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
|
GraphImageSize : longint;
|
||||||
|
GraphBuffer : pointer;
|
||||||
|
ConsoleGraphDriver, ConsoleGraphMode : word;
|
||||||
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
function GetLineStartOfs(Line: integer): word;
|
function GetLineStartOfs(Line: integer): word;
|
||||||
procedure GetBuffer(Size: word);
|
procedure GetBuffer(Size: word);
|
||||||
procedure FreeBuffer;
|
procedure FreeBuffer;
|
||||||
@ -161,9 +166,9 @@ uses
|
|||||||
{$ifdef fvision}
|
{$ifdef fvision}
|
||||||
,Drivers
|
,Drivers
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef VESA}
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
,VESA
|
,Graph,VESA
|
||||||
{$endif}
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
;
|
;
|
||||||
|
|
||||||
function TScreen.GetWidth: integer;
|
function TScreen.GetWidth: integer;
|
||||||
@ -314,38 +319,146 @@ end;
|
|||||||
procedure TDosScreen.SaveConsoleScreen;
|
procedure TDosScreen.SaveConsoleScreen;
|
||||||
var
|
var
|
||||||
VSeg,SOfs: word;
|
VSeg,SOfs: word;
|
||||||
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
|
saved : boolean;
|
||||||
|
GraphDriver,GraphMode : integer;
|
||||||
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
GetVideoMode(ConsoleVideoInfo);
|
GetVideoMode(ConsoleVideoInfo);
|
||||||
GetBuffer(ConsoleVideoInfo.ScreenSize);
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
if ConsoleVideoInfo.Mode=7 then
|
saved:=false;
|
||||||
VSeg:=SegB000
|
if assigned(GraphBuffer) then
|
||||||
else
|
begin
|
||||||
VSeg:=SegB800;
|
FreeMem(GraphBuffer,GraphImageSize);
|
||||||
SOfs:=MemW[Seg0040:$4e];
|
GraphBuffer:=nil;
|
||||||
|
GraphImageSize:=0;
|
||||||
|
end;
|
||||||
|
if (ConsoleVideoInfo.Mode>= $100) or
|
||||||
|
(ConsoleVideoInfo.Mode=$13) or
|
||||||
|
(ConsoleVideoInfo.Mode=$12) or
|
||||||
|
(ConsoleVideoInfo.Mode=$10) or
|
||||||
|
(ConsoleVideoInfo.Mode=$E) then
|
||||||
|
begin
|
||||||
|
if VesaSetMode(ConsoleVideoInfo.Mode or $8000) then
|
||||||
|
begin
|
||||||
|
Graph.DontClearVesaMemory:=true;
|
||||||
|
if ConsoleVideoInfo.Mode>=$100 then
|
||||||
|
begin
|
||||||
|
GraphDriver:=Graph.Vesa;
|
||||||
|
GraphMode:=ConsoleVideoInfo.Mode and $fff;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
GraphDriver:=Graph.VGA;
|
||||||
|
case ConsoleVideoInfo.Mode of
|
||||||
|
$E : GraphMode:=VGALo;
|
||||||
|
$10 : GraphMode:=VGAMed;
|
||||||
|
$12 : GraphMode:=VGAHi;
|
||||||
|
$13 : begin
|
||||||
|
GraphDriver:=Graph.LowRes;
|
||||||
|
GraphMode:=0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Graph.InitGraph(GraphDriver,GraphMode,'');
|
||||||
|
if graphresult=grOk then
|
||||||
|
begin
|
||||||
|
ConsoleGraphDriver:=GraphDriver;
|
||||||
|
ConsoleGraphMode:=GraphMode;
|
||||||
|
Graph.DontClearVesaMemory:=false;
|
||||||
|
GraphImageSize:=ImageSize(0,0,Graph.GetmaxX,Graph.GetMaxY);
|
||||||
|
GetMem(GraphBuffer,GraphImageSize);
|
||||||
|
FillChar(GraphBuffer^,GraphImageSize,#0);
|
||||||
|
GetImage(0,0,Graph.GetmaxX,Graph.GetMaxY,GraphBuffer^);
|
||||||
|
saved:=true;
|
||||||
|
end
|
||||||
|
{$ifdef DEBUG}
|
||||||
|
else
|
||||||
|
Writeln(stderr,'Error in InitGraph ',Graphdriver, ' ',Graphmode)
|
||||||
|
{$endif DEBUG}
|
||||||
|
;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{ mode < $100 so use standard Save code }
|
||||||
|
if not saved then
|
||||||
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
|
begin
|
||||||
|
GetBuffer(ConsoleVideoInfo.ScreenSize);
|
||||||
|
if ConsoleVideoInfo.Mode=7 then
|
||||||
|
VSeg:=SegB000
|
||||||
|
else
|
||||||
|
VSeg:=SegB800;
|
||||||
|
SOfs:=MemW[Seg0040:$4e];
|
||||||
{$ifdef FPC}
|
{$ifdef FPC}
|
||||||
DosmemGet(VSeg,SOfs,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
DosmemGet(VSeg,SOfs,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
||||||
{$else}
|
{$else}
|
||||||
Move(ptr(VSeg,SOfs)^,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
Move(ptr(VSeg,SOfs)^,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDOSScreen.SwitchToConsoleScreen;
|
procedure TDOSScreen.SwitchToConsoleScreen;
|
||||||
var
|
var
|
||||||
VSeg,SOfs: word;
|
VSeg,SOfs: word;
|
||||||
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
|
restored : boolean;
|
||||||
|
GraphDriver,GraphMode : integer;
|
||||||
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
begin
|
begin
|
||||||
SetVideoMode(ConsoleVideoInfo);
|
SetVideoMode(ConsoleVideoInfo);
|
||||||
|
{$ifdef TEST_GRAPH_SWITCH}
|
||||||
if ConsoleVideoInfo.Mode=7 then
|
restored:=false;
|
||||||
VSeg:=SegB000
|
if assigned(GraphBuffer) then
|
||||||
else
|
begin
|
||||||
VSeg:=SegB800;
|
if VesaSetMode(ConsoleVideoInfo.Mode) then
|
||||||
SOfs:=MemW[Seg0040:$4e];
|
begin
|
||||||
|
if ConsoleVideoInfo.Mode>=$100 then
|
||||||
|
begin
|
||||||
|
GraphDriver:=Graph.Vesa;
|
||||||
|
GraphMode:=ConsoleVideoInfo.Mode and $fff;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
GraphDriver:=Graph.VGA;
|
||||||
|
case ConsoleVideoInfo.Mode of
|
||||||
|
$E : GraphMode:=VGALo;
|
||||||
|
$10 : GraphMode:=VGAMed;
|
||||||
|
$12 : GraphMode:=VGAHi;
|
||||||
|
$13 : begin
|
||||||
|
GraphDriver:=Graph.LowRes;
|
||||||
|
GraphMode:=0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if (ConsoleGraphDriver<>GraphDriver) or
|
||||||
|
(ConsoleGraphMode<>GraphMode) then
|
||||||
|
Graph.InitGraph(GraphDriver,GraphMode,'');
|
||||||
|
if graphresult=grOk then
|
||||||
|
begin
|
||||||
|
PutImage(0,0,GraphBuffer^,CopyPut);
|
||||||
|
FreeMem(GraphBuffer,GraphImageSize);
|
||||||
|
GraphBuffer:=nil;
|
||||||
|
GraphImageSize:=0;
|
||||||
|
restored:=true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{ mode < $100 so use standard Save code }
|
||||||
|
if not restored then
|
||||||
|
{$endif TEST_GRAPH_SWITCH}
|
||||||
|
begin
|
||||||
|
if ConsoleVideoInfo.Mode=7 then
|
||||||
|
VSeg:=SegB000
|
||||||
|
else
|
||||||
|
VSeg:=SegB800;
|
||||||
|
SOfs:=MemW[Seg0040:$4e];
|
||||||
{$ifdef FPC}
|
{$ifdef FPC}
|
||||||
DosmemPut(VSeg,SOfs,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
DosmemPut(VSeg,SOfs,VBuffer^,ConsoleVideoInfo.ScreenSize);
|
||||||
djgpp_set_ctrl_c(Ctrl_c_state);
|
djgpp_set_ctrl_c(Ctrl_c_state);
|
||||||
{$else}
|
{$else}
|
||||||
Move(VBuffer^,ptr(VSeg,SOfs)^,ConsoleVideoInfo.ScreenSize);
|
Move(VBuffer^,ptr(VSeg,SOfs)^,ConsoleVideoInfo.ScreenSize);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -411,6 +524,7 @@ begin
|
|||||||
MI.Cols:=r.ah;
|
MI.Cols:=r.ah;
|
||||||
{$ifdef VESA}
|
{$ifdef VESA}
|
||||||
VESAGetMode(MI.Mode);
|
VESAGetMode(MI.Mode);
|
||||||
|
MI.Mode:=MI.Mode and $fff;
|
||||||
{$endif}
|
{$endif}
|
||||||
MI.Rows:=MI.ScreenSize div (MI.Cols*2);
|
MI.Rows:=MI.ScreenSize div (MI.Cols*2);
|
||||||
if MI.Rows=51 then MI.Rows:=50;
|
if MI.Rows=51 then MI.Rows:=50;
|
||||||
@ -986,7 +1100,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.13 2002-06-13 11:18:32 pierre
|
Revision 1.14 2002-09-02 09:29:55 pierre
|
||||||
|
+ new test code for go32v2 graphic screen saves (only with -dDEBUG)
|
||||||
|
|
||||||
|
Revision 1.13 2002/06/13 11:18:32 pierre
|
||||||
+ xterm window switching support
|
+ xterm window switching support
|
||||||
|
|
||||||
Revision 1.12 2002/06/07 14:10:24 pierre
|
Revision 1.12 2002/06/07 14:10:24 pierre
|
||||||
|
|||||||
@ -33,6 +33,9 @@
|
|||||||
{$define HasSignal}
|
{$define HasSignal}
|
||||||
{$define FSCaseInsensitive}
|
{$define FSCaseInsensitive}
|
||||||
{$define HasSysMsgUnit}
|
{$define HasSysMsgUnit}
|
||||||
|
{$ifdef DEBUG}
|
||||||
|
{$define TEST_GRAPH_SWITCH}
|
||||||
|
{$endif DEBUG}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef Linux}
|
{$ifdef Linux}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user