Commits

Yuya Nishihara committed cd0b7fe Draft

graph: scale after all edges and nodes are painted without antialiasing

If antialiasing is enabled, edges can have alpha value. So overlapped
edges and contact points will be slightly bolder than the others.

We could remove overlapped edges instead of scaling, but still it's hard
to remove overlapped part near contact points:

| |
|/
| <-- upper half will be doubled even if overlapped edges are removed

Comments (0)

Files changed (1)

tortoisehg/hgqt/repomodel.py

         w = self.col2x(gnode.cols)
         h = self.rowheight
 
-        pix = QPixmap(w, h)
+        # smooth scaling in place of antialiasing.  if antialiasing is enabled,
+        # overlapped edges and contacts can be bolder due to alpha blending.
+        k = 8
+        pix = QPixmap(k * w, k * h)
         pix.fill(QColor(0,0,0,0))
         painter = QPainter(pix)
         try:
+            painter.scale(k, k)
             self._drawgraphctx(painter, ctx, gnode)
         finally:
             painter.end()
-        return QVariant(pix)
+        return QVariant(pix.scaledToHeight(h, Qt.SmoothTransformation))
 
     def _drawgraphctx(self, painter, ctx, gnode):
         revset = self.revset
         h = self.rowheight
         dot_y = h / 2
 
-        painter.setRenderHint(QPainter.Antialiasing)
-
         if revset:
             def isactive(e):
                 return e.startrev in revset and e.endrev in revset