Browse Source

* floodfill got into an infinite loop !!
+ added partial support for fillpoly
(still wrong if the polygon is not convex)
Simply make a floodfill from the barycenter !
* some 24BPP code changed (still does not work for my S3VBE program !)

pierre 27 years ago
parent
commit
f00187e462
4 changed files with 55 additions and 15 deletions
  1. 28 5
      rtl/dos/ppi/fill.ppi
  2. 10 4
      rtl/dos/ppi/line.ppi
  3. 8 4
      rtl/dos/ppi/pixel.ppi
  4. 9 2
      rtl/dos/ppi/vesadeb.ppi

+ 28 - 5
rtl/dos/ppi/fill.ppi

@@ -26,14 +26,14 @@ var start,ende,xx : integer;
 begin  
   xx:=x; col:=getpixel(xx,y);
   if col=bordercol then exit;
-  while (col<>bordercol) and (xx > viewport.x1) and (col<>fillcol)
+  while (col<>bordercol) and (xx >= viewport.x1) and (col<>fillcol)
     do begin
       xx:=xx-1; col:=getpixel(xx,y);
     end;
   start:=xx+1; 
 
   xx:=x+1; col:=getpixel(xx,y);
-  while (col<>bordercol) and (xx < viewport.x2) and (col<>fillcol)
+  while (col<>bordercol) and (xx <= viewport.x2) and (col<>fillcol)
     do begin
       xx:=xx+1; col:=getpixel(xx,y);
     end;
@@ -56,8 +56,8 @@ begin
     until xx > ende;
   end;
 
-  if (y > viewport.y1) 
-  then begin
+  if (y >= viewport.y1) and (y<viewport.y2) then
+   begin
     xx:=start;
     repeat
       col:=getpixel(xx,y+1);
@@ -177,15 +177,38 @@ end;
 
 { just dummy not implemented yet }
 procedure FillPoly(points : word;var polypoints);
+{$R-}
+ type PointTypeArray = Array[0..0] of PointType;
+ var xm,ym : longint;
+     i : word;
 begin
    { simply call drawpoly instead (PM) }
    DrawPoly(points,polypoints);
