[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Tue Nov 22 00:36:26 UTC 2011


SVN commit 1265327 by netterfield:

BUG:
Make drawing of the tick marks and drawing of the curves exactly consistant.
(they were previously off by up to +-1 pixel).



 M  +1 -6      devel-docs/Kst2Specs/Bugs  
 M  +2 -2      src/libkstapp/cartesianrenderitem.cpp  
 M  +3 -1      src/libkstapp/plotitem.cpp  
 M  +1 -0      src/libkstmath/curve.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1265326:1265327
@@ -6,10 +6,5 @@
 
 --------------------
 
-Curves are rendered slightly above where they should be.  Take a plot
-that it is of very boring data (like always exactly zero) and it'll be
-drawn one pixel above the axis tick mark for zero.  (This is not always the same - sometimes above, sometimes below, sometimes right.)
-So: it appears that ticks and curves use different rounding
+points don't always appear centered on the line.
 
-Probably related bug: points don't always appear centered on the line.
-
--- branches/work/kst/portto4/kst/src/libkstapp/cartesianrenderitem.cpp #1265326:1265327
@@ -71,8 +71,8 @@
     context.Hy = plotRect().bottom();
 
     //To convert between the last two...
-    double m_X = double(plotRect().width()-1)/(context.x_max - context.x_min);
-    double m_Y = -double(plotRect().height()-1)/(context.y_max - context.y_min);
+    double m_X = double(plotRect().width())/(context.x_max - context.x_min);
+    double m_Y = -double(plotRect().height())/(context.y_max - context.y_min);
     double b_X = context.Lx - m_X * context.x_min;
     double b_Y = context.Ly - m_Y * context.y_max;
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1265326:1265327
@@ -1003,7 +1003,9 @@
   painter->save();
   painter->setBrush(Qt::NoBrush);
   painter->setPen(pen());
-  painter->drawRect(plotRect());
+  QRectF box(plotRect());
+  box.adjust(-1.0, -1.0, 0.0, 0.0);
+  painter->drawRect(box);
 #if BENCHMARK > 1
     b_3 = benchtmp.elapsed();
 #endif
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1265326:1265327
@@ -1092,6 +1092,7 @@
         overlap = false;
       }
     } // end if hasLines()
+
 #ifdef BENCHMARK
     clock_t linesEnd = clock();
     std::cout << "\n        Lines clocks: " << (linesEnd - linesStart) << "\n";


More information about the Kst mailing list