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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jan 13 17:52:04 CET 2010


SVN commit 1074208 by netterfield:

Fix a couple plot symbol rendering problems.

There will be more work here once the new font size system is in place.



 M  +3 -1      libkstapp/plotitem.cpp  
 M  +1 -0      libkstmath/curve.cpp  
 M  +21 -16    libkstmath/curvepointsymbol.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1074207:1074208
@@ -822,7 +822,9 @@
   QPixmap pixmap(rect().width()+1, rect().height()+1);
   pixmap.fill(Qt::transparent);
   QPainter pixmapPainter(&pixmap);
-  
+
+  //pixmapPainter.setRenderHint(QPainter::Antialiasing);
+
   pixmapPainter.save();
   if (rect().topLeft() != QPointF(0, 0)) {
     pixmapPainter.translate(-rect().topLeft());
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1074207:1074208
@@ -646,6 +646,7 @@
   QPainter *p = context.painter;
   p->save();
 
+  //p->setRenderHint(QPainter::Antialiasing);
   Qt::PenStyle style = Kst::LineStyle[lineStyle()];
 
   if (hasBars()) {
--- branches/work/kst/portto4/kst/src/libkstmath/curvepointsymbol.cpp #1074207:1074208
@@ -46,21 +46,22 @@
       break;
     case 1:
       p->setBrush(Qt::NoBrush);
-      p->drawRect(QRectF(x-s, y-s, 2*s+1, 2*s+1));
+      p->drawRect(QRectF(x-s, y-s, 2*s, 2*s));
       break;
     case 2:
       p->setBrush(Qt::NoBrush);
-      p->drawEllipse(x-s, y-s, 2*s+1, 2*s+1);
+      p->drawEllipse(x-s, y-s, 2*s, 2*s);
       break;
     case 3:
       p->setBrush(Qt::SolidPattern);
-      p->drawEllipse(x-s, y-s, 2*s+1, 2*s+1);
+      p->setBrush(p->pen().color());
+      p->drawEllipse(x-s, y-s, 2*s, 2*s);
       break;
     case 4:
       {
-        QPolygon pts(3);
+        QPolygonF pts;
 
-        pts.putPoints( 0, 3, x-s, y-s, x, y+s, x+s, y-s );
+        pts << QPointF(x-s, y-s) << QPointF(x, y+s) << QPointF(x+s, y-s);
         p->setBrush(Qt::NoBrush);
         p->drawPolygon(pts);
       }
@@ -69,13 +70,14 @@
       {
         QPolygon pts(3);
 
-        pts.putPoints( 0, 3, x-s, y+s, x, y-s, x+s, y+s );
+        pts.putPoints( 0, 3, int(x-s), int(y+s), int(x), int(y-s), int(x+s), int(y+s) );
         p->setBrush(Qt::NoBrush);
         p->drawPolygon(pts);
       }
       break;
     case 6:
       p->setBrush(Qt::SolidPattern);
+      p->setBrush(p->pen().color());
       p->drawRect(QRectF(x-s, y-s, 2*s+1, 2*s+1));
       break;
     case 7:
@@ -92,8 +94,9 @@
       {
         QPolygon pts(3);
 
-        pts.putPoints( 0, 3, x-s, y-s, x, y+s, x+s, y-s );
+        pts.putPoints( 0, 3, int(x-s), int(y-s), int(x), int(y+s), int(x+s), int(y-s) );
         p->setBrush(Qt::SolidPattern);
+        p->setBrush(p->pen().color());
         p->drawPolygon(pts);
       }
       break;
@@ -101,8 +104,9 @@
       {
         QPolygon pts(3);
 
-        pts.putPoints( 0, 3, x-s, y+s, x, y-s, x+s, y+s );
+        pts.putPoints( 0, 3, int(x-s), int(y+s), int(x), int(y-s), int(x+s), int(y+s) );
         p->setBrush(Qt::SolidPattern);
+        p->setBrush(p->pen().color());
         p->drawPolygon(pts);
       }
       break;
@@ -110,10 +114,10 @@
       {
         QPolygon pts(4);
 
-        pts.putPoints( 0, 4,   x+s, y,
-                               x, y+s,
-                               x-s, y,
-                               x, y-s );
+        pts.putPoints( 0, 4,   int(x+s), int(y),
+                               int(x), int(y+s),
+                               int(x-s), int(y),
+                               int(x), int(y-s) );
         p->setBrush(Qt::NoBrush);
         p->drawPolygon(pts);
       }
@@ -122,11 +126,12 @@
       {    
         QPolygon pts(4);
 
-        pts.putPoints( 0, 4,   x+s, y,
-                               x, y+s,
-                               x-s, y,
-                               x, y-s );
+        pts.putPoints( 0, 4,   int(x+s), int(y),
+                               int(x), int(y+s),
+                               int(x-s), int(y),
+                               int(x), int(y-s) );
         p->setBrush(Qt::SolidPattern);
+        p->setBrush(p->pen().color());
         p->drawPolygon(pts);
       }
       break;


More information about the Kst mailing list