[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Aug 4 23:17:14 CEST 2004


CVS commit by arwalker: 

In the drawing function keep everything in double precision as long as possible.

If this is not done then zooming in to a very small region in x, relative to the seperation in points, causes no line to be drawn when it should be. This results from double values getting incorrectly cast to integer values as the double value is too large in absolute value to be represented by an integer.


  M +1 -8      kst2dplot.cpp   1.199


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.198:1.199
@@ -1252,5 +1252,4 @@ void Kst2DPlot::draw(QPainter &p, KstPai
   double last_x1, last_y1;
   double X2, Y2;
-  int X2i, last_x1i = 0;
   double maxY = 0, minY = 0;
   int penWidth;
@@ -1618,10 +1615,8 @@ void Kst2DPlot::draw(QPainter &p, KstPai
 
         last_x1 = X1;
-        last_x1i = (int)X1;
         last_y1 = Y1;
 
         for (i_pt = i0 + 1; i_pt <= iN; i_pt++) {
           X2 = last_x1;
-          X2i = last_x1i;
           Y2 = last_y1;
 
@@ -1651,5 +1645,4 @@ void Kst2DPlot::draw(QPainter &p, KstPai
 
           last_x1 = X1;
-          last_x1i = (int)X1;
           last_y1 = Y1;
           if (nopoint) {
@@ -1668,5 +1661,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
               overlap = false;
             }
-          } else if (last_x1i == X2i) {
+          } else if (floor(last_x1) == floor(X2)) {
             if (overlap) {
               if (Y1 > maxY) {





More information about the Kst mailing list