Browse Source

* The terminal will now be set to raw mode directly on initialization,
as the svgalib switches the terminal immediately after startup, and
not after a switch to graphics mode!
* Fixed a problem which occured after Florian's last patch: MaxX and MaxY
are smaller by 1 now, which lead to a wrong scanline width calculation
for the optimized routines for 16 colour modes.

sg 25 years ago
parent
commit
7953a75574
1 changed files with 14 additions and 5 deletions
  1. 14 5
      rtl/linux/graph.pp

+ 14 - 5
rtl/linux/graph.pp

@@ -315,7 +315,7 @@ begin
   nrColors:=vga_getcolors;
   nrColors:=vga_getcolors;
   if (nrColors=16) or (nrcolors=256) then
   if (nrColors=16) or (nrcolors=256) then
     InitColors;
     InitColors;
-  SetRawMode(True);
+  
 end;
 end;
 
 
 Function ClipCoords (Var X,Y : Integer) : Boolean;
 Function ClipCoords (Var X,Y : Integer) : Boolean;
@@ -497,7 +497,6 @@ end;
         _graphresult := grnoinitgraph;
         _graphresult := grnoinitgraph;
         exit
         exit
       end;
       end;
-    SetRawMode(False);
     RestoreVideoState;
     RestoreVideoState;
     isgraphmode := false;
     isgraphmode := false;
  end;
  end;
@@ -542,10 +541,11 @@ end;
            PaletteSize := MaxColor;
            PaletteSize := MaxColor;
            HardwarePages := 0;
            HardwarePages := 0;
            // necessary hooks ...
            // necessary hooks ...
-           if (MaxColor = 16) and (LongInt(MaxX) * LongInt(MaxY) < 65536*4*2) then
+           if (MaxColor = 16) and
+	     (LongInt(ModeInfo.Width) * LongInt(ModeInfo.Height) < 65536*4*2) then
            begin
            begin
              // Use optimized graphics routines for 4 bit EGA/VGA modes
              // Use optimized graphics routines for 4 bit EGA/VGA modes
-             ScrWidth := MaxX div 8;
+             ScrWidth := ModeInfo.Width div 8;
              DirectPutPixel := @DirectPutPixel16;
              DirectPutPixel := @DirectPutPixel16;
              PutPixel := @PutPixel16;
              PutPixel := @PutPixel16;
              GetPixel := @GetPixel16;
              GetPixel := @GetPixel16;
@@ -586,10 +586,19 @@ end;
 
 
 begin
 begin
   InitializeGraph;
   InitializeGraph;
+  SetRawMode(True);
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2000-04-13 16:01:22  sg
+  Revision 1.15  2000-04-16 21:19:19  sg
+  * The terminal will now be set to raw mode directly on initialization,
+    as the svgalib switches the terminal immediately after startup, and
+    not after a switch to graphics mode!
+  * Fixed a problem which occured after Florian's last patch: MaxX and MaxY
+    are smaller by 1 now, which lead to a wrong scanline width calculation
+    for the optimized routines for 16 colour modes.
+
+  Revision 1.14  2000/04/13 16:01:22  sg
   * The new terminal started by svgalib after a switch to graphics mode is
   * The new terminal started by svgalib after a switch to graphics mode is
     now set to raw mode, so that some functions of the CRT unit such as
     now set to raw mode, so that some functions of the CRT unit such as
     ReadKey can work correctly now.
     ReadKey can work correctly now.