[Kst] extragear/graphics/kst/src

George Staikos staikos at kde.org
Mon Mar 20 02:50:19 CET 2006


SVN commit 520474 by staikos:

1) use KstPainter
2) use KstPainter
3) make legends symbols the right size (using KstPainter)
BUG: 123739


 M  +4 -2      libkstapp/kstviewlegend.cpp  
 M  +2 -2      libkstapp/kstviewlegend.h  
 M  +1 -1      libkstmath/kstbasecurve.h  
 M  +1 -1      libkstmath/kstimage.cpp  
 M  +1 -1      libkstmath/kstimage.h  
 M  +3 -3      libkstmath/kstvcurve.cpp  
 M  +2 -1      libkstmath/kstvcurve.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.cpp #520473:520474
@@ -177,15 +177,17 @@
 
   _backBuffer.buffer().resize(contentsRect().size());
   _backBuffer.buffer().fill(backgroundColor());
-  QPainter p(&_backBuffer.buffer());
+  KstPainter p;
+  p.begin(&_backBuffer.buffer());
   QPen pen;
   pen.setColor(foregroundColor());
   p.setPen(pen);
   drawToPainter(p);
+  p.end();
 }
 
 
-void KstViewLegend::drawToPainter(QPainter& p) {
+void KstViewLegend::drawToPainter(KstPainter& p) {
   RenderContext rc(_fontName, _absFontSize, &p);
 
   if (_vertical) {
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewlegend.h #520473:520474
@@ -100,8 +100,8 @@
 
   private:
     void drawToBuffer();
-    void drawToPainter(QPainter& p);
-    void tmpDrawToPainter(QPainter& p);
+    void drawToPainter(KstPainter& p);
+    void tmpDrawToPainter(KstPainter& p);
     void computeTextSize();
 
     double _rotation;
--- trunk/extragear/graphics/kst/src/libkstmath/kstbasecurve.h #520473:520474
@@ -98,7 +98,7 @@
     virtual void paint(const KstCurveRenderContext& context) = 0;
     
     // render the legend symbol for this curve
-    virtual void paintLegendSymbol(QPainter *p, const QRect& bound) = 0;
+    virtual void paintLegendSymbol(KstPainter *p, const QRect& bound) = 0;
     
 
     // just store the size of the legend tag here.  The viewLegend actually uses and calculates it.
--- trunk/extragear/graphics/kst/src/libkstmath/kstimage.cpp #520473:520474
@@ -796,7 +796,7 @@
 }
 
 
-void KstImage::paintLegendSymbol(QPainter *p, const QRect& bound) {
+void KstImage::paintLegendSymbol(KstPainter *p, const QRect& bound) {
   if (hasColorMap() && _pal) {
     int l = bound.left(), r = bound.right(), t = bound.top(), b = bound.bottom();
     // draw the color palette
--- trunk/extragear/graphics/kst/src/libkstmath/kstimage.h #520473:520474
@@ -114,7 +114,7 @@
     virtual void yRange(double xFrom, double xTo, double* yMin, double* yMax);
     
     // see KstBaseCurve::paintLegendSymbol
-    virtual void paintLegendSymbol(QPainter *p, const QRect& bound);
+    virtual void paintLegendSymbol(KstPainter *p, const QRect& bound);
 
   private:
     //use these to set defaults when either is not used.
--- trunk/extragear/graphics/kst/src/libkstmath/kstvcurve.cpp #520473:520474
@@ -1619,17 +1619,17 @@
   return fabs(ypos - near_y);
 }
 
-void KstVCurve::paintLegendSymbol(QPainter *p, const QRect& bound) {
+void KstVCurve::paintLegendSymbol(KstPainter *p, const QRect& bound) {
   p->save();
   if (hasLines()) {
     // draw a line from left to right centered vertically
-    p->setPen(QPen(color(), lineWidth(), KstLineStyle[lineStyle()]));
+    p->setPen(QPen(color(), lineWidth() * p->lineWidthAdjustmentFactor(), KstLineStyle[lineStyle()]));
     p->drawLine(bound.left(), bound.top() + bound.height()/2,
                 bound.right(), bound.top() + bound.height()/2);
   }
   if (hasPoints()) {
     // draw a point in the middle
-    p->setPen(QPen(color(), lineWidth()));
+    p->setPen(QPen(color(), lineWidth() * p->lineWidthAdjustmentFactor()));
     KstPoint tmppoint;
     tmppoint.setType(Point.type());
     tmppoint.draw(p, bound.left() + bound.width()/2, bound.top() + bound.height()/2, lineWidth(), 600);
--- trunk/extragear/graphics/kst/src/libkstmath/kstvcurve.h #520473:520474
@@ -19,6 +19,7 @@
 #define KSTVCURVE_H
 
 #include "kstbasecurve.h"
+#include "kstpainter.h"
 #include "kstpoint.h"
 #include "kst_export.h"
 
@@ -140,7 +141,7 @@
     virtual void paint(const KstCurveRenderContext& context);
     
     // render the legend symbol for this curve
-    virtual void paintLegendSymbol(QPainter *p, const QRect& bound);
+    virtual void paintLegendSymbol(KstPainter *p, const QRect& bound);
     
     // see KstBaseCurve::distanceToPoint
     virtual double distanceToPoint(double xpos, double dx, double ypos) const;


More information about the Kst mailing list