+   { assume the poly is convex so the barcenter is inside PM }
+   { this can be completely wrong !! }
+   xm:=0;
+   ym:=0;
+   For i:=0 to points-1 do
+     begin
+        xm:=xm+PointTypeArray(polypoints)[i].x;
+        ym:=ym+PointTypeArray(polypoints)[i].y;
+     end;
+   xm:=xm div points;
+   ym:=ym div points;
+   floodfill(xm,ym,truecolor);
 end;
 
 
 {
   $Log$
-  Revision 1.2  1998-11-18 09:31:33  pierre
+  Revision 1.3  1998-11-18 13:23:34  pierre
+    * floodfill got into an infinite loop !!
+    + added partial support for fillpoly
+      (still wrong if the polygon is not convex)
+      Simply make a floodfill from the barycenter !
+    * some 24BPP code changed (still does not work for my S3VBE program !)
+
+  Revision 1.2  1998/11/18 09:31:33  pierre
     * changed color scheme
       all colors are in RGB format if more than 256 colors
     + added 24 and 32 bits per pixel mode

+ 10 - 4
rtl/dos/ppi/line.ppi

@@ -58,9 +58,9 @@ begin
  .Lpl_movd32BPP:
     andl   $7,%ebx
     movl   (%esi,%ebx,4),%eax
-    andl   $0x00FFFFFF,%eax
     movl   %eax,%es:(%edi)
     addl   $4,%edi
+    { should not be necessary !! }
     cmpl   _WINLOMASKMINUSPIXELSIZE,%edi
     ja     .Lpl_d_exit
     incl   %ebx
@@ -117,7 +117,6 @@ begin
  .Lpl_xord32BPP:
     andl   $7,%ebx
     movl   (%esi,%ebx,4),%eax
-    andl   $0x00FFFFFF,%eax
     movl   %es:(%edi),%edx
     xorl   %edx,%eax
     movl   %eax,%es:(%edi)
@@ -382,7 +381,7 @@ begin
 dontcheck:=(y1>=viewport.y1) and (y2<=viewport.y2) and 
            (x1>=viewport.x1) and (x1<=viewport.x2) and
            (x2>=viewport.x1) and (x2<=viewport.x2) and
-           (BytesPerPixel<=2);
+           (BytesPerPixel<3);
 
 if aktlineinfo.thickness=3 then 
 
@@ -653,7 +652,14 @@ end;
 
 {
   $Log$
-  Revision 1.3  1998-11-18 09:31:37  pierre
+  Revision 1.4  1998-11-18 13:23:35  pierre
+    * floodfill got into an infinite loop !!
+    + added partial support for fillpoly
+      (still wrong if the polygon is not convex)
+      Simply make a floodfill from the barycenter !
+    * some 24BPP code changed (still does not work for my S3VBE program !)
+
+  Revision 1.3  1998/11/18 09:31:37  pierre
     * changed color scheme
       all colors are in RGB format if more than 256 colors
     + added 24 and 32 bits per pixel mode

+ 8 - 4
rtl/dos/ppi/pixel.ppi

@@ -135,7 +135,6 @@ procedure pixel(offset:longint);
       je     dxor24BPP
  dxor32BPP:
       movl   %gs:(%esi),%edx
-      andl   $0x00FFFFFF,%eax
       xorl   %edx,%eax
       movl   %eax,%gs:(%esi)
       jmp    pd_exit
@@ -163,7 +162,6 @@ procedure pixel(offset:longint);
       cmpl   $3,%ebx
       je     dmove24BPP
  dmove32BPP:
-      andl   $0x00FFFFFF,%eax
       movl   %eax,%gs:(%esi)
       jmp    pd_exit
  dmove24BPP:
@@ -243,7 +241,6 @@ if aktviewport.clip then viewport:=aktviewport else viewport:=aktscreen;
       je     g_24BPP
   g_32BPP:
       movl   %gs:(%esi),%eax
-      andl   $0x00FFFFFF,%eax
       jmp    g_Result
   g_24BPP:
       movl   _WINLOMASKMINUSPIXELSIZE,%edi
@@ -284,7 +281,14 @@ end; { proc }
 
 {
   $Log$
-  Revision 1.3  1998-11-18 09:31:40  pierre
+  Revision 1.4  1998-11-18 13:23:36  pierre
+    * floodfill got into an infinite loop !!
+    + added partial support for fillpoly
+      (still wrong if the polygon is not convex)
+      Simply make a floodfill from the barycenter !
+    * some 24BPP code changed (still does not work for my S3VBE program !)
+
+  Revision 1.3  1998/11/18 09:31:40  pierre
     * changed color scheme
       all colors are in RGB format if more than 256 colors
     + added 24 and 32 bits per pixel mode

+ 9 - 2
rtl/dos/ppi/vesadeb.ppi

@@ -55,7 +55,7 @@
     write('    write: ');     if (VESAInfo.WinBAttributes and 5)=5 then write('yes')else write('no ');
     writeln('   Segment:  ',HexStr(VESAInfo.segWinB,4));
     writeln('Granularity  : ',VESAInfo.WinGranularity);
-    writeln('WinSize      : ',VESAInfo.Winsize,' KByte');
+    writeln('WinSize      : ',Winsize,' KByte  WinShift : ',WinShift);
     writeln('BytesPerLine : ',BytesPerLine);
     writeln('BytesPerPixel: ',BytesPerPixel);
     if isDPMI then
@@ -74,7 +74,14 @@
  
 {
   $Log$
-  Revision 1.2  1998-11-18 09:31:43  pierre
+  Revision 1.3  1998-11-18 13:23:37  pierre
+    * floodfill got into an infinite loop !!
+    + added partial support for fillpoly
+      (still wrong if the polygon is not convex)
+      Simply make a floodfill from the barycenter !
+    * some 24BPP code changed (still does not work for my S3VBE program !)
+
+  Revision 1.2  1998/11/18 09:31:43  pierre
     * changed color scheme
       all colors are in RGB format if more than 256 colors
     + added 24 and 32 bits per pixel mode