[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Mar 4 00:28:32 CET 2005


CVS commit by arwalker: 

Better handle drawing of histogram lines when the width is greater than 0.


  M +15 -15    kst2dplot.cpp   1.364


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.363:1.364
@@ -5194,4 +5194,5 @@ void Kst2DPlot::plotCurves(QPainter& p,
       Qt::PenStyle style = KstLineStyle[c->lineStyle()];
       int i0, iN;
+      int width = c->lineWidth() < penWidth ? penWidth : c->lineWidth();
 
       if (c->xIsRising()) {
@@ -5221,6 +5222,6 @@ void Kst2DPlot::plotCurves(QPainter& p,
         int i0Start = i0;
 
-        lineWidth = (double)(c->lineWidth() < penWidth ? penWidth : c->lineWidth());
-        p.setPen(QPen(c->color(), int(lineWidth), style));
+        lineWidth = (double)width;
+        p.setPen(QPen(c->color(), width, style));
 
 // Optimize - isnan seems expensive, at least in gcc debug mode
@@ -5477,6 +5478,4 @@ void Kst2DPlot::plotCurves(QPainter& p,
       clock_t linesEnd = clock();
       kdDebug() << "        Lines clocks: " << (linesEnd - linesStart) << endl;
-#endif
-#ifdef BENCHMARK
     b_1 = benchtmp.elapsed();
 #endif
@@ -5493,7 +5492,7 @@ void Kst2DPlot::plotCurves(QPainter& p,
 
         if (c->barStyle() == 1) { // filled
-          p.setPen(QPen(_foregroundColor, (c->lineWidth() < penWidth ? penWidth : c->lineWidth()), style));
+          p.setPen(QPen(_foregroundColor, width, style));
         } else {
-          p.setPen(QPen(c->color(), (c->lineWidth() < penWidth ? penWidth : c->lineWidth()), style));
+          p.setPen(QPen(c->color(), width, style));
         }
 
@@ -5576,14 +5575,14 @@ void Kst2DPlot::plotCurves(QPainter& p,
             }
             if (has_top) {
-              p.drawLine(d2i(X1), d2i(Y1), d2i(X2), d2i(Y1));
+              p.drawLine(d2i(X1-(width/2)), d2i(Y1), d2i(X2+(width/2)), d2i(Y1));
             }
             if (has_bot) {
-              p.drawLine(d2i(X1), d2i(Y2), d2i(X2), d2i(Y2));
+              p.drawLine(d2i(X1-(width/2)), d2i(Y2), d2i(X2-(width/2)), d2i(Y2));
             }
             if (has_left) {
-              p.drawLine(d2i(X1), d2i(Y1), d2i(X1), d2i(Y2));
+              p.drawLine(d2i(X1), d2i(Y1-(width/2)), d2i(X1), d2i(Y2+(width/2)));
             }
             if (has_right) {
-              p.drawLine(d2i(X2), d2i(Y1), d2i(X2), d2i(Y2));
+              p.drawLine(d2i(X2), d2i(Y1-(width/2)), d2i(X2), d2i(Y2+(width/2)));
             }
           }
@@ -5594,5 +5594,5 @@ void Kst2DPlot::plotCurves(QPainter& p,
 #endif
 
-      p.setPen(QPen(c->color(), (c->lineWidth() < penWidth ? penWidth : c->lineWidth())));
+      p.setPen(QPen(c->color(), width));
 
       // draw the points, if any...
@@ -6075,5 +6075,5 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
 void Kst2DPlot::plotLabels(QPainter &p, int x_px, int y_px, double xleft_bdr_px, double ytop_bdr_px) {
   XLabel->setResized();
-  XLabel->draw(p, x_px/2, y_px /*-2*XLabel->ascent(p)/3*/);
+  XLabel->draw(p, x_px/2, y_px);
 
   YLabel->setResized();




More information about the Kst mailing list