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

  • Participants
  • Parent commits 632f1fb

Comments (0)

Files changed (1)

File tortoisehg/hgqt/

         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)
         painter = QPainter(pix)
+            painter.scale(k, k)
             self._drawgraphctx(painter, ctx, gnode)
-        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