title: How to get a smooth circle with CGContext, when scale bigger use CALayer in NSScrollView
body: <p>see the code:</p>
  
  <p>ContentView of NSScrollView:</p>
  
  <pre><code>class ContentView: NSView {
  
      var documentLayer = DocumentLayer()
  
      override var isFlipped: Bool {
          return true
      }
  
      override func awakeFromNib() {
          wantsLayer = true
          layerContentsRedrawPolicy = .onSetNeedsDisplay
          documentLayer.backgroundColor = NSColor.darkGray.cgColor
  
          let shape = CAShapeLayer()
          let circlePath = CGMutablePath()
          circlePath.addEllipse(in: CGRect(x: 160, y: 100, width: 50, height: 50))
          shape.lineWidth = 1
          shape.strokeColor = NSColor.red.cgColor
          shape.fillColor = NSColor.clear.cgColor
          shape.path = circlePath
          documentLayer.addSublayer(shape)
          needsDisplay = true
  
      }
  
      override func makeBackingLayer() -&gt; CALayer {
          return documentLayer
      }
  
     .....
  }
  </code></pre>
  
  <p>DocumentLayer of ContentView:</p>
  
  <pre><code>class DocumentLayer : CALayer {
  
      override init() {
          super.init()
          contentsScale = 2
      }
  
      required init?(coder aDecoder: NSCoder) {
          fatalError("init(coder:) has not been implemented")
      }
  
      override func draw(in ctx: CGContext) {
          super.draw(in: ctx)
          ctx.setStrokeColor(NSColor.red.cgColor)
          ctx.addEllipse(in: CGRect(x: 100, y: 100, width: 50, height: 50))
          ctx.drawPath(using: .stroke)
      }
  }
  </code></pre>
  
  <p>When Scale bigger, then get a smooth circle and unsmooth circle:</p>
  
  <p><a href="https://i.stack.imgur.com/CvT5l.png" rel="nofollow noreferrer">circle pic</a></p>
  
  <p>The smooth circle is create by CAShapeLayer, and unsmooth circle is create by cgContext. </p>
  
  <p></p>
  
  <p>How the CAShapeLayer's internal work ?
  How can I get a smooth with CGContext ?
  That's my questions! </p>