Browse Source

* execute multiplications before divisions in lineclipped to avoid rounding errors

Jonas Maebe 26 years ago
parent
commit
de09b385d3
1 changed files with 8 additions and 5 deletions
  1. 8 5
      rtl/inc/graph/clip.inc

+ 8 - 5
rtl/inc/graph/clip.inc

@@ -104,25 +104,25 @@ const
              code:=code1;
              code:=code1;
             if (code and LEFT) <> 0 then
             if (code and LEFT) <> 0 then
               begin
               begin
-                newy:=y1+(y2-y1)*(xmin-x1) div (x2-x1);
+                newy:=y1+((y2-y1)*(xmin-x1)) div (x2-x1);
                 newx:=xmin;
                 newx:=xmin;
               end
               end
             else
             else
             if (code and RIGHT) <> 0 then
             if (code and RIGHT) <> 0 then
               begin
               begin
-                newy:=y1+(y2-y1)*(xmax-x1) div (x2-x1);
+                newy:=y1+((y2-y1)*(xmax-x1)) div (x2-x1);
                 newx:=xmax;
                 newx:=xmax;
               end
               end
             else
             else
             if (code and BOTTOM) <> 0 then
             if (code and BOTTOM) <> 0 then
               begin
               begin
-                newx:=x1+(x2-x1)* ((ymax-y1) div (y2-y1));
+                newx:=x1+((x2-x1)*(ymax-y1)) div (y2-y1);
                 newy:=ymax;
                 newy:=ymax;
               end
               end
             else
             else
             if (code and TOP) <> 0 then
             if (code and TOP) <> 0 then
               begin
               begin
-                newx:=x1+(x2-x1)*(ymin-y1) div (y2-y1);
+                newx:=x1+((x2-x1)*(ymin-y1)) div (y2-y1);
                 newy:=ymin;
                 newy:=ymin;
               end;
               end;
            if (code1 = code) then
            if (code1 = code) then
@@ -142,7 +142,10 @@ end;
 
 
 {
 {
 $Log$
 $Log$
-Revision 1.5  1999-09-18 22:21:09  jonas
+Revision 1.6  1999-09-27 12:35:27  jonas
+  * execute multiplications before divisions in lineclipped to avoid rounding errors
+
+Revision 1.5  1999/09/18 22:21:09  jonas
   + hlinevesa256 and vlinevesa256
   + hlinevesa256 and vlinevesa256
   + support for not/xor/or/andput in vesamodes with 32k/64k colors
   + support for not/xor/or/andput in vesamodes with 32k/64k colors
   * lots of changes to avoid warnings under FPC
   * lots of changes to avoid warnings under FPC