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

Barth Netterfield netterfield at astro.utoronto.ca
Mon Jan 9 15:23:42 UTC 2012


SVN commit 1272762 by netterfield:

Improve drawing: sub-pixel accuracy.


 M  +5 -1      libkstapp/plotrenderitem.cpp  
 M  +1 -0      libkstapp/viewitemmanager.cpp  
 M  +3 -3      libkstmath/curve.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1272761:1272762
@@ -303,6 +303,7 @@
     QPointF point = plotItem()->mapToPlot(_referencePoint);
     painter->save();
     painter->setPen(QPen(QColor("gray"), 1));
+    painter->setRenderHint(QPainter::Antialiasing, true);
     CurvePointSymbol::draw(7, painter, point.x(), point.y(), 1);
     painter->restore();
   }
@@ -320,7 +321,10 @@
       highlightColor = QColor(255, 255, 255, 127);
     }
     painter->setBrush(highlightColor);
-    painter->drawEllipse(point.x()-3, point.y()-3, 7, 7);
+
+    painter->setRenderHint(QPainter::Antialiasing, true);
+
+    painter->drawEllipse(point, 3, 3);
     painter->restore();
   }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemmanager.cpp #1272761:1272762
@@ -59,6 +59,7 @@
   QList<ViewItem*> layoutable_view_items;
   foreach (ViewItem *item, view_items) {
     if (item && (!item->hasStaticGeometry()) &&
+        item->isVisible() &&
         item->allowsLayout() &&
         ((dynamic_cast<LayoutBoxItem*>(item->parentViewItem())!=0) || (!item->parentViewItem()))) {
       layoutable_view_items.append(item);
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1272761:1272762
@@ -849,7 +849,7 @@
 #ifdef BENCHMARK
                 ++numberOfLinesDrawn;
 #endif
-                double fX2 = floor(X2);
+                double fX2 = floor(X2)+0.5;
                 _lines.append(QLineF(fX2, minY, fX2, maxY));
               }
             }
@@ -899,7 +899,7 @@
                     ++numberOfLinesDrawn;
 #endif
                   }
-                  double fX2 = floor(X2);
+                  double fX2 = floor(X2)+0.5;
 
                   if (KDE_ISUNLIKELY(minY == maxY)) {
                     points.append(QPointF(fX2, maxY));
@@ -936,7 +936,7 @@
 #ifdef BENCHMARK
   ++numberOfLinesDrawn;
 #endif
-                    double fX2 = floor(X2);
+                    double fX2 = floor(X2)+0.5;
                     _lines.append(QLineF(fX2, minY, fX2, maxY));
                   }
                 }


More information about the Kst mailing list