Browse Source

* corrected misplacement of call to initvars in initgraph
+ some extra debugging commands (for -dlogging) in the mode functions

Jonas Maebe 26 years ago
parent
commit
db5cdd7387
2 changed files with 49 additions and 4 deletions
  1. 10 3
      rtl/inc/graph/graph.pp
  2. 39 1
      rtl/inc/graph/modes.inc

+ 10 - 3
rtl/inc/graph/graph.pp

@@ -2874,6 +2874,7 @@ end;
   procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;
     const PathToDriver:String);
   begin
+    InitVars;
     { path to the fonts (where they will be searched)...}
     bgipath:=PathToDriver;
     if bgipath[length(bgipath)]<>'\' then
@@ -2891,7 +2892,6 @@ end;
         { _GraphResult is now already set to grOK by DetectGraph }
         IntCurrentDriver := GraphDriver;
         SaveVideoState;
-        InitVars;
 { Actually set the graph mode...}
         SetGraphMode(GraphMode);
       end
@@ -2908,7 +2908,10 @@ end;
            _GraphResult := grOK;
            IntCurrentDriver := GraphDriver;
            SaveVideoState;
-           InitVars;
+{$ifdef logging}
+           If _GraphResult <> grOK then
+             LogLn('Mode setting failed after savevideostate');
+{$endif logging}
            SetGraphMode(GraphMode);
          end;
       end;
@@ -3006,7 +3009,11 @@ SetGraphBufSize
 
 {
   $Log$
-  Revision 1.42  1999-11-28 12:19:59  jonas
+  Revision 1.43  1999-11-28 16:13:55  jonas
+    * corrected misplacement of call to initvars in initgraph
+    + some extra debugging commands (for -dlogging) in the mode functions
+
+  Revision 1.42  1999/11/28 12:19:59  jonas
     * _GraphResult is now properly set to grOK by DetectGraph and
       InitGraph if there are no errors
 

+ 39 - 1
rtl/inc/graph/modes.inc

@@ -71,17 +71,30 @@
     var
      list: PModeInfo;
     begin
+{$ifdef logging}
+      LogLn('Searching for driver '+strf(reqdriver)+' and mode '+strf(reqmode));
+{$endif logging}
         searchmode := nil;
         list := ModeList;
         { go to the end of the list }
         while assigned(list) do
           begin
+{$ifdef logging}
+           Log('Found driver '+strf(list^.DriverNumber)+
+               ' and mode $'+hexstr(list^.ModeNumber,4)+'... ');
+{$endif logging}
              if (list^.DriverNumber = ReqDriver) and
                (list^.ModeNumber = ReqMode) then
                begin
+{$ifdef logging}
+                 LogLn('Accepted!');
+{$endif logging}
                  searchmode := list;
                  exit;
                end;
+{$ifdef logging}
+                 LogLn('Rejected.');
+{$endif logging}
              list:=list^.next;
           end;
     end;
@@ -173,6 +186,9 @@
       modeinfo := searchmode(IntcurrentDriver,mode);
       if not assigned(modeinfo) then
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 1');
+{$endif logging}
           _GraphResult := grInvalidMode;
           exit;
        end;
@@ -187,6 +203,9 @@
          DirectPutPixel := modeinfo^.DirectPutPixel
       else
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 2');
+{$endif logging}
          _Graphresult := grInvalidMode;
          exit;
        end;
@@ -195,6 +214,9 @@
          PutPixel := modeinfo^.PutPixel
       else
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 3');
+{$endif logging}
          _Graphresult := grInvalidMode;
          exit;
        end;
@@ -203,6 +225,9 @@
          GetPixel := modeinfo^.GetPixel
       else
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 4');
+{$endif logging}
          _Graphresult := grInvalidMode;
          exit;
        end;
@@ -211,6 +236,9 @@
          SetRGBPalette := modeinfo^.SetRGBPalette
      else
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 5');
+{$endif logging}
          _Graphresult := grInvalidMode;
          exit;
        end;
@@ -219,6 +247,9 @@
          GetRGBPalette := modeinfo^.GetRGBPalette
      else
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 6');
+{$endif logging}
          _Graphresult := grInvalidMode;
          exit;
        end;
@@ -265,6 +296,9 @@
       { check first if the routine exists        }
       if not assigned(modeinfo^.InitMode) then
         begin
+{$ifdef logging}
+          LogLn('Mode setting failed in setgraphmode pos 7');
+{$endif logging}
           _GraphResult := grInvalidMode;
           exit;
         end;
@@ -298,7 +332,11 @@
 
 {
 $Log$
-Revision 1.12  1999-09-28 13:56:31  jonas
+Revision 1.13  1999-11-28 16:13:55  jonas
+  * corrected misplacement of call to initvars in initgraph
+  + some extra debugging commands (for -dlogging) in the mode functions
+
+Revision 1.12  1999/09/28 13:56:31  jonas
   * reordered some local variables (first 4 byte vars, then 2 byte vars
     etc)
   * font data is now disposed in exitproc, exitproc is now called