title: Graphics Context is Twice as Big as Expected
body: <p>I am developing a Swift MacOS app for drawing. The following subset of my code shows my problem.</p>
  <pre><code>import Cocoa
  
  class AppDelegate: NSObject, NSApplicationDelegate {
  
      func applicationDidFinishLaunching(_ aNotification: Notification) {
          var window: NSWindow!
          window = NSWindow(contentRect: NSMakeRect( 0, 0, 1000, 1000 ),styleMask:[.titled, .closable, .miniaturizable, .resizable], backing: .buffered, defer: false)
          window.makeKeyAndOrderFront(window)
  
          print(&quot;windowHeight = \(window.frame.height)&quot;)
          print(&quot;windowWidth  = \(window.frame.width)&quot;)
      
          let view = Renderer( frame:NSMakeRect( 0, 0, 1000, 1000 ) )
          view.autoresizingMask = [.width, .height]
          window.contentView!.addSubview (view)
  
          print(&quot;viewHeight = \(view.frame.height)&quot;)
          print(&quot;viewWidth  = \(view.frame.width)&quot;)
      }
          
      func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -&gt; Bool{return true}
      func applicationWillTerminate(_ aNotification: Notification) { }
  }
  
  let appDelegate = AppDelegate()
  let application = NSApplication.shared
  application.setActivationPolicy(.regular)
  application.delegate = appDelegate
  application.activate(ignoringOtherApps:true)
  application.run()
  
  
  class Renderer: NSView {
              
      override func draw(_ rect: NSRect) {
          super.draw(rect)
          
          print(&quot;rectHeight = \(rect.height)&quot;)
          print(&quot;rectWidth  = \(rect.width)&quot;)
          
          guard let gc = NSGraphicsContext.current?.cgContext else {return}  // gc = graphics context
          
          print(&quot;gc.height = \(gc.height)&quot;)
          print(&quot;gc.width  = \(gc.width)&quot;)
          
          // The rest of my drawing code goes here.
      }
  }
  </code></pre>
  <p>When running this code, the printout is:</p>
  <pre><code>    windowHeight = 1022.0   windowWidth = 1000.0
      viewHeight   = 1000.0   viewWidth   = 1000.0
      rectHeight   = 1000.0   rectWidth   = 1000.0
      gc.height    = 2000     gc.width    = 2000
  </code></pre>
  <p>When I've declared the window, view, and rect to all be of size 1000 by 1000, why does the current GraphicsContext say that it is size 2000 by 2000 ?</p>